xref: /lighttpd1.4/scripts/ci-build.sh (revision 33fd0db9)
1#!/bin/sh
2# build script used by jenkins
3
4set -ex
5
6build="${1:-autobuild}" # build system: coverity, autobuild, cmake, scons, ...
7label="$2"              # label: {debian-{stable,testing},freebsd*}-{i386,amd64}
8compiler="${3:-gcc}"    # might want to overwrite a compiler
9# build=coverity:
10# - create "cov-int" directory for upload (gets `tar`d)
11# - access coverity binaries with export PATH="${COVERITY_PATH}"
12
13case "${build}" in
14"coverity")
15	mkdir -p m4
16	autoreconf --force --install
17	./configure \
18		--with-pic --enable-extra-warnings \
19		--with-dbi --with-mysql --with-pgsql \
20		--with-ldap --with-pcre2 \
21		--with-zlib --with-zstd --with-brotli --with-bzip2 \
22		--with-webdav-props --with-webdav-locks \
23		--with-lua --with-libunwind \
24		--with-krb5 \
25		--with-nettle \
26		--with-gnutls \
27		--with-mbedtls \
28		--with-nss \
29		--with-openssl \
30		--with-wolfssl
31	make clean
32	export PATH="${COVERITY_PATH}"
33	cov-build --dir "cov-int" make
34	;;
35"autobuild")
36	mkdir -p m4
37	autoreconf --force --install
38	./configure \
39		--with-pic --enable-extra-warnings \
40		--with-dbi --with-mysql --with-pgsql \
41		--with-ldap --with-pcre2 \
42		--with-zlib --with-zstd --with-brotli --with-bzip2 \
43		--with-webdav-props --with-webdav-locks \
44		--with-lua --with-libunwind \
45		--with-krb5 --with-sasl \
46		--with-nettle \
47		--with-gnutls \
48		--with-openssl
49	make -j 2
50	make check
51	;;
52"cmake"|"cmake-asan")
53	mkdir cmakebuild
54	cd cmakebuild
55	if [ "${build}" = "cmake-asan" ]; then
56		asan_opts="-DBUILD_SANITIZE_ADDRESS=ON -DBUILD_SANITIZE_UNDEFINED=ON"
57	else
58		asan_opts=""
59	fi
60	cmake \
61		-DBUILD_EXTRA_WARNINGS=ON \
62		${asan_opts} \
63		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
64		-DWITH_PCRE2=ON \
65		-DWITH_ZSTD=ON \
66		-DWITH_BROTLI=ON \
67		-DWITH_BZIP=ON \
68		-DWITH_LDAP=ON \
69		-DWITH_LIBUNWIND=ON \
70		-DWITH_LUA=ON \
71		-DWITH_DBI=ON \
72		-DWITH_MYSQL=ON \
73		-DWITH_PGSQL=ON \
74		-DWITH_GNUTLS=ON \
75		-DWITH_NETTLE=ON \
76		-DWITH_OPENSSL=ON \
77		-DWITH_WEBDAV_LOCKS=ON \
78		-DWITH_WEBDAV_PROPS=ON \
79		..
80	make -j 2
81	ctest -V
82	;;
83"scons")
84	case "${label}" in
85	debian*)
86		# static linking needs some extra stuff on debian
87		export LDFLAGS="-pthread"
88		export LIBS="-ldl"
89		;;
90	esac
91	# scons -j 2 with_pcre2=yes with_zlib=yes with_brotli=yes with_openssl=yes -k check_fullstatic
92	# scons -j 2 with_pcre2=yes with_zlib=yes with_brotli=yes with_openssl=yes -k check_static check_dynamic
93	scons -j 2 with_pcre2=yes with_zlib=yes with_brotli=yes with_openssl=yes -k check_fullstatic check_static check_dynamic
94	;;
95*)
96	echo >&2 "Unknown build system: ${build}"
97	exit 1
98	;;
99esac
100