mirror of
https://github.com/ARMSX2/ARMSX1.git
synced 2026-08-24 16:53:35 -07:00
Migrate CI to Gitea and clean README links
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
abis="${ANDROID_ABIS:-x86 x86_64 armeabi-v7a arm64-v8a}"
|
||||
|
||||
if [ -z "${ANDROID_NDK_ROOT:-}" ]; then
|
||||
echo "ANDROID_NDK_ROOT must be set." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${GRADLE_BIN:-}" ]; then
|
||||
echo "GRADLE_BIN must be set to a Gradle executable." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$repo_root/android/app/src/main/jniLibs" \
|
||||
"$repo_root/android/native-deps"
|
||||
|
||||
for abi in $abis; do
|
||||
echo "Building Android ABI: $abi"
|
||||
(
|
||||
cd "$repo_root"
|
||||
ANDROID_ABI="$abi" ./build.sh android
|
||||
)
|
||||
done
|
||||
|
||||
(
|
||||
cd "$repo_root"
|
||||
export ARMSX_SKIP_NATIVE_PREPARE=1
|
||||
"$GRADLE_BIN" -p android --no-daemon assembleDebug
|
||||
)
|
||||
Executable
+134
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
target="${1:-}"
|
||||
build_jobs="${BUILD_JOBS:-4}"
|
||||
|
||||
if [ -z "$target" ]; then
|
||||
echo "Usage: $0 <x64|x32|arm64|arm32>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
fsui_build_dir="$repo_root/build/fsui/ci-linux-$target"
|
||||
artifact_root="$repo_root/artifacts/linux/$target"
|
||||
package_root="$artifact_root/armsx-linux-$target"
|
||||
package_zip="$artifact_root/armsx-linux-$target.zip"
|
||||
|
||||
cmake_args=(
|
||||
-S "$repo_root/third_party/fsui-lib"
|
||||
-B "$fsui_build_dir"
|
||||
-DFSUI_BUILD_SAMPLES=OFF
|
||||
-DFSUI_PLATFORM_BACKEND=SDL2
|
||||
-DFSUI_USE_SYSTEM_SDL2=ON
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
)
|
||||
|
||||
extra_cflags=""
|
||||
extra_ldflags=""
|
||||
pkg_config_libdir=""
|
||||
dep_search_dirs=""
|
||||
|
||||
case "$target" in
|
||||
x64)
|
||||
cc="gcc"
|
||||
cxx="g++"
|
||||
pkg_config_libdir="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
|
||||
dep_search_dirs="/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib64:/usr/lib64"
|
||||
;;
|
||||
x32|x86)
|
||||
target="x32"
|
||||
cc="gcc"
|
||||
cxx="g++"
|
||||
extra_cflags="-m32"
|
||||
extra_ldflags="-m32"
|
||||
pkg_config_libdir="/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig"
|
||||
dep_search_dirs="/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu"
|
||||
;;
|
||||
arm64)
|
||||
cc="aarch64-linux-gnu-gcc"
|
||||
cxx="aarch64-linux-gnu-g++"
|
||||
pkg_config_libdir="/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
|
||||
dep_search_dirs="/lib/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu:/usr/aarch64-linux-gnu/lib"
|
||||
cmake_args+=(
|
||||
-DCMAKE_SYSTEM_NAME=Linux
|
||||
-DCMAKE_SYSTEM_PROCESSOR=aarch64
|
||||
)
|
||||
;;
|
||||
arm32)
|
||||
cc="arm-linux-gnueabihf-gcc"
|
||||
cxx="arm-linux-gnueabihf-g++"
|
||||
pkg_config_libdir="/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig"
|
||||
dep_search_dirs="/lib/arm-linux-gnueabihf:/usr/lib/arm-linux-gnueabihf:/usr/arm-linux-gnueabihf/lib"
|
||||
cmake_args+=(
|
||||
-DCMAKE_SYSTEM_NAME=Linux
|
||||
-DCMAKE_SYSTEM_PROCESSOR=arm
|
||||
)
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported Linux target '$target'." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
export PKG_CONFIG_LIBDIR="$pkg_config_libdir"
|
||||
unset PKG_CONFIG_PATH
|
||||
|
||||
if [ -n "$extra_cflags" ]; then
|
||||
cmake_args+=(
|
||||
-DCMAKE_C_FLAGS="$extra_cflags"
|
||||
-DCMAKE_CXX_FLAGS="$extra_cflags"
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$extra_ldflags"
|
||||
)
|
||||
fi
|
||||
|
||||
cmake_args+=(
|
||||
-DCMAKE_C_COMPILER="$cc"
|
||||
-DCMAKE_CXX_COMPILER="$cxx"
|
||||
)
|
||||
|
||||
sdl_cflags="$(pkg-config --cflags sdl2)"
|
||||
sdl_libs="$(pkg-config --libs sdl2)"
|
||||
|
||||
if [ -n "$extra_cflags" ]; then
|
||||
sdl_cflags="$sdl_cflags $extra_cflags"
|
||||
sdl_libs="$sdl_libs $extra_ldflags"
|
||||
fi
|
||||
|
||||
rm -rf "$fsui_build_dir" "$artifact_root"
|
||||
mkdir -p "$artifact_root"
|
||||
|
||||
cmake "${cmake_args[@]}"
|
||||
cmake --build "$fsui_build_dir" -j"$build_jobs"
|
||||
|
||||
cd "$repo_root"
|
||||
make clean
|
||||
make \
|
||||
CC="$cc" \
|
||||
CXX="$cxx" \
|
||||
FSUI_BUILD_DIR="$fsui_build_dir" \
|
||||
SDL_STATIC=0 \
|
||||
SDL_CFLAGS="$sdl_cflags" \
|
||||
SDL_LIBS_DYNAMIC="$sdl_libs" \
|
||||
PLATFORM_EXTRA_LDFLAGS="-static-libstdc++ -static-libgcc"
|
||||
|
||||
mkdir -p "$package_root/lib" "$package_root/icons"
|
||||
cp "$repo_root/bin/armsx" "$package_root/armsx.bin"
|
||||
cp -R "$repo_root/icons/." "$package_root/icons/"
|
||||
"$repo_root/scripts/ci/copy-linux-runtime-deps.sh" "$repo_root/bin/armsx" "$package_root/lib" "$dep_search_dirs"
|
||||
|
||||
cat > "$package_root/armsx" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
app_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export LD_LIBRARY_PATH="$app_dir/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
exec "$app_dir/armsx.bin" "$@"
|
||||
EOF
|
||||
|
||||
chmod +x "$package_root/armsx"
|
||||
|
||||
(
|
||||
cd "$artifact_root"
|
||||
zip -r "$(basename "$package_zip")" "$(basename "$package_root")"
|
||||
)
|
||||
Executable
+104
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
target="${1:-}"
|
||||
build_jobs="${BUILD_JOBS:-4}"
|
||||
|
||||
if [ -z "$target" ]; then
|
||||
echo "Usage: $0 <x64|x32>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
artifact_root="$repo_root/artifacts/windows/$target"
|
||||
package_root="$artifact_root/armsx-windows-$target"
|
||||
package_zip="$artifact_root/armsx-windows-$target.zip"
|
||||
sdl_build_dir="$repo_root/build/sdl/windows-$target"
|
||||
sdl_install_dir="$sdl_build_dir/install"
|
||||
fsui_build_dir="$repo_root/build/fsui/ci-windows-$target"
|
||||
|
||||
case "$target" in
|
||||
x64)
|
||||
triplet="x86_64-w64-mingw32"
|
||||
toolchain_file="$repo_root/third_party/SDL/build-scripts/cmake-toolchain-mingw64-x86_64.cmake"
|
||||
;;
|
||||
x32|x86)
|
||||
target="x32"
|
||||
triplet="i686-w64-mingw32"
|
||||
toolchain_file="$repo_root/third_party/SDL/build-scripts/cmake-toolchain-mingw64-i686.cmake"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported Windows target '$target'." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -rf "$artifact_root" "$sdl_build_dir" "$fsui_build_dir"
|
||||
mkdir -p "$artifact_root"
|
||||
|
||||
cmake -S "$repo_root/third_party/SDL" -B "$sdl_build_dir" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$toolchain_file" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DSDL_SHARED=ON \
|
||||
-DSDL_STATIC=OFF \
|
||||
-DSDL_TEST=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="$sdl_install_dir"
|
||||
cmake --build "$sdl_build_dir" -j"$build_jobs"
|
||||
cmake --install "$sdl_build_dir"
|
||||
|
||||
sdl_include="$sdl_install_dir/include/SDL2"
|
||||
sdl_lib="$sdl_install_dir/lib"
|
||||
sdl_dll="$(find "$sdl_install_dir" -type f \( -name 'SDL2.dll' -o -name 'libSDL2.dll' \) | head -n 1)"
|
||||
if [ -z "$sdl_dll" ]; then
|
||||
echo "Unable to locate SDL2.dll in $sdl_install_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmake -S "$repo_root/third_party/fsui-lib" -B "$fsui_build_dir" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$toolchain_file" \
|
||||
-DFSUI_BUILD_SAMPLES=OFF \
|
||||
-DFSUI_PLATFORM_BACKEND=SDL2 \
|
||||
-DFSUI_USE_SYSTEM_SDL2=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH="$sdl_install_dir"
|
||||
cmake --build "$fsui_build_dir" -j"$build_jobs"
|
||||
|
||||
cd "$repo_root"
|
||||
make clean
|
||||
make \
|
||||
CC="$triplet-gcc" \
|
||||
CXX="$triplet-g++" \
|
||||
WINDRES="$triplet-windres" \
|
||||
WINDOWS_TARGET=1 \
|
||||
SDL_STATIC=0 \
|
||||
FSUI_BUILD_DIR="$fsui_build_dir" \
|
||||
SDL_CFLAGS="-I$sdl_include" \
|
||||
SDL_LIBS_DYNAMIC="-L$sdl_lib -lSDL2 -lsetupapi -limm32 -lversion -lwinmm -lgdi32 -lole32 -loleaut32 -lshell32 -luuid -lopengl32" \
|
||||
PLATFORM_EXTRA_LDFLAGS="-static-libstdc++ -static-libgcc"
|
||||
|
||||
mkdir -p "$package_root/icons"
|
||||
cp "$repo_root/bin/armsx.exe" "$package_root/"
|
||||
cp "$sdl_dll" "$package_root/SDL2.dll"
|
||||
cp -R "$repo_root/icons/." "$package_root/icons/"
|
||||
|
||||
for runtime_dll in \
|
||||
"$("$triplet-g++" -print-file-name=libstdc++-6.dll)" \
|
||||
"$("$triplet-g++" -print-file-name=libwinpthread-1.dll)"; do
|
||||
if [ -n "$runtime_dll" ] && [ -f "$runtime_dll" ]; then
|
||||
cp "$runtime_dll" "$package_root/"
|
||||
fi
|
||||
done
|
||||
|
||||
gcc_dir="$(dirname "$("$triplet-gcc" -print-libgcc-file-name)")"
|
||||
for libgcc_dll in "$gcc_dir"/libgcc_s_*.dll; do
|
||||
if [ -f "$libgcc_dll" ]; then
|
||||
cp "$libgcc_dll" "$package_root/"
|
||||
fi
|
||||
done
|
||||
|
||||
(
|
||||
cd "$artifact_root"
|
||||
zip -r "$(basename "$package_zip")" "$(basename "$package_root")"
|
||||
)
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <binary> <dest-dir> <search-dir-1:search-dir-2:...>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
binary="$1"
|
||||
dest_dir="$2"
|
||||
search_dirs="$3"
|
||||
|
||||
mkdir -p "$dest_dir"
|
||||
|
||||
declare -A seen=()
|
||||
queue=("$binary")
|
||||
|
||||
resolve_library() {
|
||||
local lib_name="$1"
|
||||
local dir=
|
||||
local old_ifs="$IFS"
|
||||
IFS=':'
|
||||
for dir in $search_dirs; do
|
||||
if [ -f "$dir/$lib_name" ]; then
|
||||
printf '%s\n' "$dir/$lib_name"
|
||||
IFS="$old_ifs"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
IFS="$old_ifs"
|
||||
return 1
|
||||
}
|
||||
|
||||
while [ "${#queue[@]}" -gt 0 ]; do
|
||||
current="${queue[0]}"
|
||||
queue=("${queue[@]:1}")
|
||||
|
||||
while IFS= read -r needed; do
|
||||
[ -n "$needed" ] || continue
|
||||
|
||||
case "$needed" in
|
||||
linux-vdso.so.*|ld-linux*.so.*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "${seen[$needed]:-}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
resolved="$(resolve_library "$needed" || true)"
|
||||
if [ -z "$resolved" ]; then
|
||||
echo "Unable to resolve runtime dependency '$needed' for '$current'." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp -L "$resolved" "$dest_dir/$needed"
|
||||
seen["$needed"]=1
|
||||
queue+=("$resolved")
|
||||
done < <(readelf -d "$current" 2>/dev/null | sed -n 's/.*Shared library: \[\(.*\)\]/\1/p')
|
||||
done
|
||||
Reference in New Issue
Block a user