mirror of
https://github.com/libsdl-org/SDL
synced 2024-11-21 16:09:08 -07:00
port build-script from SDL3
[ci skip]
This commit is contained in:
parent
c98c4fbff6
commit
4fc47a774f
7 changed files with 1265 additions and 350 deletions
23
.github/workflows/release.yml
vendored
23
.github/workflows/release.yml
vendored
|
@ -37,9 +37,8 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create source \
|
||||
--actions source \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL2 \
|
||||
--root "${{ github.workspace }}/SDL" \
|
||||
--github \
|
||||
--debug
|
||||
|
@ -93,7 +92,7 @@ jobs:
|
|||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
|
@ -114,9 +113,8 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create framework \
|
||||
--actions dmg \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL2 \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
|
@ -192,7 +190,7 @@ jobs:
|
|||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
|
@ -213,9 +211,8 @@ jobs:
|
|||
id: releaser
|
||||
run: |
|
||||
python build-scripts/build-release.py `
|
||||
--create win32 `
|
||||
--actions msvc `
|
||||
--commit ${{ inputs.commit }} `
|
||||
--project SDL2 `
|
||||
--root "${{ steps.zip.outputs.path }}" `
|
||||
--github `
|
||||
--debug
|
||||
|
@ -310,7 +307,7 @@ jobs:
|
|||
- name: 'Set up Python'
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
- name: 'Fetch build-release.py'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
|
@ -334,9 +331,8 @@ jobs:
|
|||
id: releaser
|
||||
run: |
|
||||
python build-scripts/build-release.py \
|
||||
--create mingw \
|
||||
--actions mingw \
|
||||
--commit ${{ inputs.commit }} \
|
||||
--project SDL2 \
|
||||
--root "${{ steps.tar.outputs.path }}" \
|
||||
--github \
|
||||
--debug
|
||||
|
@ -370,12 +366,13 @@ jobs:
|
|||
mkdir -p /tmp/tardir
|
||||
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
|
||||
- name: 'Untar ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
|
||||
- name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
|
||||
id: bin
|
||||
run: |
|
||||
mkdir -p /tmp/mingw-tardir
|
||||
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'
|
||||
run: |
|
||||
set -e
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
|
@ -9,17 +10,18 @@ import subprocess
|
|||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def determine_project() -> str:
|
||||
text = (ROOT / "CMakeLists.txt").read_text()
|
||||
match = next(re.finditer(r"project\((?P<project>[a-zA-Z0-9_]+)\s+", text, flags=re.M))
|
||||
project_with_version = match["project"]
|
||||
def determine_remote() -> str:
|
||||
text = (ROOT / "build-scripts/release-info.json").read_text()
|
||||
release_info = json.loads(text)
|
||||
if "remote" in release_info:
|
||||
return release_info["remote"]
|
||||
project_with_version = release_info["name"]
|
||||
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
|
||||
return project
|
||||
return f"libsdl-org/{project}"
|
||||
|
||||
|
||||
def main():
|
||||
project = determine_project()
|
||||
default_remote = f"libsdl-org/{project}"
|
||||
default_remote = determine_remote()
|
||||
|
||||
current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip()
|
||||
|
||||
|
|
105
build-scripts/release-info.json
Normal file
105
build-scripts/release-info.json
Normal file
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
"name": "SDL2",
|
||||
"remote": "libsdl-org/SDL",
|
||||
"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": {
|
||||
"@<@TRIPLET@>@/include/SDL2": [
|
||||
"include/SDL_config*.h"
|
||||
]
|
||||
}
|
||||
},
|
||||
"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/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"msvc": {
|
||||
"msbuild": {
|
||||
"archs": [
|
||||
"x86",
|
||||
"x64"
|
||||
],
|
||||
"projects": [
|
||||
"VisualC/SDL/SDL.vcxproj",
|
||||
"VisualC/SDLmain/SDLmain.vcxproj",
|
||||
"VisualC/SDLtest/SDLtest.vcxproj"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2.dll"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2.dll",
|
||||
"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-lib": {
|
||||
"": [
|
||||
"README-SDL.txt"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"": [
|
||||
"README-SDL.txt",
|
||||
"BUGS.txt",
|
||||
"LICENSE.txt",
|
||||
"README.md",
|
||||
"WhatsNew.txt"
|
||||
],
|
||||
"cmake": [
|
||||
"VisualC/pkg-support/cmake/sdl2-config.cmake",
|
||||
"VisualC/pkg-support/cmake/sdl2-config-version.cmake"
|
||||
],
|
||||
"docs": [
|
||||
"docs/*"
|
||||
],
|
||||
"include": [
|
||||
"include/*.h"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,10 @@ native:
|
|||
make install-package arch=i686-w64-mingw32 prefix=/usr
|
||||
|
||||
cross:
|
||||
mkdir -p $(CROSS_PATH)/cmake
|
||||
cp -rv cmake/* $(CROSS_PATH)/cmake
|
||||
for arch in $(ARCHITECTURES); do \
|
||||
mkdir -p $(CROSS_PATH)/$$arch; \
|
||||
make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \
|
||||
done
|
||||
|
||||
|
@ -21,7 +24,13 @@ install-package:
|
|||
(cd $(arch) && cp -rv bin include lib share $(prefix)/); \
|
||||
sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/bin/sdl2-config >$(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 \
|
||||
echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \
|
||||
exit 1; \
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# 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)
|
||||
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)
|
||||
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()
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# 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)
|
||||
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)
|
||||
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()
|
||||
set(SDL2_FOUND FALSE)
|
||||
return()
|
||||
|
|
Loading…
Reference in a new issue