From ad3b9ed0ed6b6525f80f51d7c8e514f082544f75 Mon Sep 17 00:00:00 2001 From: Xerbo Date: Wed, 9 Sep 2020 11:45:33 +0100 Subject: [PATCH] Rewrite the windows build script --- build_windows.sh | 63 +++++++++++++++++++------------------- cmake/FindLibSndFile.cmake | 2 +- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/build_windows.sh b/build_windows.sh index c9b1018..c2e094a 100755 --- a/build_windows.sh +++ b/build_windows.sh @@ -1,44 +1,45 @@ -WINE_LIBSNDFILE_PATH=~/.wine/drive_c/Program\ Files/Mega-Nerd/libsndfile -TEMP_PATH=/tmp/windows_build +TEMP_PATH="$(pwd)/winpath" +set -e -# Compile zlib -git clone https://github.com/madler/zlib && cd zlib -mkdir build && cd build +# Compile and build zlib +if [ -d "zlib" ]; then + cd zlib && git pull +else + git clone https://github.com/madler/zlib && cd zlib +fi + +mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH .. make -j4 make install -cd ../../ +cd ../.. + +# Clone and build ligpng +if [ -d "libpng" ]; then + cd libpng && git pull +else + git clone https://github.com/glennrp/libpng && cd libpng +fi -# Compile libpng -git clone https://github.com/glennrp/libpng && cd libpng -mkdir build && cd build +mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH .. make -j4 make install -cd ../../ +cd ../.. -# Download libsndfile (compiling from source is an absolute bitch) -if [[ ! -e $WINE_LIBSNDFILE_PATH ]]; then - wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28-w64-setup.exe - echo "This build script has guessed that you don't have libsndfile installed under wine, the libsndfile installer will be launched" - read - wine libsndfile-1.0.28-w64-setup.exe +# Download libsndfile +if [ ! -d "libsndfile-1.0.29-win64" ]; then + wget https://github.com/erikd/libsndfile/releases/download/v1.0.29/libsndfile-1.0.29-win64.zip + unzip libsndfile-1.0.29-win64.zip fi -if [[ ! -e $WINE_LIBSNDFILE_PATH ]]; then - echo "Something went wrong installing libsndfile" - exit -fi - -cp "$WINE_LIBSNDFILE_PATH/lib/libsndfile-1.def" $TEMP_PATH/lib/libsndfile-1.def -cp "$WINE_LIBSNDFILE_PATH/lib/libsndfile-1.lib" $TEMP_PATH/lib/libsndfile-1.lib -cp "$WINE_LIBSNDFILE_PATH/lib/pkgconfig/sndfile.pc" $TEMP_PATH/lib/pkgconfig/sndfile.pc -cp "$WINE_LIBSNDFILE_PATH/bin/libsndfile-1.dll" $TEMP_PATH/bin/libsndfile-1.dll -cp "$WINE_LIBSNDFILE_PATH/include/sndfile.h" $TEMP_PATH/include/sndfile.h +cp "libsndfile-1.0.29-win64/bin/sndfile.dll" $TEMP_PATH/bin/libsndfile-1.dll +cp "libsndfile-1.0.29-win64/include/sndfile.h" $TEMP_PATH/include/sndfile.h -sed -i "s/c:\/devel\/target\/libsndfile/$(echo $TEMP_PATH | sed 's/\//\\\//g')/g" $TEMP_PATH/lib/pkgconfig/sndfile.pc +# Copy DLL's into root for CPack +cp $TEMP_PATH/bin/*.dll ../ -mkdir build && cd build +# Build aptdec +mkdir -p winbuild && cd winbuild cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH .. -cp $TEMP_PATH/bin/*.dll ./ - -echo "Done, you should have a executable called aptdec.exe" +make -j 4 +make package diff --git a/cmake/FindLibSndFile.cmake b/cmake/FindLibSndFile.cmake index cd58900..6b381b1 100644 --- a/cmake/FindLibSndFile.cmake +++ b/cmake/FindLibSndFile.cmake @@ -1,7 +1,7 @@ # Find libsndfile FIND_PATH(LIBSNDFILE_INCLUDE_DIR sndfile.h) -SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile libsndfile-1) +SET(LIBSNDFILE_NAMES ${LIBSNDFILE_NAMES} sndfile libsndfile) FIND_LIBRARY(LIBSNDFILE_LIBRARY NAMES ${LIBSNDFILE_NAMES} PATH) IF(LIBSNDFILE_INCLUDE_DIR AND LIBSNDFILE_LIBRARY)