source: npl/overig/popt/popt.SlackBuild.orig @ fdfd619

perl-5.22
Last change on this file since fdfd619 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: 3.8 KB
Line 
1#!/bin/sh
2
3# Copyright 2006, 2007, 2008, 2009, 2013  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
24PKGNAM=popt
25VERSION=${VERSION:-1.16}
26BUILD=${BUILD:-2}
27
28NUMJOBS=${NUMJOBS:-" -j7 "}
29
30# Automatically determine architecture for build & packaging:
31if [ -z "$ARCH" ]; then
32  case "$( uname -m )" in
33    i?86) export ARCH=i486 ;;
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 ${PKGNAM}-${VERSION}
61tar xvf $CWD/${PKGNAM}-$VERSION.tar.?z* || exit 1
62cd ${PKGNAM}-$VERSION
63
64# Make sure ownerships and permissions are sane:
65chown -R root:root .
66find . \
67  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
68  -exec chmod 755 {} \; -o \
69  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
70  -exec chmod 644 {} \;
71
72# Configure:
73CFLAGS="$SLKCFLAGS" \
74./configure \
75  --prefix=/usr \
76  --libdir=/usr/lib${LIBDIRSUFFIX} \
77  --sysconfdir=/etc \
78  --mandir=/usr/man \
79  --program-prefix= \
80  --program-suffix= \
81  --build=$ARCH-slackware-linux
82
83# Build and install:
84make $NUMJOBS || make || exit 1
85make install DESTDIR=$PKG || exit 1
86
87# Move the binary and shared library to /sbin and /lib(64)
88mkdir -p $PKG/lib${LIBDIRSUFFIX}
89( cd $PKG/usr/lib${LIBDIRSUFFIX}
90  for file in lib*.so.?.* ; do
91    mv $file ../../lib${LIBDIRSUFFIX}
92    ln -sf ../../lib${LIBDIRSUFFIX}/$file .
93  done
94  cp -a lib*.so.? ../../lib${LIBDIRSUFFIX}
95)
96
97# Make sure pkgconfig directory is in the right place:
98#mv $PKG/usr/lib/pkgconfig $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig 1> /dev/null 2> /dev/null
99
100# Strip binaries:
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# Compress and link manpages, if any:
105if [ -d $PKG/usr/man ]; then
106  ( cd $PKG/usr/man
107    for manpagedir in $(find . -type d -name "man*") ; do
108      ( cd $manpagedir
109        for eachpage in $( find . -type l -maxdepth 1) ; do
110          ln -s $( readlink $eachpage ).gz $eachpage.gz
111          rm $eachpage
112        done
113        gzip -9 *.*
114      )
115    done
116  )
117fi
118
119# Compress info files, if any:
120if [ -d $PKG/usr/info ]; then
121  ( cd $PKG/usr/info
122    rm -f dir
123    gzip -9 *
124  )
125fi
126
127# Add a documentation directory:
128mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
129cp -a \
130  COPYING README \
131  $PKG/usr/doc/${PKGNAM}-$VERSION
132
133mkdir -p $PKG/install
134cat $CWD/slack-desc > $PKG/install/slack-desc
135
136cd $PKG
137makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
138
Note: See TracBrowser for help on using the repository browser.