Files
BMLFS/build-scripts/boost.build

116 lines
4.3 KiB
Bash

#! /bin/bash
# Boost
# Source: https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2
# Source: https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: Which
# Optional: ICU, Open MPI
# LTO: Tested with LLVM
# Setup build environment
export CXXFLAGS="-std=c++14"
case $(uname -m) in
x86_64*) export BARCH=x86 && export BABI=sysv
;;
i686*) export BARCH=x86 && export BABI=sysv
;;
aarch64*) export BARCH=arm && export BABI=aapcs
;;
arm*) export BARCH=arm && export BABI=aapcs
;;
esac
# Apply patches
patch -Np1 -i ../patches/boost-alpine/0001-revert-cease-dependence-on-range.patch
patch -Np1 -i ../patches/boost-alpine/boost-1.57.0-python-abi_letters.patch
patch -Np1 -i ../patches/boost-alpine/boost-1.57.0-python-libpython_dep.patch
patch -Np1 -i ../patches/boost-alpine/boost-phoenix-uarg.patch
# Apply patches if clang is used instead of gcc
patch -Np1 -i ../patches/boost-chimera/0001-revert-cease-dependence-on-range.patch
patch -Np1 -i ../patches/boost-chimera/boost-1.57.0-python-abi_letters.patch
patch -Np1 -i ../patches/boost-chimera/boost-1.57.0-python-libpython_dep.patch
patch -Np1 -i ../patches/boost-chimera/fix-x86-build.patch
patch -Np1 -i ../patches/boost-chimera/install-strip-destdir.patch
patch -Np1 -i ../patches/boost-chimera/toolset-default-clang.patch
# If not using pkgtools or any package manager, set $BUILD=""
# Bootstap source
./bootstrap.sh --prefix=${BUILD}/usr --with-python=/usr/bin/python3 --with-python-root=/usr &&
# Rebuild bjam for target
cd tools/build/src/engine &&
./build.sh gcc &&
cd ../../../.. &&
cat > user-config.jam << "EOF"
using gcc : : g++ : <cxxflags>"-std=c++14" <linkflags>"" ;
using python : 3.9 : /usr/bin/python3 : /usr/include/python3.9 : /usr/lib/python3.9 ;
EOF
# Build
./b2 -j4 --user-config=./user-config.jam --debug-building \
--toolset=gcc abi=${BABI} architecture=${BARCH} python=3.9 \
threading=multi runtime-link=shared link=shared,static &&
# Install bjam & b2
sudo -S mkdir -pv ${BUILD}/usr/bin &&
sudo -S cp -v tools/build/src/engine/{bjam,b2} ${BUILD}/usr/bin &&
# Install headers & libraries
sudo -S ./b2 --prefix=${BUILD}/usr abi=${BABI} architecture=${BARCH} \
--user-config=./user-config.jam --no-cmake-config \
python=3.9 threading=multi runtime-link=shared \
link=shared,static install
# Install Boost.Build
sudo -S mkdir -pv ${BUILD}/usr/share/boost-build &&
cd ./tools/build && sudo -S cp -av . ${BUILD}/usr/share/boost-build/ &&
sudo -S find ${BUILD}/usr/share/boost-build -type f -name \*.orig -exec rm -f {} \; &&
sudo -S rm -rvf ${BUILD}/usr/share/boost-build/src/engine/bootstrap &&
sudo -S rm -rvf ${BUILD}/usr/share/boost-build/src/engine/{b2,bjam} &&
cat > /tmp/site-config.jam << "EOF"
# System wide configuration file for Boost.Build.
using gcc ;
EOF
sudo -S mkdir -pv ${BUILD}/etc
sudo -S mv -v /tmp/site-config.jam ${BUILD}/etc/
# Clean up
unset CXXFLAGS BARCH BABI
# Skip the rest if not using pkgtools or any other similar package manager
cd $BUILD && sudo -S mkdir -v 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 ':'.
|-----handy-ruler------------------------------------------------------|
boost: boost (Boost C++ Libraries)
boost:
boost: Boost provides free peer-reviewed portable C++ source libraries.
boost: The emphasis is on libraries that work well with the C++ Standard
boost: Library. One goal is to establish "existing practice" and provide
boost: reference implementations so that the Boost libraries are suitable
boost: for eventual standardization.
boost:
boost: Homepage: http://www.boost.org/
boost:
boost:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/boost-1.80.1-$(uname -m)-mlfs.txz &&
sudo -S rm -rf $BUILD/*