You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

43 regels
1.6 KiB

  1. #!/usr/bin/env bash
  2. # Cross compile for Windows from Linux
  3. set -e
  4. TEMP_PATH="$(pwd)/winpath"
  5. BUILD_DIR="winbuild"
  6. # Build zlib from source
  7. if [ ! -d "zlib" ]; then
  8. git clone -b v1.2.13 https://github.com/madler/zlib && cd zlib
  9. cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH
  10. cmake --build build -j$(nproc)
  11. cmake --build build --target install
  12. cd ..
  13. fi
  14. # Build libpng from source
  15. if [ ! -d "libpng" ]; then
  16. git clone -b v1.6.39 https://github.com/glennrp/libpng && cd libpng
  17. cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH
  18. cmake --build build -j$(nproc)
  19. cmake --build build --target install
  20. cd ..
  21. fi
  22. # Download libsndfile
  23. if [ ! -d libsndfile-1.2.0-win64 ]; then
  24. wget https://github.com/libsndfile/libsndfile/releases/download/1.2.0/libsndfile-1.2.0-win64.zip
  25. unzip libsndfile-1.2.0-win64.zip
  26. cp "libsndfile-1.2.0-win64/bin/sndfile.dll" $TEMP_PATH/bin
  27. cp "libsndfile-1.2.0-win64/include/sndfile.h" $TEMP_PATH/include
  28. cp "libsndfile-1.2.0-win64/lib/sndfile.lib" $TEMP_PATH/lib
  29. fi
  30. # Copy required GCC libs
  31. cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll $TEMP_PATH/bin
  32. cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll $TEMP_PATH/bin
  33. # Build aptdec
  34. cmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=$1 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH
  35. cmake --build $BUILD_DIR -j$(nproc)
  36. cmake --build $BUILD_DIR --target package