source: npl/system/gmp/gmp.SlackBuild.orig @ 1a19ecd

perl-5.22
Last change on this file since 1a19ecd was 1a19ecd, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

upgrade glibc/gcc to gcc 5.4.0 and glibc 2.24

  • Property mode set to 100755
File size: 3.6 KB
Line 
1#!/bin/sh
2
3# Copyright 2008, 2009, 2010, 2015  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# Modified 2011 by Eric Hameleers <alien at slackware.com> for ARM port.
24
25VERSION=${VERSION:-$(echo gmp-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
26BUILD=${BUILD:-1}
27
28# Automatically determine the architecture we're building on:
29MARCH=$( uname -m )
30if [ -z "$ARCH" ]; then
31  case "$MARCH" in
32    i?86)    export ARCH=i586 ;;
33    armv7hl) export ARCH=$MARCH ;;
34    arm*)    export ARCH=arm ;;
35    # Unless $ARCH is already set, use uname -m for all other archs:
36    *)       export ARCH=$MARCH ;;
37  esac
38fi
39
40NUMJOBS=${NUMJOBS:-" -j7 "}
41
42CWD=$(pwd)
43TMP=${TMP:-/tmp}
44PKG=/$TMP/package-gmp
45rm -rf $PKG
46mkdir -p $TMP $PKG/usr
47
48if [ "$ARCH" = "i586" ]; then
49  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
50  LIBDIRSUFFIX=""
51elif [ "$ARCH" = "s390" ]; then
52  SLKCFLAGS="-O2"
53  LIBDIRSUFFIX=""
54elif [ "$ARCH" = "x86_64" ]; then
55  SLKCFLAGS="-O2 -fPIC"
56  LIBDIRSUFFIX="64"
57elif [ "$ARCH" = "armv7hl" ]; then
58  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
59  LIBDIRSUFFIX=""
60else
61  SLKCFLAGS="-O2"
62  LIBDIRSUFFIX=""
63fi
64
65case "$ARCH" in
66    arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
67    *)    TARGET=$ARCH-slackware-linux ;;
68esac
69
70cd $TMP
71rm -rf gmp-$VERSION
72tar xvf $CWD/gmp-$VERSION.tar.xz || exit 1
73cd gmp-$VERSION || exit 1
74
75chown -R root:root .
76find . \
77  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
78  -exec chmod 755 {} \; -o \
79  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
80  -exec chmod 644 {} \;
81
82# End of preparations
83if echo "$*" | grep -qw -- --prep ; then
84  exit 0
85fi
86
87CFLAGS="$SLKCFLAGS" \
88./configure \
89  --prefix=/usr \
90  --libdir=/usr/lib${LIBDIRSUFFIX} \
91  --infodir=/usr/info \
92  --with-gnu-ld \
93  --enable-cxx \
94  --disable-static \
95  --build=$TARGET || exit 1
96
97make $NUMJOBS || make || exit 1
98make install DESTDIR=$PKG || exit 1
99
100rm $PKG/usr/info/dir
101gzip -9 $PKG/usr/info/*
102
103find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
104  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
105
106mkdir -p $PKG/usr/doc/gmp-$VERSION
107cp -a \
108  AUTHORS COPYING* NEWS README* \
109  $PKG/usr/doc/gmp-$VERSION
110
111# If there's a ChangeLog, installing at least part of the recent history
112# is useful, but don't let it get totally out of control:
113if [ -r ChangeLog ]; then
114  DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
115  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
116  touch -r ChangeLog $DOCSDIR/ChangeLog
117fi
118
119mkdir -p $PKG/install
120cat $CWD/slack-desc > $PKG/install/slack-desc
121
122cd /$TMP/package-gmp
123/sbin/makepkg -l y -c n $TMP/gmp-$VERSION-$ARCH-$BUILD.txz
124
Note: See TracBrowser for help on using the repository browser.