source: npl/overig/db48/db48.SlackBuild.orig

Last change on this file was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 4.2 KB
Line 
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
23PKGNAM=db48
24VERSION=4.8.30
25BUILD=${BUILD:-2}
26
27NUMJOBS=${NUMJOBS:--j7}
28
29# Automatically determine the architecture we're building on:
30if [ -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
37fi
38
39CWD=$(pwd)
40TMP=${TMP:-/tmp}
41PKG=$TMP/package-$PKGNAM
42
43if [ "$ARCH" = "i486" ]; then
44  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
45  LIBDIRSUFFIX=""
46elif [ "$ARCH" = "s390" ]; then
47  SLKCFLAGS="-O2"
48  LIBDIRSUFFIX=""
49elif [ "$ARCH" = "x86_64" ]; then
50  SLKCFLAGS="-O2 -fPIC"
51  LIBDIRSUFFIX="64"
52else
53  SLKCFLAGS="-O2"
54  LIBDIRSUFFIX=""
55fi
56
57rm -rf $PKG
58mkdir -p $TMP $PKG
59cd $TMP
60rm -rf db-$VERSION
61tar xvf $CWD/db-$VERSION.tar.xz
62cd db-$VERSION
63
64chown -R root:root .
65find . \
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
71rm -rf build-dir
72mkdir build-dir
73cd build-dir
74CFLAGS="$SLKCFLAGS" \
75CXXFLAGS="$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
85make $NUMJOBS || make || exit 1
86make -i install DESTDIR=$PKG
87
88find $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
94rm -rf $PKG/usr/docs
95mkdir -p $PKG/usr/doc/db-$VERSION
96cp -a \
97  ../LICENSE ../README \
98  $PKG/usr/doc/db-$VERSION
99cat << 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
108EOF
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)
122mkdir -p $PKG/lib${LIBDIRSUFFIX}
123mv $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
139mkdir -p $PKG/install
140cat $CWD/slack-desc > $PKG/install/slack-desc
141
142cd $PKG
143/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.