| 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 | |
| 10 | case "${BUILDARCH}" in |
| 11 | armv6l|armv7l) ;; |
| 12 | *) exit 0 ;; |
| 13 | esac |
| 14 | |
| 15 | # shellcheck disable=SC2015 |
| 16 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Building libucontext" || true |
| 17 | |
| 18 | export CFLAGS="${TUNING_FLAGS} -pipe" |
| 19 | export CXXFLAGS="${CFLAGS}" |
| 20 | export LDFLAGS="" |
| 21 | |
| 22 | cache_key="libucontext" |
| 23 | build_dir="${LIBUCONTEXT_VERSION}" |
| 24 | |
| 25 | fetch_git "${build_dir}" "${LIBUCONTEXT_SOURCE}" "${LIBUCONTEXT_VERSION}" "${cache_key}" |
| 26 | |
| 27 | case "${BUILDARCH}" in |
| 28 | armv6l|armv7l) arch=arm ;; |
| 29 | *) arch="${BUILDARCH}" ;; |
| 30 | esac |
| 31 | |
| 32 | if [ "${CACHE_HIT:-0}" -eq 0 ]; then |
| 33 | run make ARCH="${arch}" EXPORT_UNPREFIXED="yes" -j "$(nproc)" |
| 34 | fi |
| 35 | |
| 36 | run make ARCH="${arch}" EXPORT_UNPREFIXED="yes" DESTDIR="/libucontext-static" -j "$(nproc)" install |
| 37 | |
| 38 | store_cache "${cache_key}" "${build_dir}" |
| 39 | |
| 40 | # shellcheck disable=SC2015 |
| 41 | [ "${GITHUB_ACTIONS}" = "true" ] && echo "::endgroup::" || true |