#!/bin/bash ulimit -s unlimited shopt -s extglob # boost.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter for Slackware ARM. # # Copyright 2007, 2008, 2012 Eric Hameleers, Eindhoven, NL # Copyright 2007-2008, 2013, 2014, 2017 Heinz Wiesinger, Amsterdam, NL # Copyright 2008, 2009, 2010, 2013, 2014, 2015, 2017 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # bjam-build system mostly taken from SlackBuild by Eric Hameleers # Script modified by Robby Workman - no copyright claims or added terms # Modified 2012 by Eric Hameleers for ARM port. ICU=${ICU:-no} # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: slackset_var_cwds # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD PYTHON_VERSION=$(python2 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))') PYTHON3_VERSION=$(python3 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))') # Determine the CFLAGS for the known architectures: case $ARCH in arm) export SLKARMFLAGS="--disable-long-double" ;; esac # Extract source: echo "Extracting source.." tar xf $CWD/boost_*.tar.!(*sign|*asc|*sig) #tar xvvf $PORTCWD/sources/boost_$VERSION.tar.!(*sign|*asc|*sig) cd boost*/ || exit 1 slackhousekeeping # Apply patches: echo "************** PYTHON 2: Building bjam *********************" # First build bjam, the boost build system: #cd tools/build/src/engine # CFLAGS="$SLKCFLAGS -fno-strict-aliasing" CC=gcc ./build.sh cc #cd - ./bootstrap.sh \ --with-toolset=gcc \ --with-icu \ --with-python=/usr/bin/python2 || failconfig echo "************** PYTHON 2: Building boost (using bjam) *********************" ./b2 \ $NUMJOBS \ --layout=system \ --build-dir=build-python2 \ --prefix=/usr \ --libdir=/usr/lib$LIBDIRSUFFIX \ --build-type=minimal \ toolset=gcc \ variant=release \ debug-symbols=off \ link=shared \ threading=multi \ runtime-link=shared \ python=$PYTHON_VERSION \ cflags="$SLKCFLAGS" \ cxxflags="$SLKCFLAGS $EXTRA_CXXFLAGS" \ stage # skip failure on ARM - we fail to update 1 target || failmake echo "************** PYTHON 2: Installing Boost *********************" ./b2 \ $NUMJOBS \ --layout=system \ --build-dir=build-python2 \ --prefix=$PKG/usr \ --libdir=$PKG/usr/lib$LIBDIRSUFFIX \ --build-type=minimal \ toolset=gcc \ variant=release \ debug-symbols=off \ link=shared \ threading=multi \ runtime-link=shared \ python=$PYTHON_VERSION \ cflags="$SLKCFLAGS" \ cxxflags="$SLKCFLAGS $EXTRA_CXXFLAGS" \ install ## || failinstall # skip failure - on ARM we fail on 1 target but update thousands of others. echo "************** PYTHON 3: Building bjam *********************" #### Python3: # one more run to build libboost_python3.. sed -e '/using python/ s@;@: /usr/include/python${PYTHON_VERSION/3*/${PYTHON_VERSION}} ;@' \ -i bootstrap.sh ./bootstrap.sh \ --with-toolset=gcc \ --with-icu \ --with-python=/usr/bin/python3 \ --with-libraries=python || failconfig echo "************** PYTHON 3: Building boost (using bjam) *********************" ./b2 \ $NUMJOBS \ --layout=system \ --build-dir=build-python3 \ --prefix=/usr \ --libdir=/usr/lib$LIBDIRSUFFIX \ --build-type=minimal \ toolset=gcc \ variant=release \ debug-symbols=off \ link=shared \ threading=multi \ runtime-link=shared \ python=$PYTHON3_VERSION \ cflags="$SLKCFLAGS" \ cxxflags="$SLKCFLAGS $EXTRA_CXXFLAGS" \ stage # | failmake echo "************** PYTHON 3: Installing Boost *********************" ./b2 \ $NUMJOBS \ --layout=system \ --build-dir=build-python3 \ --prefix=$PKG/usr \ --libdir=$PKG/usr/lib$LIBDIRSUFFIX \ --build-type=minimal \ toolset=gcc \ variant=release \ debug-symbols=off \ link=shared \ threading=multi \ runtime-link=shared \ python=$PYTHON3_VERSION \ cflags="$SLKCFLAGS" \ cxxflags="$SLKCFLAGS $EXTRA_CXXFLAGS" \ install ## || failmake # Copy documentation: mkdir -p $PKG/usr/doc/$PKGNAM-$PKG_VERSION # Do not copy 44MB of developer 'doc/html' into our package... cp -fav \ LICENSE* index.html \ $PKG/usr/doc/$PKGNAM-$PKG_VERSION # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slack_delete_lafiles # delete usr/lib{,64}/*.la slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh export VERSION="$( echo $VERSION | sed 's?_?.?g' )" export SLACKPACKAGE=$PKGNAM-$VERSION-$PKGARCH-$BUILD.txz slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links