source: npl/system/mpfr/mpfr.SlackBuild.orig

Last change on this file 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: 4.0 KB
Line 
1#!/bin/sh
2
3# Copyright 2008, 2009, 2010, 2011, 2012  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# Modified 2011 by Eric Hameleers <alien at slackware.com> for ARM port.
24
25PKGNAM=mpfr
26VERSION=${VERSION:-$(echo mpfr-*.tar.xz | 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:
32MARCH=$( uname -m )
33if [ -z "$ARCH" ]; then
34  case "$MARCH" in
35    i?86)    export ARCH=i586 ;;
36    armv7hl) export ARCH=$MARCH ;;
37    arm*)    export ARCH=arm ;;
38    # Unless $ARCH is already set, use uname -m for all other archs:
39    *)       export ARCH=$MARCH ;;
40  esac
41fi
42
43if [ "$ARCH" = "i586" ]; then
44  SLKCFLAGS="-O2 -march=i586 -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"
52elif [ "$ARCH" = "armv7hl" ]; then
53  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
54  LIBDIRSUFFIX=""
55else
56  SLKCFLAGS="-O2"
57  LIBDIRSUFFIX=""
58fi
59
60case "$ARCH" in
61    arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
62    *)    TARGET=$ARCH-slackware-linux ;;
63esac
64
65CWD=$(pwd)
66TMP=${TMP:-/tmp}
67PKG=$TMP/package-mpfr
68rm -rf $PKG
69mkdir -p $TMP $PKG
70
71# Determine patchlevel:
72PATCHLEVEL=$(/bin/ls $CWD/patches/* 2> /dev/null | rev | cut -f 1 -d / | cut -b4- | rev | cut -b6- | tail -n 1 )
73if [ ! "$PATCHLEVEL" = "" ]; then
74  PATCHLEVEL="p${PATCHLEVEL}"
75fi
76
77cd $TMP
78rm -rf mpfr-$VERSION
79tar xvf $CWD/mpfr-$VERSION.tar.xz || exit 1
80cd mpfr-$VERSION
81chown -R root:root .
82
83if [ ! -z "$(ls $CWD/patches/* 2> /dev/null)" ]; then
84  for file in $CWD/patches/* ; do
85    ( zcat $file 2> /dev/null | patch -p1 --verbose --batch 2> /dev/null || exit 1 )
86    if [ ! $? = 0 ]; then
87      exit 1
88    fi
89  done
90fi
91
92# End of preparations
93if echo "$*" | grep -qw -- --prep ; then
94  exit 0
95fi
96
97CFLAGS="$SLKCFLAGS" \
98./configure \
99  --prefix=/usr \
100  --libdir=/usr/lib${LIBDIRSUFFIX} \
101  --infodir=/usr/info \
102  --docdir=/usr/doc/mpfr-$VERSION \
103  --enable-static=yes \
104  --enable-shared=yes \
105  --build=$TARGET
106
107make $NUMJOBS || make || exit 1
108make install DESTDIR=$PKG || exit 1
109
110find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
111  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
112
113# Hardly a savings doing this...
114#strip -g $PKG/usr/lib${LIBDIRSUFFIX}/*.a
115
116rm -f $PKG/usr/info/dir
117gzip -9 $PKG/usr/info/*
118
119mkdir -p $PKG/usr/doc/mpfr-$VERSION
120cp -a \
121  AUTHORS BUGS COPYING* INSTALL NEWS README* TODO VERSION \
122  examples \
123  $PKG/usr/doc/mpfr-$VERSION
124
125# If there's a ChangeLog, installing at least part of the recent history
126# is useful, but don't let it get totally out of control:
127if [ -r ChangeLog ]; then
128  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
129  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
130  touch -r ChangeLog $DOCSDIR/ChangeLog
131fi
132
133mkdir -p $PKG/install
134cat $CWD/slack-desc > $PKG/install/slack-desc
135
136cd $PKG
137/sbin/makepkg -l y -c n $TMP/mpfr-${VERSION}${PATCHLEVEL}-${ARCH}-${BUILD}.txz
138
Note: See TracBrowser for help on using the repository browser.