put meson-build script for windows (mingw64)

Signed-off-by: Vadim Lomovtsev <jelezny@gmail.com>
This commit is contained in:
Vadim Lomovtsev 2024-03-29 15:58:02 +03:00 committed by Maxim Logaev
parent 81253f28cc
commit 799ad11339
2 changed files with 125 additions and 1 deletions

2
.gitignore vendored
View file

@ -6,7 +6,7 @@ Makefile
.idea
.sqlite3
gschemas.compiled
windows-installer/win64-dist/
windows-installer/win64-*/
*.exe
*.dll
*.flatpak

124
build-meson-windows.sh Normal file
View file

@ -0,0 +1,124 @@
#!/bin/bash
set -eu
PROJ_DIR=$PWD
BUILD_DIR=$PROJ_DIR/build/meson
DIST_DIR=$PROJ_DIR/windows-installer/win64-meson
prepare()
{
if [ -d ${PROJ_DIR}/plugins/windows-notification/yolort ]; then
echo "No need to re-download packages & yolort sources."
else
bash build-win64.sh --prepare
fi
}
configure()
{
arg=${1:-"none"}
local cmd=""
if [ x"${arg}" == x"reconfig" ]; then
cmd=--reconfigure
fi
mkdir -p $BUILD_DIR
meson setup ${cmd} --prefix "$DIST_DIR" \
--buildtype=debug \
-D crypto-backend=gnutls \
$PROJ_DIR $BUILD_DIR
}
build()
{
cd $BUILD_DIR && ninja
ninja install
}
clean()
{
rm -rf $DIST_DIR $BUILD_DIR
}
help()
{
cat << EOF
Script to build Dino for windows using meson build-system.
By default it will be build using build directory
$BUILD_DIR
and installed to
$DIST_DIR
Usage: $0 [option]
--prepare, -p
install build dependencies. may be done once.
--configure, -c
configure build using meson.
--build, -b
invoked build.
--reconfig, -r
reconfigure project, if minor changes were
done tobuild config files but build has been
configured already.
--whipe, -w
remove build artifacts from $BUILD_DIR
--verbose, -v
verbose output enable.
--help, -h
print this help message.
EOF
}
# Main
if [[ "$(uname)" != "MINGW64_NT"* ]]; then
fatal "This is not a MINGW64 environment!"
fi
if [[ $# == 0 ]]; then
prepare
configure
build
exit 0
fi
while [[ $# > 0 ]];
do
case $1 in
--prepare|-p)
prepare
;;
--configure|-c)
configure
;;
--build|-b)
build
;;
--reconfig|-r)
configure reconfig
;;
--whipe|-w)
clean
;;
--verbose|-v)
set -xv
;;
--help|-h)
help
;;
*)
echo "Unkown option $1"
exit 1
;;
esac
shift
done