win_compile.sh 1.84 KB
Newer Older
1 2 3 4 5 6
#!/bin/bash

rootdir=$(pwd)
HOST=i686-w64-mingw32
ARCH=32
CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild.cmake
Olivier SOLDANO's avatar
Olivier SOLDANO committed
7
echo "running compilation on ${CORES:=`nproc --all`} threads"
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

while test -n "$1"
do
  case "$1" in
  --clean)
  ;;
  --arch=*)
  ARCH="${1#--arch=}"
  ;;
  esac
  shift
done

if [ "$ARCH" = "64" ]
then
HOST=x86_64-w64-mingw32
CMAKE_TOOLCHAIN_FILE=$rootdir/lrc/cmake/winBuild64.cmake
fi

27
INSTALL_PREFIX=$rootdir/install_win${ARCH}
28 29 30 31 32 33 34


cd daemon/contrib
mkdir -p native${ARCH}
cd native${ARCH}
../bootstrap --host=${HOST}
make fetch || exit 1
35
make -j$CORES || exit 1
36 37 38 39 40 41
cd ../..
./autogen.sh || exit 1
mkdir -p "build${ARCH}"
cd build${ARCH}
$rootdir/daemon/configure --host=${HOST} --without-dbus --prefix=$INSTALL_PREFIX
rsync -a $rootdir/daemon/src/buildinfo.cpp ./src/buildinfo.cpp
42
make -j$CORES install || exit 1
43 44 45 46 47 48 49
cd $rootdir

cd lrc
mkdir -p build${ARCH}
cd build${ARCH}
export CMAKE_PREFIX_PATH=/usr/${HOST}/sys-root/mingw/lib/cmake
cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DRING_BUILD_DIR=$INSTALL_PREFIX -DENABLE_LIBWRAP=true ..
50
make -j$CORES install || exit 1
51 52 53 54
cd $rootdir

cd client-windows
git submodule update --init
55
if [ ! -f "$INSTALL_PREFIX/bin/WinSparkle.dll" ]
56 57 58 59 60
then
cd winsparkle
git submodule init && git submodule update
mkdir -p build${ARCH} && cd build${ARCH}
cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX ../cmake
61
make -j$CORES || exit 1
62 63 64
make install
cd ../../
fi
65
if [ ! -f "$INSTALL_PREFIX/bin/libqrencode.dll" ]
66 67 68 69 70
then
cd libqrencode
./autogen.sh || exit 1
mkdir -p build${ARCH} && cd build${ARCH}
../configure --host=${HOST} --prefix=$INSTALL_PREFIX
71
make -j$CORES || exit 1
72 73 74
make install
cd ../..
fi
75 76
mkdir -p build${ARCH}
cd build${ARCH}
77
${HOST}-qmake-qt5 ../RingWinClient.pro -r -spec mingw-w64-g++ RING=$INSTALL_PREFIX
78
make -j$CORES || exit 1
79
make install