merge meson & cmake build scripts
Signed-off-by: Vadim Lomovtsev <jelezny@gmail.com>
This commit is contained in:
parent
4912be6cff
commit
9afa4ddb72
|
@ -61,6 +61,12 @@ Build on Windows (x86_64)
|
|||
```sh
|
||||
./build-win64.sh
|
||||
```
|
||||
If you want to use meson build system, please use `-s meson` key as the first argument, i.e.
|
||||
```sh
|
||||
bash build-win64.sh -s meson -c -b
|
||||
```
|
||||
will do the same as commands above, but using meson.
|
||||
|
||||
Note: the build script has some other options, their description can be found using the `--help`.
|
||||
|
||||
Build Windows Installer (NSIS)
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
#!/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"}
|
||||
encr=${2:-"auto"}
|
||||
local cmd=""
|
||||
if [ x"${arg}" == x"reconfig" ]; then
|
||||
cmd=--reconfigure
|
||||
fi
|
||||
mkdir -p $BUILD_DIR
|
||||
meson setup ${cmd} --prefix "$DIST_DIR" \
|
||||
-D crypto-backend=${encr} \
|
||||
-D plugin-ice=enabled \
|
||||
$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
|
216
build-win64.sh
216
build-win64.sh
|
@ -1,8 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIST_DIR="$PWD/windows-installer/win64-dist"
|
||||
set -eu
|
||||
|
||||
PROJ_DIR=$PWD
|
||||
DIST_DIR=${PROJ_DIR}/windows-installer/win64-dist
|
||||
BUILD_DIR=$PROJ_DIR/build
|
||||
JOBS=$NUMBER_OF_PROCESSORS
|
||||
build_sys='cmake'
|
||||
|
||||
msg()
|
||||
{
|
||||
|
@ -18,7 +22,7 @@ fatal()
|
|||
download_yolort()
|
||||
{
|
||||
file_name=cppwinrt-2.0.210122.3+windows-10.0.19041+yolort-835cd4e.zip
|
||||
yolort_dir="$PWD/plugins/windows-notification/yolort"
|
||||
yolort_dir="$PROJ_DIR/plugins/windows-notification/yolort"
|
||||
|
||||
rm -rf "$yolort_dir"
|
||||
mkdir "$yolort_dir"
|
||||
|
@ -71,6 +75,7 @@ prepare()
|
|||
mingw64/mingw-w64-x86_64-libsignal-protocol-c \
|
||||
mingw64/mingw-w64-x86_64-icu \
|
||||
mingw64/mingw-w64-x86_64-webrtc-audio-processing \
|
||||
mingw64/mingw-w64-x86_64-meson \
|
||||
git \
|
||||
make \
|
||||
unzip \
|
||||
|
@ -87,60 +92,83 @@ prepare()
|
|||
|
||||
}
|
||||
|
||||
configure()
|
||||
configure_cmake()
|
||||
{
|
||||
msg "Running configuration for Windows"
|
||||
./configure --program-prefix="$DIST_DIR" --no-debug --release --disable-fast-vapi --with-libsoup3
|
||||
msg "Configured!"
|
||||
}
|
||||
|
||||
build()
|
||||
build_cmake()
|
||||
{
|
||||
msg "Started building on $JOBS threads"
|
||||
make -j"$JOBS"
|
||||
msg "Successfully builded!"
|
||||
msg "Installing Dino .."
|
||||
make install
|
||||
}
|
||||
|
||||
configure_meson()
|
||||
{
|
||||
arg=${1:-"none"}
|
||||
encr=${2:-"auto"}
|
||||
local cmd=""
|
||||
if [ x"${arg}" == x"reconfig" ]; then
|
||||
cmd=--reconfigure
|
||||
fi
|
||||
mkdir -p $BUILD_DIR
|
||||
meson setup ${cmd} --prefix "$DIST_DIR" \
|
||||
-D crypto-backend=${encr} \
|
||||
-D plugin-ice=enabled \
|
||||
$PROJ_DIR $BUILD_DIR
|
||||
}
|
||||
|
||||
build_meson()
|
||||
{
|
||||
cd $BUILD_DIR && ninja
|
||||
ninja install
|
||||
cd $PROJ_DIR
|
||||
}
|
||||
|
||||
dist_install()
|
||||
{
|
||||
msg "Installing Dino in '$DIST_DIR'!"
|
||||
make install
|
||||
_dist_arg=${1:-$DIST_DIR}
|
||||
|
||||
msg "Copying MINGW64 dependencies"
|
||||
cp /mingw64/bin/gdbus.exe "$DIST_DIR/bin"
|
||||
cp /mingw64/bin/gspawn-win64-helper.exe "$DIST_DIR/bin"
|
||||
cp /mingw64/bin/gdbus.exe "$_dist_arg/bin"
|
||||
cp /mingw64/bin/gspawn-win64-helper.exe "$_dist_arg/bin"
|
||||
|
||||
cp /mingw64/bin/libcrypto-*-x64.dll "$DIST_DIR/bin/"
|
||||
cp -r /mingw64/lib/gstreamer-1.0 "$DIST_DIR/lib"
|
||||
mkdir -p "$DIST_DIR/lib/gdk-pixbuf-2.0/" && cp -r /mingw64/lib/gdk-pixbuf-2.0 "$DIST_DIR/lib/"
|
||||
mkdir -p "$DIST_DIR/lib/gio/" && cp -r /mingw64/lib/gio "$DIST_DIR/lib/"
|
||||
cp /mingw64/bin/libcrypto-*-x64.dll "$_dist_arg/bin/"
|
||||
cp -r /mingw64/lib/gstreamer-1.0 "$_dist_arg/lib"
|
||||
mkdir -p "$_dist_arg/lib/gdk-pixbuf-2.0/" && cp -r /mingw64/lib/gdk-pixbuf-2.0 "$_dist_arg/lib/"
|
||||
mkdir -p "$_dist_arg/lib/gio/" && cp -r /mingw64/lib/gio "$_dist_arg/lib/"
|
||||
|
||||
list=`find "$DIST_DIR" -type f \( -name "*.exe" -o -name "*.dll" \) -exec \
|
||||
list=`find "$_dist_arg" -type f \( -name "*.exe" -o -name "*.dll" \) -exec \
|
||||
ntldd -R {} + | \
|
||||
grep "mingw64" | \
|
||||
cut -f1 -d "=" | sort | uniq`
|
||||
for a in $list; do
|
||||
cp -fv "/mingw64/bin/$a" "$DIST_DIR/bin/"
|
||||
cp -fv "/mingw64/bin/$a" "$_dist_arg/bin/"
|
||||
done
|
||||
|
||||
msg "Removing debug information from all EXE and DLL files"
|
||||
find "$DIST_DIR" -iname "*.exe" -exec strip -s {} +
|
||||
find "$DIST_DIR" -iname "*.dll" -exec strip -s {} +
|
||||
find "$_dist_arg" -iname "*.exe" -exec strip -s {} +
|
||||
find "$_dist_arg" -iname "*.dll" -exec strip -s {} +
|
||||
|
||||
find "$DIST_DIR" -iname "*.a" -exec rm {} +
|
||||
find "$_dist_arg" -iname "*.a" -exec rm {} +
|
||||
|
||||
msg "Removing redudant header files"
|
||||
rm -rf "$DIST_DIR/include"
|
||||
rm -rf "$_dist_arg/include"
|
||||
|
||||
msg "Copy LICENSE"
|
||||
cp -f "$PWD/LICENSE" "$DIST_DIR/LICENSE"
|
||||
cp -f "$PWD/LICENSE" "$_dist_arg/LICENSE"
|
||||
|
||||
msg "Copy icons, themes, locales and fonts"
|
||||
cp -f "$PWD/main/dino.ico" "$DIST_DIR/dino.ico"
|
||||
cp -rf "/mingw64/share/xml" "$DIST_DIR/share"
|
||||
mkdir -p "$DIST_DIR/etc/fonts" && cp -r /mingw64/etc/fonts "$DIST_DIR/etc/"
|
||||
mkdir -p "$DIST_DIR/share/icons" && cp -r /mingw64/share/icons "$DIST_DIR/share/"
|
||||
mkdir -p "$DIST_DIR/share/glib-2.0/schemas" && cp -rf /mingw64/share/glib-2.0/schemas "$DIST_DIR/share/glib-2.0/"
|
||||
cp -f "$PWD/main/dino.ico" "$_dist_arg/dino.ico"
|
||||
cp -rf "/mingw64/share/xml" "$_dist_arg/share"
|
||||
mkdir -p "$_dist_arg/etc/fonts" && cp -r /mingw64/etc/fonts "$_dist_arg/etc/"
|
||||
mkdir -p "$_dist_arg/share/icons" && cp -r /mingw64/share/icons "$_dist_arg/share/"
|
||||
mkdir -p "$_dist_arg/share/glib-2.0/schemas" && cp -rf /mingw64/share/glib-2.0/schemas "$_dist_arg/share/glib-2.0/"
|
||||
|
||||
msg "Successfully installed!"
|
||||
}
|
||||
|
@ -156,24 +184,68 @@ build_installer()
|
|||
|
||||
clean()
|
||||
{
|
||||
rm -rf build "$DIST_DIR"
|
||||
rm -rf $BUILD_DIR $DIST_DIR
|
||||
msg "Build artifacts removed successfull!"
|
||||
}
|
||||
|
||||
help()
|
||||
{
|
||||
cat << EOF
|
||||
usage: $0 [OPTION]
|
||||
--prepare install build dependencies
|
||||
--configure configure the project
|
||||
--build build the project
|
||||
--dist-install install the builded project
|
||||
--build-installer build installer (using NSIS)
|
||||
--clean remove build artifacts
|
||||
--help show this help
|
||||
cat << EOF
|
||||
Script to build Dino for windows using cmake or meson build-system.
|
||||
By default it will be build using build directory
|
||||
$BUILD_DIR
|
||||
and installed to
|
||||
$DIST_DIR
|
||||
|
||||
Running without parameters is equivalent to running:
|
||||
'--configure', '--build' and '--dist-install'
|
||||
Usage: $0 [option]
|
||||
|
||||
Note: you may set the multiple options, but be surem that they will be
|
||||
processed sequentially (one-by-one), e.g. command
|
||||
$0 -s meson -c -b
|
||||
will run buld config and _after_ that run build using meson, while
|
||||
$0 -c -b -s meson
|
||||
will run cmake-based configure & build commands and the -s option
|
||||
wont have any effect. And the one
|
||||
$0 -b -s meson -c
|
||||
is incorrect, as it willtry to run build(for cmake), then configure
|
||||
with for meson build.
|
||||
|
||||
--help, -h
|
||||
print this help message.
|
||||
|
||||
--set-buildsys, -s
|
||||
set (specify) build system name to be used
|
||||
possible options are: cmake or meson
|
||||
|
||||
--prepare, -p
|
||||
install build dependencies. may be done once.
|
||||
|
||||
--configure, -c
|
||||
configure build using selected build-system.
|
||||
|
||||
--build, -b
|
||||
invoked build.
|
||||
|
||||
--reconfig, -r
|
||||
reconfigure project, if minor changes were
|
||||
done to build config files but build has been
|
||||
configured already (only for meson!).
|
||||
|
||||
--whipe, -w
|
||||
remove build artifacts from $BUILD_DIR
|
||||
|
||||
--verbose, -v
|
||||
verbose output enable.
|
||||
|
||||
--dist-install, -i
|
||||
install the builded project along with its'
|
||||
dependencies.
|
||||
|
||||
--build-installer
|
||||
build installer (using NSIS)
|
||||
|
||||
Running without parameters will run configure, build & install
|
||||
using cmake-based build-system as default one.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -181,18 +253,58 @@ if [[ "$(uname)" != "MINGW64_NT"* ]]; then
|
|||
fatal "This is not a MINGW64 environment!"
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"--prepare" ) prepare ;;
|
||||
"--configure" ) configure ;;
|
||||
"--build" ) build ;;
|
||||
"--dist-install" ) dist_install ;;
|
||||
"--build-installer") build_installer ;;
|
||||
"--clean" ) clean ;;
|
||||
"--help" ) help ;;
|
||||
"" )
|
||||
configure
|
||||
build
|
||||
dist_install
|
||||
;;
|
||||
*) fatal "Unknown argument!"
|
||||
esac
|
||||
# no options provided,simply build with defaults
|
||||
if [[ $# == 0 ]]; then
|
||||
prepare
|
||||
configure_${build_sys}
|
||||
build_${build_sys}
|
||||
dist_install
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [[ $# > 0 ]];
|
||||
do
|
||||
case $1 in
|
||||
--prepare|-p)
|
||||
prepare
|
||||
;;
|
||||
--configure|-c)
|
||||
configure_${build_sys}
|
||||
;;
|
||||
--build|-b)
|
||||
build_${build_sys}
|
||||
;;
|
||||
--reconfig|-r)
|
||||
configure_${build_sys} reconfig
|
||||
;;
|
||||
--whipe|-w)
|
||||
clean
|
||||
;;
|
||||
--dist-install|-i)
|
||||
dist_install
|
||||
;;
|
||||
--verbose|-v)
|
||||
set -xv
|
||||
;;
|
||||
--help|-h)
|
||||
help
|
||||
exit 0;
|
||||
;;
|
||||
--build-installer)
|
||||
build_installer
|
||||
;;
|
||||
--set-buildsys|-s)
|
||||
if [ x"$2" != x"cmake" -a x"$2" != x"meson" ]; then
|
||||
fatal "Improper build system selected: ${2}!"
|
||||
exit 1;
|
||||
fi
|
||||
build_sys=$2
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue