mirror of
https://github.com/labwc/labwc.git
synced 2025-11-10 13:30:00 -05:00
tools/build: add some options
This commit is contained in:
parent
759b8e2757
commit
c85c51c077
2 changed files with 51 additions and 11 deletions
|
|
@ -1,3 +1,3 @@
|
|||
leak:libfontconfig
|
||||
leak:libglib-2.0
|
||||
|
||||
leak:libxcb*
|
||||
|
|
|
|||
60
tools/build
60
tools/build
|
|
@ -3,17 +3,57 @@
|
|||
# Automatically build labwc
|
||||
#
|
||||
|
||||
builddir=build-clang
|
||||
builddir=build
|
||||
g_asan=
|
||||
g_wlroots=
|
||||
|
||||
if ! [ -e subprojects/wlroots ]; then
|
||||
git clone https://github.com/swaywm/wlroots subprojects/wlroots
|
||||
fi
|
||||
die () { printf '\033[31mfatal:\033[m %b\n' "$@" >&2 ; exit 1 ; }
|
||||
warn () { printf '\033[31mwarn:\033[m %b\n' "$@" >&2 ; }
|
||||
say () { printf '\033[32m%s\033[m' "$@" ; }
|
||||
|
||||
usage () {
|
||||
printf "%s\n" \
|
||||
"Usage: ./tools/build [<options>]
|
||||
Options:
|
||||
-w install wlroots as subproject
|
||||
--asan run with ASAN and UBSAN
|
||||
--clang run with clang
|
||||
-h, --help show help"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ! [ -e ${builddir} ]; then
|
||||
CC=clang meson -Dwlroots:default_library=static ${builddir}
|
||||
# To enable ASAN and UBSAN, run meson with
|
||||
# `-Db_sanitize=address,undefined`
|
||||
fi
|
||||
wlroots_subproject () {
|
||||
if ! [ -e subprojects/wlroots ]; then
|
||||
git clone https://github.com/swaywm/wlroots subprojects/wlroots
|
||||
fi
|
||||
}
|
||||
|
||||
ninja -C ${builddir}
|
||||
main () {
|
||||
[[ -e src/main.c ]] || die "must be run from top-level directory"
|
||||
|
||||
for arg
|
||||
do
|
||||
opt=${arg%%=*}
|
||||
var=${arg#*=}
|
||||
case "$opt" in
|
||||
-w)
|
||||
wlroots_subproject
|
||||
g_wlroots="-Dwlroots:default_library=static"
|
||||
;;
|
||||
--asan)
|
||||
g_asan="-Db_sanitize=address,undefined" ;;
|
||||
--clang)
|
||||
export CC=clang
|
||||
;;
|
||||
-h|--help)
|
||||
usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -e ${builddir} ] && die "build directory already exists - delete and run again"
|
||||
meson ${g_asan} ${g_wlroots} ${builddir}
|
||||
ninja -C ${builddir}
|
||||
LSAN_OPTIONS=suppressions=../tools/asan_suppressions.txt ninja -C ${builddir} test
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue