source: npl/overig/libffi/libffi.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.0 KB
Line 
1#!/bin/sh
2
3# Slackware build script for libffi
4
5# Copyright 2011,2012  Robby Workman, Northport, Alabama, USA
6# Copyright 2012, 2013  Patrick J. Volkerding, Sebeka, MN, USA
7# All rights reserved.
8#
9# Redistribution and use of this script, with or without modification, is
10# permitted provided that the following conditions are met:
11#
12# 1. Redistributions of this script must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14#
15#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
16#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
18#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26PKGNAM=libffi
27VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
28BUILD=${BUILD:-1}
29
30# Automatically determine the architecture we're building on:
31if [ -z "$ARCH" ]; then
32  case "$(uname -m)" in
33    i?86) ARCH=i486 ;;
34    arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
35    # Unless $ARCH is already set, use uname -m for all other archs:
36    *) ARCH=$(uname -m) ;;
37  esac
38  export ARCH
39fi
40
41CWD=$(pwd)
42TMP=${TMP:-/tmp}
43PKG=$TMP/package-$PKGNAM
44
45if [ "$ARCH" = "i486" ]; then
46  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
47  LIBDIRSUFFIX=""
48elif [ "$ARCH" = "i686" ]; then
49  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
50  LIBDIRSUFFIX=""
51elif [ "$ARCH" = "x86_64" ]; then
52  SLKCFLAGS="-O2 -fPIC"
53  LIBDIRSUFFIX="64"
54else
55  SLKCFLAGS="-O2"
56  LIBDIRSUFFIX=""
57fi
58
59rm -rf $PKG
60mkdir -p $TMP $PKG
61cd $TMP
62rm -rf $PKGNAM-$VERSION
63tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1
64cd $PKGNAM-$VERSION
65
66zcat $CWD/libffi.includedir.diff.gz | patch -p1 --verbose || exit 1
67
68chown -R root:root .
69find . \
70 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
71 -exec chmod 755 {} \; -o \
72 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
73 -exec chmod 644 {} \;
74
75CFLAGS="$SLKCFLAGS" \
76CXXFLAGS="$SLKCFLAGS" \
77./configure \
78  --prefix=/usr \
79  --libdir=/usr/lib${LIBDIRSUFFIX} \
80  --sysconfdir=/etc \
81  --localstatedir=/var \
82  --mandir=/usr/man \
83  --infodir=/usr/info \
84  --docdir=/usr/doc/$PKGNAM-$VERSION \
85  --disable-static \
86  --build=$ARCH-slackware-linux || exit 1
87
88make || exit 1
89make install DESTDIR=$PKG || exit 1
90
91# Strip binaries:
92( cd $PKG
93  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
94  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
95)
96
97# Compress and if needed symlink the man pages:
98if [ -d $PKG/usr/man ]; then
99  ( cd $PKG/usr/man
100    for manpagedir in $(find . -type d -name "man*") ; do
101      ( cd $manpagedir
102        for eachpage in $( find . -type l -maxdepth 1) ; do
103          ln -s $( readlink $eachpage ).gz $eachpage.gz
104          rm $eachpage
105        done
106        gzip -9 *.?
107      )
108    done
109  )
110fi
111
112# Compress info files, if any:
113if [ -d $PKG/usr/info ]; then
114  ( cd $PKG/usr/info
115    rm -f dir
116    gzip -9 *
117  )
118fi
119
120mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
121cp -a LICENSE README $PKG/usr/doc/$PKGNAM-$VERSION
122
123# If there's a ChangeLog, installing at least part of the recent history
124# is useful, but don't let it get totally out of control:
125if [ -r ChangeLog ]; then
126  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
127  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
128  touch -r ChangeLog $DOCSDIR/ChangeLog
129fi
130
131mkdir -p $PKG/install
132cat $CWD/slack-desc > $PKG/install/slack-desc
133
134cd $PKG
135/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.