Enable and fix many extra warnings supported by GCC and Clang.
[tinc] / .ci / package / rpm / build.sh
1 #!/bin/bash
2
3 set -euo pipefail
4
5 find_tag() {
6   git describe --always --tags --match='release-*' "$@"
7 }
8
9 # CentOS 7 has OpenSSL 1.1 installed in a non-default location.
10 if [ -d /usr/include/openssl11 ]; then
11   set -- "$@" --with-openssl-include=/usr/include/openssl11
12 fi
13
14 if [ -d /usr/lib64/openssl11 ]; then
15   set -- "$@" --with-openssl-lib=/usr/lib64/openssl11
16 fi
17
18 spec=$HOME/rpmbuild/SPECS/tinc.spec
19 configure=$(sh .ci/conf.sh)
20
21 version=$(find_tag HEAD | sed 's/-/_/g')
22 version=${version//release_/}
23
24 export CONFIG_SHELL=bash
25
26 yum install -y rpmdevtools
27 rpmdev-setuptree
28
29 cp "$(dirname "$0")/tinc.spec" "$spec"
30 sed -i "s/__VERSION__/$version/" "$spec"
31 sed -i "s#__CONFIGURE_ARGS__#$configure#" "$spec"
32
33 git clean -dfx
34 autoreconf -fsi
35 cp -a . ~/rpmbuild/BUILD
36
37 rpmbuild -bb "$spec"