6 if [[ "x$xType" != "xdebug" ]] && [[ "x$xType" != "xrelease" ]]; then
7 echo "Usage: $0 <version> <debug|release> [additional configure options]"
13 minVers=${xVersion:0:3}
15 if [[ ! $minVers =~ [0-9]{3} ]]; then
16 echo "The version must be like \"nnn[.n[n]]\""
20 PREFIX=/tmp/elogind_test
21 if [[ $UID -eq 0 ]]; then
31 if [[ "x$xType" = "xdebug" ]]; then
32 my_CFLAGS="-Og -g3 -ggdb -ftrapv ${my_CFLAGS} -fPIE"
33 LDFLAGS="${my_LDFLAGS} -fPIE"
35 my_CFLAGS="-O2 -fwrapv ${my_CFLAGS}"
38 if [[ $minVers -gt 234 ]]; then
39 # After 234 the new meson+ninja build system is used:
41 debug_opt="-Ddebug=\"\" --buildtype release"
42 if [[ "x$xType" = "xdebug" ]]; then
43 debug_opt="-Ddebug=elogind -Dtests=unsafe --buildtype debug"
50 cgdefault="$(grep "^rc_cgroup_mode" /etc/rc.conf | cut -d '"' -f 2)"
55 if [[ "x$extra_opts" != "x" ]]; then
56 echo -n "Configure ? [y/N] (cg $cgdefault) [$extra_opts]"
58 echo -n "Configure ? [y/N] (cg $cgdefault) "
62 if [[ "x$answer" != "xy" ]]; then
68 CFLAGS="-march=native -pipe ${my_CFLAGS} -Wall -Wextra -Wunused -Wno-unused-parameter -Wno-unused-result -ftree-vectorize" \
69 LDFLAGS="${my_LDFLAGS}" \
70 meson $debug_opt --prefix $PREFIX/usr -Drootprefix=$PREFIX \
71 --wrap-mode nodownload --libdir lib64 \
72 --localstatedir $PREFIX/var/lib --sysconfdir $PREFIX/etc \
73 -Ddocdir=$PREFIX/usr/share/doc/elogind-9999 \
74 -Dhtmldir=$PREFIX/usr/share/doc/elogind-9999/html \
75 -Dpamlibdir=$PREFIX/lib64/security \
76 -Dudevrulesdir=$PREFIX/lib/udev/rules.d \
77 --libdir=$PREFIX/usr/lib64 -Drootlibdir=$PREFIX/lib64 \
78 -Drootlibexecdir=$PREFIX/lib64/elogind \
79 -Dsmack=true -Dman=auto -Dhtml=auto \
80 -Dcgroup-controller=openrc -Ddefault-hierarchy=$cgdefault \
81 -Dacl=true -Dpam=true -Dselinux=false \
82 -Dbashcompletiondir=$PREFIX/usr/share/bash-completion/completions \
83 -Dzshcompletiondir=$PREFIX/usr/share/zsh/site-functions \
84 $extra_opts $(pwd -P) $(pwd -P)/build
87 echo -n "Build and install ? [y/N] "
90 if [[ "x$answer" = "xy" ]]; then
92 ninja -C build && ninja -C build install
96 # Up to 233 the old autotools build system is used
98 debug_opt="--disable-debug"
99 if [[ "x$xType" = "xdebug" ]]; then
100 # debug_opt="--enable-debug=elogind --enable-address-sanitizer --enable-undefined-sanitizer --enable-coverage"
101 debug_opt="--enable-debug=elogind --enable-address-sanitizer --enable-undefined-sanitizer"
102 # debug_opt="--enable-debug=elogind --enable-undefined-sanitizer --enable-coverage"
103 # debug_opt="--enable-debug=elogind --enable-undefined-sanitizer"
109 intltoolize --automake --copy --force
110 libtoolize --install --copy --force --automake
114 automake --add-missing --copy --foreign --force-missing
118 if [[ "x$extra_opts" != "x" ]]; then
119 echo -n "Configure ? [y/N] [$extra_opts]"
121 echo -n "Configure ? [y/N] "
125 if [[ "x$answer" != "xy" ]]; then
130 CFLAGS="-march=native -pipe ${my_CFLAGS} -Wall -Wextra -Wunused -Wno-unused-parameter -Wno-unused-result -ftree-vectorize" \
131 LDFLAGS="${my_LDFLAGS}" \
132 ./configure --prefix=$PREFIX/usr --with-rootprefix=$PREFIX/ \
133 --with-bashcompletiondir=$PREFIX/usr/share/bash-completion/completions \
134 --enable-dependency-tracking --disable-silent-rules \
135 --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu \
136 --mandir=$PREFIX/usr/share/man --infodir=$PREFIX/usr/share/info \
137 --datadir=$PREFIX/usr/share --sysconfdir=$PREFIX/etc \
138 --localstatedir=$PREFIX/var/lib \
139 --docdir=$PREFIX/usr/share/doc/elogind-${xVersion} \
140 --htmldir=$PREFIX/usr/share/doc/elogind-${xVersion}/html \
141 --with-pamlibdir=$PREFIX/lib64/security \
142 --with-udevrulesdir=$PREFIX/lib/udev/rules.d \
143 --enable-smack --with-cgroup-controller=openrc \
144 --enable-acl --enable-pam --disable-selinux \
145 $debug_opt $extra_opts
148 echo -n "Build and install ? [y/N] "
151 if [[ "x$answer" = "xy" ]]; then
153 make update-man-list && \
155 make update-man-list && \