[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Copyright 2007, 2008, 2012 Eric Hameleers, Eindhoven, NL |
---|
| 4 | # Copyright 2007-2008, 2013, 2014 Heinz Wiesinger, Amsterdam, NL |
---|
| 5 | # Copyright 2008, 2009, 2010, 2013, 2014, 2015 Patrick J. Volkerding, Sebeka, MN, USA |
---|
| 6 | # All rights reserved. |
---|
| 7 | # |
---|
| 8 | # Redistribution and use of this script, with or without modification, is |
---|
| 9 | # permitted provided that the following conditions are met: |
---|
| 10 | # |
---|
| 11 | # 1. Redistributions of this script must retain the above copyright |
---|
| 12 | # notice, this list of conditions and the following disclaimer. |
---|
| 13 | # |
---|
| 14 | # THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
| 15 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 16 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
| 17 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 18 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 19 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 20 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 21 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 22 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 23 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 24 | |
---|
| 25 | # bjam-build system mostly taken from SlackBuild by Eric Hameleers |
---|
| 26 | # Script modified by Robby Workman - no copyright claims or added terms |
---|
| 27 | # Modified 2012 by Eric Hameleers <alien at slackware.com> for ARM port. |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | PKGNAM=boost |
---|
| 31 | VERSION=${VERSION:-$(echo $PKGNAM_*.tar.?z* | rev | cut -f 3- -d . | rev | cut -f 2- -d _)} |
---|
| 32 | BUILD=${BUILD:-1} |
---|
| 33 | |
---|
| 34 | PKG_VERSION=$(echo $VERSION | tr _ .) # Leave this alone |
---|
| 35 | NUMJOBS=${NUMJOBS:-" -j7 "} |
---|
| 36 | |
---|
| 37 | # Automatically determine the architecture we're building on: |
---|
| 38 | MARCH=$( uname -m ) |
---|
| 39 | if [ -z "$ARCH" ]; then |
---|
| 40 | case "$MARCH" in |
---|
| 41 | i?86) export ARCH=i586 ;; |
---|
| 42 | armv7hl) export ARCH=$MARCH ;; |
---|
| 43 | arm*) export ARCH=arm ;; |
---|
| 44 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
| 45 | *) export ARCH=$MARCH ;; |
---|
| 46 | esac |
---|
| 47 | fi |
---|
| 48 | |
---|
| 49 | if [ "$ARCH" = "i586" ]; then |
---|
| 50 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
| 51 | LIBDIRSUFFIX="" |
---|
| 52 | elif [ "$ARCH" = "s390" ]; then |
---|
| 53 | SLKCFLAGS="-O2" |
---|
| 54 | LIBDIRSUFFIX="" |
---|
| 55 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 56 | SLKCFLAGS="-O2 -fPIC" |
---|
| 57 | LIBDIRSUFFIX="64" |
---|
| 58 | elif [ "$ARCH" = "armv7hl" ]; then |
---|
| 59 | SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16" |
---|
| 60 | LIBDIRSUFFIX="" |
---|
| 61 | else |
---|
| 62 | SLKCFLAGS="-O2" |
---|
| 63 | LIBDIRSUFFIX="" |
---|
| 64 | fi |
---|
| 65 | |
---|
| 66 | CWD=$(pwd) |
---|
| 67 | TMP=${TMP:-/tmp} |
---|
| 68 | PKG=$TMP/package-boost |
---|
| 69 | |
---|
| 70 | rm -rf $PKG |
---|
| 71 | mkdir -p $TMP $PKG |
---|
| 72 | cd $TMP |
---|
| 73 | rm -rf boost_$VERSION |
---|
| 74 | tar xvf $CWD/boost_$VERSION.tar.?z* || exit 1 |
---|
| 75 | cd boost_$VERSION || exit 1 |
---|
| 76 | |
---|
| 77 | chown -R root:root . |
---|
| 78 | find . \ |
---|
| 79 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
| 80 | -exec chmod 755 {} \; -o \ |
---|
| 81 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
| 82 | -exec chmod 644 {} \; |
---|
| 83 | |
---|
| 84 | # Don't allow MOC to process this incompatible header: |
---|
| 85 | sed -e '1 i#ifndef Q_MOC_RUN' \ |
---|
| 86 | -e '$ a#endif' \ |
---|
| 87 | -i boost/type_traits/detail/has_binary_operator.hpp |
---|
| 88 | |
---|
| 89 | # This is the python we build against: |
---|
| 90 | PYTHON_VERSION=$(python -c 'import sys; print sys.version[:3]') |
---|
| 91 | PYTHON_FLAGS="-sPYTHON_ROOT=/usr -sPYTHON_VERSION=$PYTHON_VERSION" |
---|
| 92 | |
---|
| 93 | # First build bjam, the boost build system: |
---|
| 94 | cd tools/build/src/engine |
---|
| 95 | CFLAGS="$SLKCFLAGS -fno-strict-aliasing" CC=gcc ./build.sh cc |
---|
| 96 | cd - |
---|
| 97 | |
---|
| 98 | BJAM=$(find tools/build/src/engine/ -name b2 -a -type f) |
---|
| 99 | |
---|
| 100 | # Create build subdirectory |
---|
| 101 | mkdir obj |
---|
| 102 | |
---|
| 103 | # Next, we build boost using bjam |
---|
| 104 | $BJAM \ |
---|
| 105 | release \ |
---|
| 106 | $NUMJOBS \ |
---|
| 107 | "-sNO_COMPRESSION=0" \ |
---|
| 108 | "-sZLIB_INCLUDE=/usr/include" \ |
---|
| 109 | "-sZLIB_LIBPATH=/usr/lib${LIBDIRSUFFIX}" \ |
---|
| 110 | "-sBZIP2_INCLUDE=/usr/include" \ |
---|
| 111 | "-sBZIP2_LIBPATH=/usr/lib${LIBDIRSUFFIX}" \ |
---|
| 112 | "-sEXPAT_INCLUDE=/usr/include" \ |
---|
| 113 | "-sEXPAT_LIBPATH=/usr/lib${LIBDIRSUFFIX}" \ |
---|
| 114 | --layout=system \ |
---|
| 115 | --builddir=obj \ |
---|
| 116 | --prefix=/usr \ |
---|
| 117 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
| 118 | --build-type=minimal \ |
---|
| 119 | toolset=gcc \ |
---|
| 120 | variant=release \ |
---|
| 121 | link=shared \ |
---|
| 122 | threading=multi \ |
---|
| 123 | runtime-link=shared \ |
---|
| 124 | cflags="$SLKCFLAGS" \ |
---|
| 125 | cxxflags="$SLKCFLAGS $EXTRA_CXXFLAGS" \ |
---|
| 126 | $PYTHON_FLAGS \ |
---|
| 127 | stage || exit 1 |
---|
| 128 | |
---|
| 129 | # And then install boost.. |
---|
| 130 | mkdir -p $PKG/usr/{lib$LIBDIRSUFFIX,include} |
---|
| 131 | |
---|
| 132 | $BJAM \ |
---|
| 133 | release \ |
---|
| 134 | "-sEXPAT_INCLUDE=/usr/include" \ |
---|
| 135 | "-sEXPAT_LIBPATH=/usr/lib${LIBDIRSUFFIX}" \ |
---|
| 136 | --layout=system \ |
---|
| 137 | --builddir=obj \ |
---|
| 138 | --prefix=$PKG/usr \ |
---|
| 139 | --libdir=$PKG/usr/lib${LIBDIRSUFFIX} \ |
---|
| 140 | --build-type=minimal \ |
---|
| 141 | toolset=gcc \ |
---|
| 142 | variant=release \ |
---|
| 143 | link=shared \ |
---|
| 144 | threading=multi \ |
---|
| 145 | runtime-link=shared \ |
---|
| 146 | cflags="$SLKCFLAGS" \ |
---|
| 147 | cxxflags="$SLKCFLAGS $EXTRA_CXXFLAGS" \ |
---|
| 148 | $PYTHON_FLAGS \ |
---|
| 149 | install || exit 1 |
---|
| 150 | |
---|
| 151 | find $PKG | xargs file | grep -e "executable" -e "shared object" \ |
---|
| 152 | | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
---|
| 153 | |
---|
| 154 | mkdir -p $PKG/usr/doc/boost-$PKG_VERSION |
---|
| 155 | # Do not copy 44MB of developer 'doc/html' into our package... |
---|
| 156 | cp -a LICENSE* index.html $PKG/usr/doc/boost-$PKG_VERSION |
---|
| 157 | find $PKG/usr/doc -type f -exec chmod 0644 {} \; |
---|
| 158 | |
---|
| 159 | mkdir -p $PKG/install |
---|
| 160 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 161 | |
---|
| 162 | cd $PKG |
---|
| 163 | /sbin/makepkg -l y -c n /tmp/boost-$PKG_VERSION-$ARCH-$BUILD.txz |
---|
| 164 | |
---|