1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(windows): Snorenotify build script

Fixing 7409e6b4cc.
This commit is contained in:
Maxim Biro 2020-10-04 09:38:25 -04:00
parent a59c960d81
commit 7803a7e0d6
No known key found for this signature in database
GPG Key ID: AB3AD9896472BFA4

View File

@ -130,10 +130,12 @@ apt-get update
apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
bsdtar \
build-essential \
ca-certificates \
cmake \
curl \
extra-cmake-modules \
git \
libtool \
nsis \
@ -142,10 +144,8 @@ apt-get install -y --no-install-recommends \
tclsh \
texinfo \
unzip \
curl \
yasm \
zip \
extra-cmake-modules
zip
if [[ "$ARCH" == "i686" ]]
then
@ -664,6 +664,7 @@ else
echo "Using cached build of Exif `cat $EXIF_PREFIX_DIR/done`"
fi
# Snorenotify
SNORE_PREFIX_DIR="$DEP_DIR/snorenotify"
@ -680,45 +681,46 @@ then
bsdtar --no-same-owner --no-same-permissions -xf $SNORE_FILENAME
rm $SNORE_FILENAME
cd snorenotify*
mkdir _build && cd _build
PKG_CONFIG_PATH=""
PKG_CONFIG_LIBDIR=""
CMAKE_FIND_ROOT_PATH=""
for PREFIX_DIR in $DEP_DIR/*; do
if [ -d $PREFIX_DIR/lib/pkgconfig ]
then
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX_DIR/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_LIBDIR:$PREFIX_DIR/lib/pkgconfig"
fi
CMAKE_FIND_ROOT_PATH="$CMAKE_FIND_ROOT_PATH $PREFIX_DIR"
done
export PKG_CONFIG_PATH="$QT_PREFIX_DIR/lib/pkgconfig"
export PKG_CONFIG_LIBDIR="/usr/$ARCH-w64-mingw32"
echo "
echo "
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER $ARCH-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER $ARCH-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER $ARCH-w64-mingw32-windres)
SET(CMAKE_FIND_ROOT_PATH /usr/$ARCH-w64-mingw32 $CMAKE_FIND_ROOT_PATH)
" > toolchain.cmake
cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain.cmake \
SET(CMAKE_FIND_ROOT_PATH /usr/$ARCH-w64-mingw32 $QT_PREFIX_DIR)
" > toolchain.cmake
cmake -DCMAKE_INSTALL_PREFIX="$SNORE_PREFIX_DIR" \
-DCMAKE_BUILD_TYPE=Relase \
-DCMAKE_INSTALL_PREFIX="$SNORE_PREFIX_DIR" \
-DBUILD_daemon=OFF \
-DBUILD_settings=OFF \
-DBUILD_snoresend=OFF \
-DCMAKE_TOOLCHAIN_FILE=./toolchain.cmake \
..
make
make install
cd ..
echo -n $SNORE_VERSION > $SNORE_PREFIX_DIR/done
unset PKG_CONFIG_PATH
unset PKG_CONFIG_LIBDIR
cd ..
cd ..
rm -rf ./snorenotify*
else
echo "Using cached build of snorenotify `cat $SNORE_PREFIX_DIR/done`"
fi
# Opus
OPUS_PREFIX_DIR="$DEP_DIR/libopus"
@ -1285,6 +1287,7 @@ cp -r $QT_PREFIX_DIR/plugins/imageformats \
$QT_PREFIX_DIR/plugins/iconengines \
$QTOX_PREFIX_DIR
cp {$OPENSSL_PREFIX_DIR,$SQLCIPHER_PREFIX_DIR,$FFMPEG_PREFIX_DIR,$OPENAL_PREFIX_DIR,$QRENCODE_PREFIX_DIR,$EXIF_PREFIX_DIR,$OPUS_PREFIX_DIR,$SODIUM_PREFIX_DIR,$VPX_PREFIX_DIR,$TOXCORE_PREFIX_DIR}/bin/*.dll $QTOX_PREFIX_DIR
cp "$SNORE_PREFIX_DIR/bin/libsnore-qt5.dll" $QTOX_PREFIX_DIR
mkdir -p "$QTOX_PREFIX_DIR/libsnore-qt5"
cp "$SNORE_PREFIX_DIR/lib/plugins/libsnore-qt5/libsnore_backend_windowstoast.dll" "$QTOX_PREFIX_DIR/libsnore-qt5"
@ -1304,7 +1307,7 @@ then
fi
winecfg
# dll checks
# qtox.exe dll checks (32-bit on i686, 64-bit on x86_64)
python3 $MINGW_LDD_PREFIX_DIR/bin/mingw-ldd.py $QTOX_PREFIX_DIR/qtox.exe --dll-lookup-dirs $QTOX_PREFIX_DIR ~/.wine/drive_c/windows/system32 > /tmp/$ARCH-qtox-ldd
find "$QTOX_PREFIX_DIR" -name '*.dll' > /tmp/$ARCH-qtox-dll-find
# dlls loded at run time that don't showup as a link time dependency
@ -1346,6 +1349,26 @@ do
done < /tmp/$ARCH-qtox-dll-find
# SnoreToast.exe dll checks (always 32-bit)
if [[ "$ARCH" == "i686" ]]
then
SNORETOAST_WINE_DLLS=/root/.wine/drive_c/windows/system32
elif [[ "$ARCH" == "x86_64" ]]
then
SNORETOAST_WINE_DLLS=/root/.wine/drive_c/windows/syswow64
fi
python3 $MINGW_LDD_PREFIX_DIR/bin/mingw-ldd.py $QTOX_PREFIX_DIR/SnoreToast.exe --dll-lookup-dirs $SNORETOAST_WINE_DLLS > /tmp/$ARCH-SnoreToast-ldd
# Check that all dlls are in place
if grep 'not found' /tmp/$ARCH-SnoreToast-ldd
then
cat /tmp/$ARCH-SnoreToast-ldd
echo "Error: Missing some dlls."
exit 1
fi
# Run tests (only on Travis)
set +u
if [[ -n "$TRAVIS_CI_STAGE" ]]