source: npl/overig/rpm/rpm.SlackBuild.orig @ cbeb6d3

perl-5.22
Last change on this file since cbeb6d3 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
RevLine 
[c5c522c]1#!/bin/sh
2
3# Copyright 2008, 2009, 2010  Patrick J. Volkerding, Sebeka, MN, 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# Build RPM (of all things) for Slackware.
24
25PKGNAM=rpm
26VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-1}
28
29NUMJOBS=${NUMJOBS:-" -j7 "}
30
31# Automatically determine the architecture we're building on:
32if [ -z "$ARCH" ]; then
33  case "$( uname -m )" in
34    i?86) export ARCH=i486 ;;
35    arm*) export ARCH=arm ;;
36    # Unless $ARCH is already set, use uname -m for all other archs:
37       *) export ARCH=$( uname -m ) ;;
38  esac
39fi
40
41if [ "$ARCH" = "i486" ]; then
42  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
43  LIBDIRSUFFIX=""
44elif [ "$ARCH" = "i686" ]; then
45  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
46  LIBDIRSUFFIX=""
47elif [ "$ARCH" = "x86_64" ]; then
48  SLKCFLAGS="-O2 -fPIC"
49  LIBDIRSUFFIX="64"
50elif [ "$ARCH" = "arm" ]; then
51  SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
52  LIBDIRSUFFIX=""
53elif [ "$ARCH" = "armel" ]; then
54  SLKCFLAGS="-O2 -march=armv4t"
55  LIBDIRSUFFIX=""
56fi
57
58DB_INC="/usr/include/db48"
59
60CWD=$(pwd)
61TMP=${TMP:-/tmp}
62PKG=/tmp/package-rpm
63
64rm -rf $PKG
65mkdir -p $TMP $PKG
66
67cd $TMP
68rm -rf rpm-$VERSION
69xz -dc $CWD/rpm-$VERSION.tar.xz | tar xvf - || exit 1
70cd rpm-$VERSION
71chown -R root:root .
72find . \
73  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
74  -exec chmod 755 {} \; -o \
75  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
76  -exec chmod 644 {} \;
77
78# We have to tell it where to find NSS and NSPR
79# Also, --enable-sqlite3 needs "-ldl" in LDFLAGS
80# And --enable-broken-chown fits, as ours follows symlinks.
81CFLAGS="$SLKCFLAGS -I${DB_INC} $(pkg-config --cflags nspr nss)" \
82LDFLAGS="-ldl" \
83./configure \
84  --prefix=/usr \
85  --libdir=/usr/lib${LIBDIRSUFFIX} \
86  --localstatedir=/var \
87  --mandir=/usr/man \
88  --enable-python \
89  --with-external-db \
90  --enable-broken-chown \
91  --without-hackingdocs \
92  --without-selinux \
93  --without-lua \
94  --without-dmalloc \
95  --enable-sqlite3 \
96  --build=$ARCH-slackware-linux
97
98make $NUMJOBS || make || exit 1
99make install DESTDIR=$PKG || exit 1
100
101find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
102  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
103
104# Here's a bug - /var/tmp should NOT have mode 0755
105rmdir $PKG/var/tmp || exit 1
106
107# Compress man pages
108( cd $PKG/usr/man
109  find . -type f -exec gzip -9 {} \;
110  for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
111)
112
113# Initialize a dummy package database
114mkdir -p $PKG/var/lib/rpm/tmp
115zcat $CWD/Packages.gz > $PKG/var/lib/rpm/tmp/Packages
116
117# Install docs
118mkdir -p $PKG/usr/doc/rpm-$VERSION
119cp -a \
120  COPYING* CREDITS GROUPS INSTALL README* TODO doc/manual \
121    $PKG/usr/doc/rpm-$VERSION
122
123# If there's a CHANGES file, installing at least part of the recent history
124# is useful, but don't let it get totally out of control:
125if [ -r CHANGES ]; then
126  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
127  cat CHANGES | head -n 1000 > $DOCSDIR/CHANGES
128  touch -r CHANGES $DOCSDIR/CHANGES
129fi
130
131mkdir -p $PKG/install
132zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
133cat $CWD/slack-desc > $PKG/install/slack-desc
134
135cd $PKG
136/sbin/makepkg -l y -c n $TMP/rpm-$VERSION-$ARCH-$BUILD.txz
137
Note: See TracBrowser for help on using the repository browser.