-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathsbuild.sh
More file actions
executable file
·49 lines (42 loc) · 1.64 KB
/
Copy pathsbuild.sh
File metadata and controls
executable file
·49 lines (42 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020-2023 UnionTech Software Technology Co.,Ltd.
# Requires: YSLib sysroot from up-to-date 3rdparty, having bin in $PATH.
# Usage: sbuild.sh CONF [SHBOPT_BASE ...].
# See https://frankhb.github.io/YSLib-book/Tools/Scripts.zh-CN.html.
set -e
Unilang_BaseDir="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)"
test -n "$1" \
|| (echo "ERROR: The configuration name should not be empty." >& 2; exit 1)
. "$Unilang_BaseDir/detect-llvm.sh"
CXXFLAGS_Qt="$(pkg-config --cflags Qt5Widgets Qt5Quick)"
LIBS_Qt="$(pkg-config --libs Qt5Widgets Qt5Quick)"
case $(uname) in
*MINGW64*)
# XXX: Workaround for MinGW64 G++ + ld with ASLR enabled by default. Clang++
# + ld or G++ + lld do need the flag, but leaving it here as-is.
# See https://www.msys2.org/news/#2021-01-31-aslr-enabled-by-default,
# https://github.com/msys2/MINGW-packages/issues/6986,
# https://github.com/msys2/MINGW-packages/issues/7023,
# and https://sourceware.org/bugzilla/show_bug.cgi?id=26659.
LDFLAGS_LOWBASE_=-Wl,--default-image-base-low
;;
esac
case $(uname) in
*MSYS* | *MINGW*)
LIBS_EXTRA="$LIBS_Qt $LIBS_EXTRA"
;;
*)
if echo "$CXX" | grep -q clang; then
# XXX: Workaround for old versions of Clang++ not recognizing
# '-fno-semantic-interposition'.
export C_CXXFLAGS_PIC=-fPIC
fi
LIBS_EXTRA="$LIBS_Qt $LIBS_EXTRA -ldl"
esac
mkdir -p "$Unilang_BaseDir/build"
(cd "$Unilang_BaseDir/build" && SHBuild_NoAdjustSubsystem=true \
SHBuild_CXXFLAGS="$CXXFLAGS_EXTRA" SHBuild_LDFLAGS="$LDFLAGS_LOWBASE_" \
SHBuild_LIBS="$LIBS_EXTRA" SHBuild-BuildPkg.sh "$@" \
-xn,unilang "$Unilang_BaseDir/src" -I\""$Unilang_BaseDir/include"\" \
"$CXXFLAGS_Qt")
echo "Done."