master
sh 48 lines 1.33 KB
Raw
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: GPL-3.0-or-later
3
4 # shellcheck source=packaging/makeself/functions.sh
5 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6 # Source of truth for all the packages we bundle in static builds
7 . "$(dirname "${0}")/../bundled-packages.version"
8
9 case "${BUILDARCH}" in
10 armv6l|armv7l) ;;
11 *) exit 0 ;;
12 esac
13
14 # shellcheck disable=SC2015
15 [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building libunwind" || true
16
17 export CFLAGS="${TUNING_FLAGS} -I/libucontext-static/usr/include -fno-lto -pipe"
18 export CXXFLAGS="${CFLAGS}"
19 export LDFLAGS="-static -L/libucontext-static/usr/lib/ -lucontext"
20 export PKG_CONFIG="pkg-config --static"
21
22 cache_key="libunwind"
23 build_dir="libunwind-${LIBUNWIND_VERSION}"
24
25 fetch_git "${build_dir}" "${LIBUNWIND_SOURCE}" "${LIBUNWIND_VERSION}" "${cache_key}" fetch-via-checkout
26
27 if [ "${CACHE_HIT:-0}" -eq 0 ]; then
28 run autoreconf -ivf
29
30 run ./configure \
31 --prefix=/libunwind-static \
32 --build="$(gcc -dumpmachine)" \
33 --disable-cxx-exceptions \
34 --disable-documentation \
35 --disable-tests \
36 --disable-shared \
37 --enable-static \
38 --disable-dependency-tracking
39
40 run make -j "$(nproc)"
41 fi
42
43 run make -j "$(nproc)" install
44
45 store_cache "${cache_key}" "${build_dir}"
46
47 # shellcheck disable=SC2015
48 [ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true