Files
BMLFS/build-scripts/libunwind.build
2021-09-18 11:01:14 -05:00

62 lines
2.3 KiB
Bash

#! /bin/bash
# libunwind
# Source: http://download.savannah.nongnu.org/releases/libunwind/libunwind-1.5.0.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: libucontext
# Recommended: NONE
# Optional: NONE
# if optimizing with GCC:
export CFLAGS="-march=native -pipe "
export CFLAGS+="-O3 -ffat-lto-objects -flto=4 "
export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed "
case $(uname -m) in
aarch64) patch -Np1 -i ../patches/libunwind-void/aarch64-musl.patch ;;
esac &&
export CFLAGS+="-fcommon" &&
case $(uname -m) in
i686) export LDFLAGS+=" -lssp_nonshared"
sed -i src/unwind/libunwind.pc.in -e \
's/\-lunwind/\-lunwind \-lucontext/'
;;
esac &&
sed -i '/SUBDIRS/s/tests//' Makefile.am &&
sed -i '/libdir/s/lib64/lib/' configure.ac &&
autoreconf -fiv &&
./configure --prefix=/usr $BUILDTRUPLE &&
read -p "Compile?" && make -j2 &&
sudo -S make DESTDIR=$BUILD install &&
unset CFLAGS &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
libunwind: libunwind (API to determine the call-chain of a program)
libunwind:
libunwind: The primary goal of libunwind is to define a portable and efficient C
libunwind: programming interface (API) to determine the call-chain of a program.
libunwind: The API additionally provides the means to manipulate the preserved
libunwind: (callee-saved) state of each call-frame and to resume execution at
libunwind: any point in the call-chain (non-local goto). Some uses for this API
libunwind: include exception handling, debuggers, introspection, or implementing
libunwind: an extremely efficient version of setjmp().
libunwind:
libunwind: Homepage: http://www.nongnu.org/libunwind
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/libunwind-1.5.0-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*