Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

58 righe
1.9 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 --depth 1 -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 --depth 1 -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. find_dll() {
  31. filename=$(x86_64-w64-mingw32-gcc -print-file-name=$1)
  32. if [ -f $filename ]; then
  33. echo $filename
  34. else
  35. filename=$(x86_64-w64-mingw32-gcc -print-sysroot)/mingw/bin/$1
  36. if [ -f $filename ]; then
  37. echo $filename
  38. else
  39. echo "Could not find $1" >&2
  40. return 1
  41. fi
  42. fi
  43. }
  44. # Copy required GCC libs
  45. cp $(find_dll libgcc_s_seh-1.dll) $TEMP_PATH/bin
  46. cp $(find_dll libwinpthread-1.dll) $TEMP_PATH/bin
  47. # Build aptdec
  48. cmake -B $BUILD_DIR -DCMAKE_BUILD_TYPE=$1 -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH
  49. cmake --build $BUILD_DIR -j$(nproc)
  50. cmake --build $BUILD_DIR --target package