Add parametrized release script

[ci skip]
This commit is contained in:
Anonymous Maarten 2024-10-04 01:40:42 +02:00
parent 2c60d95ee2
commit e4126d8d6f
7 changed files with 798 additions and 339 deletions

View file

@ -37,9 +37,8 @@ jobs:
shell: bash shell: bash
run: | run: |
python build-scripts/build-release.py \ python build-scripts/build-release.py \
--create source \ --actions source \
--commit ${{ inputs.commit }} \ --commit ${{ inputs.commit }} \
--project SDL2 \
--root "${{ github.workspace }}/SDL" \ --root "${{ github.workspace }}/SDL" \
--github \ --github \
--debug --debug
@ -93,7 +92,7 @@ jobs:
- name: 'Set up Python' - name: 'Set up Python'
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.11'
- name: 'Fetch build-release.py' - name: 'Fetch build-release.py'
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@ -114,9 +113,8 @@ jobs:
shell: bash shell: bash
run: | run: |
python build-scripts/build-release.py \ python build-scripts/build-release.py \
--create framework \ --actions dmg \
--commit ${{ inputs.commit }} \ --commit ${{ inputs.commit }} \
--project SDL2 \
--root "${{ steps.tar.outputs.path }}" \ --root "${{ steps.tar.outputs.path }}" \
--github \ --github \
--debug --debug
@ -192,7 +190,7 @@ jobs:
- name: 'Set up Python' - name: 'Set up Python'
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.11'
- name: 'Fetch build-release.py' - name: 'Fetch build-release.py'
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@ -213,9 +211,8 @@ jobs:
id: releaser id: releaser
run: | run: |
python build-scripts/build-release.py ` python build-scripts/build-release.py `
--create win32 ` --actions msvc `
--commit ${{ inputs.commit }} ` --commit ${{ inputs.commit }} `
--project SDL2 `
--root "${{ steps.zip.outputs.path }}" ` --root "${{ steps.zip.outputs.path }}" `
--github ` --github `
--debug --debug
@ -310,7 +307,7 @@ jobs:
- name: 'Set up Python' - name: 'Set up Python'
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.11'
- name: 'Fetch build-release.py' - name: 'Fetch build-release.py'
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@ -334,9 +331,8 @@ jobs:
id: releaser id: releaser
run: | run: |
python build-scripts/build-release.py \ python build-scripts/build-release.py \
--create mingw \ --actions mingw \
--commit ${{ inputs.commit }} \ --commit ${{ inputs.commit }} \
--project SDL2 \
--root "${{ steps.tar.outputs.path }}" \ --root "${{ steps.tar.outputs.path }}" \
--github \ --github \
--debug --debug
@ -370,12 +366,13 @@ jobs:
mkdir -p /tmp/tardir mkdir -p /tmp/tardir
tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}" tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
- name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}' - name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
id: bin id: bin
run: | run: |
mkdir -p /tmp/mingw-tardir mkdir -p /tmp/mingw-tardir
tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}" tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
echo "path=/tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} cross CROSS_PATH=/tmp/deps-mingw
echo "path=/tmp/deps-mingw" >>$GITHUB_OUTPUT
- name: 'CMake (configure + build) i686' - name: 'CMake (configure + build) i686'
run: | run: |
set -e set -e

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
import argparse import argparse
from pathlib import Path from pathlib import Path
import json
import logging import logging
import re import re
import subprocess import subprocess
@ -10,9 +11,9 @@ ROOT = Path(__file__).resolve().parents[1]
def determine_project() -> str: def determine_project() -> str:
text = (ROOT / "CMakeLists.txt").read_text() text = (ROOT / "build-scripts/release-info.json").read_text()
match = next(re.finditer(r"project\((?P<project>[a-zA-Z0-9_]+)\s+", text, flags=re.M)) release_info = json.loads(text)
project_with_version = match["project"] project_with_version = release_info["name"]
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version) project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
return project return project

View file

@ -0,0 +1,119 @@
{
"name": "SDL2",
"version": {
"file": "include/SDL_version.h",
"re_major": "^#define SDL_MAJOR_VERSION\\s+([0-9]+)$",
"re_minor": "^#define SDL_MINOR_VERSION\\s+([0-9]+)$",
"re_micro": "^#define SDL_PATCHLEVEL\\s+([0-9]+)$"
},
"source": {
"checks": [
"src/SDL.c",
"include/SDL.h",
"test/testsprite2.c",
"android-project/app/src/main/java/org/libsdl/app/SDLActivity.java"
]
},
"dmg": {
"project": "Xcode/SDL/SDL.xcodeproj",
"path": "Xcode/SDL/build/SDL2.dmg",
"target": "Standard DMG"
},
"mingw": {
"autotools": {
"archs": ["x86", "x64"],
"args": [
]
},
"files": {
"/": [
"mingw/pkg-support/INSTALL.txt",
"mingw/pkg-support/Makefile",
"BUGS.txt",
"CREDITS.txt",
"README-SDL.txt",
"WhatsNew.txt",
"LICENSE.txt",
"README.md"
],
"/cmake/": [
"mingw/pkg-support/cmake/sdl2-config.cmake",
"mingw/pkg-support/cmake/sdl2-config-version.cmake"
],
"/docs/": [
"docs/*"
],
"/@TRIPLET@/include/SDL2/": [
"include/SDL_config*.h"
]
}
},
"msvc": {
"msbuild": {
"archs": [
"x86",
"x64"
],
"projects": [
"VisualC/SDL/SDL.vcxproj",
"VisualC/SDLmain/SDLmain.vcxproj",
"VisualC/SDLtest/SDLtest.vcxproj"
],
"files": [
{
"lib": "",
"devel": "lib/@ARCH@",
"paths": [
"VisualC/SDL/@PLATFORM@/@CONFIGURATION@/SDL2.dll"
]
},
{
"devel": "lib/@ARCH@",
"paths": [
"VisualC/SDL/@PLATFORM@/@CONFIGURATION@/SDL2.lib",
"VisualC/SDL/@PLATFORM@/@CONFIGURATION@/SDL2.pdb",
"VisualC/SDLmain/@PLATFORM@/@CONFIGURATION@/SDL2main.lib",
"VisualC/SDLtest/@PLATFORM@/@CONFIGURATION@/SDL2test.lib"
]
}
]
},
"files": [
{
"devel": "",
"lib": "",
"paths": [
"README-SDL.txt"
]
},
{
"devel": "",
"paths": [
"BUGS.txt",
"LICENSE.txt",
"README.md",
"WhatsNew.txt"
]
},
{
"devel": "cmake",
"paths": [
"VisualC/pkg-support/cmake/sdl2-config.cmake",
"VisualC/pkg-support/cmake/sdl2-config-version.cmake"
]
},
{
"devel": "docs",
"paths": [
"docs/*"
]
},
{
"devel": "include",
"paths": [
"include/*.h"
]
}
]
}
}

View file

@ -12,7 +12,10 @@ native:
make install-package arch=i686-w64-mingw32 prefix=/usr make install-package arch=i686-w64-mingw32 prefix=/usr
cross: cross:
mkdir -p $(CROSS_PATH)/cmake
cp -rv cmake/* $(CROSS_PATH)/cmake
for arch in $(ARCHITECTURES); do \ for arch in $(ARCHITECTURES); do \
mkdir -p $(CROSS_PATH)/$$arch; \
make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \ make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \
done done
@ -21,7 +24,13 @@ install-package:
(cd $(arch) && cp -rv bin include lib share $(prefix)/); \ (cd $(arch) && cp -rv bin include lib share $(prefix)/); \
sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/bin/sdl2-config >$(prefix)/bin/sdl2-config; \ sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/bin/sdl2-config >$(prefix)/bin/sdl2-config; \
chmod 755 $(prefix)/bin/sdl2-config; \ chmod 755 $(prefix)/bin/sdl2-config; \
sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/lib/pkgconfig/sdl2.pc >$(prefix)/lib/pkgconfig/sdl2.pc; \ sed "s|^libdir=.*|libdir=\'$(prefix)/lib\'|" <$(arch)/lib/libSDL2.la >$(prefix)/lib/libSDL2.la; \
sed -e "s|^set[(]bindir \".*|set(bindir \"$(prefix)/bin\")|" \
-e "s|^set[(]includedir \".*|set(includedir \"$(prefix)/include\")|" \
-e "s|^set[(]libdir \".*|set(libdir \"$(prefix)/lib\")|" <$(arch)/lib/cmake/SDL2/sdl2-config.cmake >$(prefix)/lib/cmake/SDL2/sdl2-config.cmake; \
sed -e "s|^prefix=.*|prefix=$(prefix)|" \
-e "s|^includedir=.*|includedir=$(prefix)/include|" \
-e "s|^libdir=.*|prefix=$(prefix)/lib|" <$(arch)/lib/pkgconfig/sdl2.pc >$(prefix)/lib/pkgconfig/sdl2.pc; \
else \ else \
echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \ echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \
exit 1; \ exit 1; \

View file

@ -2,9 +2,9 @@
# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw # This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw
if(CMAKE_SIZEOF_VOID_P EQUAL 4) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/SDL2ConfigVersion.cmake") set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/SDL2ConfigVersion.cmake") set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake")
else() else()
set(PACKAGE_VERSION_UNSUITABLE TRUE) set(PACKAGE_VERSION_UNSUITABLE TRUE)
return() return()

View file

@ -2,9 +2,9 @@
# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw # This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw
if(CMAKE_SIZEOF_VOID_P EQUAL 4) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/SDL2Config.cmake") set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/SDL2Config.cmake") set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake")
else() else()
set(SDL2_FOUND FALSE) set(SDL2_FOUND FALSE)
return() return()