Files
BMLFS/build-scripts/libunwind-llvm.build
2021-09-18 10:49:57 -05:00

67 lines
2.6 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /bin/bash
# libunwind-llvm
# Source: https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/libunwind-12.0.0.src.tar.xz
# Source: https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/libcxx-12.0.0.src.tar.xz
# Source: https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/llvm-12.0.0.src.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: CMake
# 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 "
# libunwind from LLVM requires main mono LLVM source tree
# with libcxx extracted in projects directory.
tar xf pkgs/llvm-12.0.0.src.tar.xz && \
tar xf pkgs/libunwind-12.0.0.src.tar.xz && \
tar xf pkgs/libcxx-12.0.0.src.tar.xz && \
cd llvm-12.0.0.src && export LLVMSRC=$PWD && cd projects && \
mv -v ../../libunwind-12.0.0.src libunwind && \
mv -v ../../libcxx-12.0.0.src libcxx && \
cd libunwind && \
sed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' src/CMakeLists.txt &&
cmake -B BUILD \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_PATH=$LLVMSRC && \
read -p "Compile?" && make -C BUILD -j2 && \
sudo -S make DESTDIR=$BUILD -C BUILD install &&
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-llvm: llvm's libunwind
libunwind-llvm:
libunwind-llvm: libunwind is an implementation of the interface defined by the HP
libunwind-llvm: libunwind project. It was contributed by Apple as a way to enable
libunwind-llvm: clang++ to port to platforms that do not have a system unwinder. It
libunwind-llvm: is intended to be a small and fast implementation of the ABI, leaving
libunwind-llvm: off some features of HPs libunwind that never materialized (e.g.
libunwind-llvm: remote unwinding)
libunwind-llvm:
libunwind-llvm:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/libunwind-llvm-12.0.0-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*