source: npl/fileserver/libtirpc/libtirpc.SlackBuild.orig @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c 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.8 KB
Line 
1#!/bin/sh
2
3# Copyright 2015  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# Thanks to Jan Rafaj for contributing the original reference script.
24# Remark: - The GSS support (for secure RPC) is currently not built, as it
25# Remark:   requires Kerberos 5 libraries. If you need it, install
26# Remark:   Kerberos 5, remove '--disable-gssapi' from the configure flags
27# Remark:   below and rebuild.
28
29PKGNAM=libtirpc
30VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
31BUILD=${BUILD:-2}
32
33# To build with GSS support (requires Kerberos 5 libraries), pass any value
34# other than "NO" in the environment, or edit the line below:
35WITH_GSS=${WITH_GSS:-NO}
36
37# Automatically determine the architecture we're building on:
38if [ -z "$ARCH" ]; then
39  case "$(uname -m)" in
40    i?86) ARCH=i586 ;;
41    arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
42    # Unless $ARCH is already set, use uname -m for all other archs:
43    *) ARCH=$(uname -m) ;;
44  esac
45  export ARCH
46fi
47
48NUMJOBS=${NUMJOBS:-" -j7 "}
49
50if [ "$ARCH" = "i386" ]; then
51  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
52  LIBDIRSUFFIX=""
53elif [ "$ARCH" = "i486" ]; then
54  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
55  LIBDIRSUFFIX=""
56elif [ "$ARCH" = "i586" ]; then
57  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
58  LIBDIRSUFFIX=""
59elif [ "$ARCH" = "i686" ]; then
60  SLKCFLAGS="-O2 -march=i686"
61  LIBDIRSUFFIX=""
62elif [ "$ARCH" = "s390" ]; then
63  SLKCFLAGS="-O2"
64  LIBDIRSUFFIX=""
65elif [ "$ARCH" = "x86_64" ]; then
66  SLKCFLAGS="-O2 -fPIC"
67  LIBDIRSUFFIX="64"
68elif [ "$ARCH" = "armv7hl" ]; then
69  SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
70  LIBDIRSUFFIX=""
71else
72  SLKCFLAGS="-O2"
73  LIBDIRSUFFIX=""
74fi
75
76CWD=$(pwd)
77TMP=${TMP:-/tmp}
78PKG=$TMP/package-$PKGNAM
79
80rm -rf $PKG
81mkdir -p $TMP $PKG
82
83cd $TMP
84rm -rf $PKGNAM-$VERSION
85tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
86cd $PKGNAM-$VERSION
87
88chown -R root:root .
89find . \
90  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
91  -exec chmod 755 {} \; -o \
92  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
93  -exec chmod 644 {} \;
94
95# Set proper GSS option:
96if [ "$WITH_GSS" = "NO" ]; then
97  GSSAPI="--disable-gssapi"
98else
99  GSSAPI="--enable-gssapi"
100fi
101
102# Configure:
103CFLAGS="$SLKCFLAGS" \
104./configure \
105  --prefix=/usr \
106  --sysconfdir=/etc \
107  --libdir=/usr/lib${LIBDIRSUFFIX} \
108  --mandir=/usr/man \
109  --disable-static \
110  $GSSAPI \
111  --build=$ARCH-slackware-linux
112
113# Build and install:
114make $NUMJOBS || make || exit 1
115make install DESTDIR=$PKG || exit 1
116
117# Make etc/netconfig file a .new:
118mv $PKG/etc/netconfig $PKG/etc/netconfig.new
119
120# Move library to /lib${LIBDIRSUFFIX} as it might be needed to mount /usr:
121mkdir $PKG/lib${LIBDIRSUFFIX}
122( cd $PKG/usr/lib${LIBDIRSUFFIX}
123  for file in lib*.so.?.* ; do
124    mv $file ../../lib${LIBDIRSUFFIX}
125    ln -sf ../../lib${LIBDIRSUFFIX}/$file .
126  done
127  cp -a lib*.so.? ../../lib${LIBDIRSUFFIX}
128)
129
130# Strip binaries:
131( cd $PKG
132  #find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
133  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
134)
135
136# Add a documentation directory:
137mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
138cp -a \
139  AUTHORS COPYING* NEWS README* THANKS TODO \
140  $PKG/usr/doc/${PKGNAM}-$VERSION
141
142# Don't use .3t man page suffix:
143if [ -d $PKG/usr/man/man3 ]; then
144  ( cd $PKG/usr/man/man3
145    for file in *.3t ; do
146      mv $file $(basename $file .3t).3
147    done
148  )
149fi
150
151# Compress manual pages:
152find $PKG/usr/man -type f -exec gzip -9 {} \;
153for i in $( find $PKG/usr/man -type l ) ; do
154  ln -s $( readlink $i ).gz $i.gz
155  rm $i
156done
157
158mkdir -p $PKG/install
159zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
160cat $CWD/slack-desc > $PKG/install/slack-desc
161
162cd $PKG
163/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
164
Note: See TracBrowser for help on using the repository browser.