[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Copyright 2008, 2009, 2010, 2012 Patrick J. Volkerding, Sebeka, Minnesota, USA |
---|
| 4 | # All rights reserved. |
---|
| 5 | # |
---|
| 6 | # Redistribution and use of this script, with or without modification, is |
---|
| 7 | # permitted provided that the following conditions are met: |
---|
| 8 | # |
---|
| 9 | # 1. Redistributions of this script must retain the above copyright |
---|
| 10 | # notice, this list of conditions and the following disclaimer. |
---|
| 11 | # |
---|
| 12 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
| 13 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 14 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
| 15 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 16 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 17 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 18 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 19 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 20 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 21 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 22 | |
---|
| 23 | PKGNAM=db48 |
---|
| 24 | VERSION=4.8.30 |
---|
| 25 | BUILD=${BUILD:-2} |
---|
| 26 | |
---|
| 27 | NUMJOBS=${NUMJOBS:--j7} |
---|
| 28 | |
---|
| 29 | # Automatically determine the architecture we're building on: |
---|
| 30 | if [ -z "$ARCH" ]; then |
---|
| 31 | case "$( uname -m )" in |
---|
| 32 | i?86) export ARCH=i486 ;; |
---|
| 33 | arm*) export ARCH=arm ;; |
---|
| 34 | # Unless $ARCH is already set, use uname -m for all other archs: |
---|
| 35 | *) export ARCH=$( uname -m ) ;; |
---|
| 36 | esac |
---|
| 37 | fi |
---|
| 38 | |
---|
| 39 | CWD=$(pwd) |
---|
| 40 | TMP=${TMP:-/tmp} |
---|
| 41 | PKG=$TMP/package-$PKGNAM |
---|
| 42 | |
---|
| 43 | if [ "$ARCH" = "i486" ]; then |
---|
| 44 | SLKCFLAGS="-O2 -march=i486 -mtune=i686" |
---|
| 45 | LIBDIRSUFFIX="" |
---|
| 46 | elif [ "$ARCH" = "s390" ]; then |
---|
| 47 | SLKCFLAGS="-O2" |
---|
| 48 | LIBDIRSUFFIX="" |
---|
| 49 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 50 | SLKCFLAGS="-O2 -fPIC" |
---|
| 51 | LIBDIRSUFFIX="64" |
---|
| 52 | else |
---|
| 53 | SLKCFLAGS="-O2" |
---|
| 54 | LIBDIRSUFFIX="" |
---|
| 55 | fi |
---|
| 56 | |
---|
| 57 | rm -rf $PKG |
---|
| 58 | mkdir -p $TMP $PKG |
---|
| 59 | cd $TMP |
---|
| 60 | rm -rf db-$VERSION |
---|
| 61 | tar xvf $CWD/db-$VERSION.tar.xz |
---|
| 62 | cd db-$VERSION |
---|
| 63 | |
---|
| 64 | chown -R root:root . |
---|
| 65 | find . \ |
---|
| 66 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
| 67 | -exec chmod 755 {} \; -o \ |
---|
| 68 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
| 69 | -exec chmod 644 {} \; |
---|
| 70 | |
---|
| 71 | rm -rf build-dir |
---|
| 72 | mkdir build-dir |
---|
| 73 | cd build-dir |
---|
| 74 | CFLAGS="$SLKCFLAGS" \ |
---|
| 75 | CXXFLAGS="$SLKCFLAGS" \ |
---|
| 76 | ../dist/configure \ |
---|
| 77 | --prefix=/usr \ |
---|
| 78 | --libdir=/usr/lib${LIBDIRSUFFIX} \ |
---|
| 79 | --enable-shared \ |
---|
| 80 | --enable-cxx \ |
---|
| 81 | --enable-compat185 \ |
---|
| 82 | --disable-test \ |
---|
| 83 | --build=$ARCH-slackware-linux || exit 1 |
---|
| 84 | |
---|
| 85 | make $NUMJOBS || make || exit 1 |
---|
| 86 | make -i install DESTDIR=$PKG |
---|
| 87 | |
---|
| 88 | find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \ |
---|
| 89 | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true |
---|
| 90 | |
---|
| 91 | # Remove WAY TOO LARGE (and misplaced) docs: |
---|
| 92 | # This can be fixed with "docdir=/usr/doc/$PKGNAM-$VERSION" passed to make |
---|
| 93 | # but there's not really a good reason to do that given they'll be removed |
---|
| 94 | rm -rf $PKG/usr/docs |
---|
| 95 | mkdir -p $PKG/usr/doc/db-$VERSION |
---|
| 96 | cp -a \ |
---|
| 97 | ../LICENSE ../README \ |
---|
| 98 | $PKG/usr/doc/db-$VERSION |
---|
| 99 | cat << EOF > $PKG/usr/doc/db-$VERSION/README-DOCS |
---|
| 100 | |
---|
| 101 | For a ton of additional documentation (too large to include |
---|
| 102 | here) on writing source code that uses libdb$PKGNAM, please see |
---|
| 103 | the original source tarball db-$VERSION.tar.xz, which can be found |
---|
| 104 | on Oracle's web site: |
---|
| 105 | |
---|
| 106 | http://www.oracle.com/technetwork/products/berkeleydb/overview/index.html |
---|
| 107 | |
---|
| 108 | EOF |
---|
| 109 | |
---|
| 110 | # Move include files: |
---|
| 111 | ( cd $PKG/usr/include |
---|
| 112 | mkdir $PKGNAM |
---|
| 113 | mv *.h $PKGNAM |
---|
| 114 | for file in $PKGNAM/* ; do |
---|
| 115 | ln -sf $file . |
---|
| 116 | done |
---|
| 117 | ) |
---|
| 118 | |
---|
| 119 | # Put libdb-4.8.so into /lib${LIBDIRSUFFIX} since it might be needed |
---|
| 120 | # before /usr is mounted (eg, nsswitch.conf can be set up to |
---|
| 121 | # use databases instead of flat files) |
---|
| 122 | mkdir -p $PKG/lib${LIBDIRSUFFIX} |
---|
| 123 | mv $PKG/usr/lib${LIBDIRSUFFIX}/libdb-4.8.so $PKG/lib${LIBDIRSUFFIX}/libdb-4.8.so |
---|
| 124 | ( cd $PKG/usr/lib${LIBDIRSUFFIX} |
---|
| 125 | ln -sf /lib${LIBDIRSUFFIX}/libdb-4.8.so . |
---|
| 126 | ) |
---|
| 127 | |
---|
| 128 | # Some things might look for these libraries by other names. |
---|
| 129 | ( cd $PKG/usr/lib${LIBDIRSUFFIX} |
---|
| 130 | ln -sf libdb-4.8.a libdb-4.a |
---|
| 131 | ln -sf libdb-4.8.a libdb4.a |
---|
| 132 | ln -sf libdb-4.8.a libdb.a |
---|
| 133 | ln -sf libdb_cxx-4.8.a libdb_cxx-4.a |
---|
| 134 | ln -sf libdb_cxx-4.8.a libdb_cxx.a |
---|
| 135 | ln -sf libdb-4.8.so libdb4.so |
---|
| 136 | ln -sf libdb-4.8.so libdb.so |
---|
| 137 | ) |
---|
| 138 | |
---|
| 139 | mkdir -p $PKG/install |
---|
| 140 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 141 | |
---|
| 142 | cd $PKG |
---|
| 143 | /sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz |
---|