From f394f6a356eef36fc8c6ad8a6c7be27c119a60a6 Mon Sep 17 00:00:00 2001 From: Xerbo Date: Sun, 22 Jan 2023 13:46:15 +0000 Subject: [PATCH] Make build_windows.sh faster --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- build_windows.sh | 23 +++++++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96197d9..c4acba6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,4 +60,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: ZIP package - path: build/aptdec_*.zip + path: winbuild/aptdec_*.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6eb4f4e..3176de3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,4 +86,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: ZIP package - path: build/aptdec_*.zip + path: winbuild/aptdec_*.zip diff --git a/build_windows.sh b/build_windows.sh index 3f178a5..40bf725 100755 --- a/build_windows.sh +++ b/build_windows.sh @@ -7,7 +7,7 @@ BUILD_DIR="winbuild" # Build zlib from source if [ ! -d "zlib" ]; then - git clone -b v1.2.13 https://github.com/madler/zlib && cd zlib + git clone --depth 1 -b v1.2.13 https://github.com/madler/zlib && cd zlib cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH cmake --build build -j$(nproc) cmake --build build --target install @@ -16,7 +16,7 @@ fi # Build libpng from source if [ ! -d "libpng" ]; then - git clone -b v1.6.39 https://github.com/glennrp/libpng && cd libpng + git clone --depth 1 -b v1.6.39 https://github.com/glennrp/libpng && cd libpng cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH cmake --build build -j$(nproc) cmake --build build --target install @@ -32,9 +32,24 @@ if [ ! -d libsndfile-1.2.0-win64 ]; then cp "libsndfile-1.2.0-win64/lib/sndfile.lib" $TEMP_PATH/lib fi +find_dll() { + filename=$(x86_64-w64-mingw32-gcc -print-file-name=$1) + if [ -f $filename ]; then + echo $filename + else + filename=$(x86_64-w64-mingw32-gcc -print-sysroot)/mingw/bin/$1 + if [ -f $filename ]; then + echo $filename + else + echo "Could not find $1" >&2 + return 1 + fi + fi +} + # Copy required GCC libs -cp $(find /usr | grep libgcc_s_seh-1.dll | head -n 1) $TEMP_PATH/bin -cp $(find /usr | grep libwinpthread-1.dll | head -n 1) $TEMP_PATH/bin +cp $(find_dll file-name=libgcc_s_seh-1.dll) $TEMP_PATH/bin +cp $(find_dll file-name=libwinpthread-1.dll) $TEMP_PATH/bin # Build aptdec cmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=$1 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH