source: npl/overig/gc/gc.SlackBuild.orig @ 51c3d1a

perl-5.22
Last change on this file since 51c3d1a 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: 5.0 KB
Line 
1#!/bin/sh
2
3# Copyright 2013, 2014, 2015  Patrick J. Volkerding, Sebeka, MN, USA
4# Copyright 2014  Heinz Wiesinger, Amsterdam, NL
5# All rights reserved.
6#
7# Redistribution and use of this script, with or without modification, is
8# permitted provided that the following conditions are met:
9#
10# 1. Redistributions of this script must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12#
13#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
14#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
16#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
18#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
19#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
21#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24
25PKGNAM=gc
26VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-3}
28
29# Automatically determine the architecture we're building on:
30if [ -z "$ARCH" ]; then
31  case "$( uname -m )" in
32    i?86) export ARCH=i586 ;;
33    arm*) export ARCH=arm ;;
34    # Unless $ARCH is already set, use uname -m for all other archs:
35       *) export ARCH=$( uname -m ) ;;
36  esac
37fi
38
39NUMJOBS=${NUMJOBS:-" -j7 "}
40
41CWD=$(pwd)
42TMP=${TMP:-/tmp}
43PKG=$TMP/package-$PKGNAM
44rm -rf $PKG
45mkdir -p $PKG/usr
46
47if [ "$ARCH" = "i586" ]; then
48  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
49  LIBDIRSUFFIX=""
50elif [ "$ARCH" = "s390" ]; then
51  SLKCFLAGS="-O2"
52  LIBDIRSUFFIX=""
53elif [ "$ARCH" = "x86_64" ]; then
54  SLKCFLAGS="-O2 -fPIC"
55  LIBDIRSUFFIX="64"
56else
57  SLKCFLAGS="-O2"
58  LIBDIRSUFFIX=""
59fi
60
61cd $TMP
62rm -rf $PKGNAM-$VERSION $PKGNAM-$(echo $VERSION | cut -b 1-3)
63tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1
64cd $PKGNAM-$VERSION 2> /dev/null || cd $PKGNAM-$(echo $VERSION | cut -b 1-3) || exit 1
65tar xvf $CWD/libatomic_ops-$VERSION.tar.xz || exit 1
66mv libatomic_ops-$VERSION libatomic_ops
67chown -R root:root .
68find . \
69  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
70  -exec chmod 755 {} \; -o \
71  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
72  -exec chmod 644 {} \;
73
74# https://github.com/ivmai/bdwgc/pull/51
75zcat $CWD/noelision.patch.gz | patch -p1 --verbose || exit 1
76
77# Guarding GC_setup_mark_lock usage with PARALLEL_MARK is required to avoid
78# an undefined reference in non-PARALLEL_MARK configurations:
79zcat $CWD/refer_to_GC_setup_mark_lock_only_in_PARALLEL_MARK_code.patch.gz | patch -p0 --verbose || exit 1
80
81sed -i 's#pkgdata#doc#' doc/doc.am
82sed -i 's#pkgdata#doc#' libatomic_ops/Makefile.am
83sed -i 's#pkgdata#doc#' libatomic_ops/doc/Makefile.am
84
85autoreconf -vif
86automake --add-missing
87
88# See bugzilla.redhat.com/689877 for -DUSE_GET_STACKBASE_FOR_MAIN
89
90CFLAGS="$SLKCFLAGS -DUSE_GET_STACKBASE_FOR_MAIN" \
91./configure \
92  --prefix=/usr \
93  --libdir=/usr/lib${LIBDIRSUFFIX} \
94  --infodir=/usr/info \
95  --mandir=/usr/man \
96  --disable-dependency-tracking \
97  --enable-cplusplus \
98  --enable-large-config \
99  --enable-parallel-mark \
100  --enable-threads=posix \
101  --with-libatomic-ops=no \
102  --build=$ARCH-slackware-linux
103
104# NOTE:  Using --disable-static exports a subset of symbols, and has caused
105# some things that use gc to break.  So it is recommended to build the static
106# libraries and then remove them before packaging.
107
108# Does not like parallel make...
109make $NUMJOBS || make || exit 1
110make install DESTDIR=$PKG || exit 1
111
112mkdir -p $PKG/usr/man/man3
113sed -i -e 's/GC_MALLOC 1L/gc 3/' doc/gc.man
114install -m 644 doc/gc.man $PKG/usr/man/man3/gc.3
115
116# Install libatomic_ops
117cd libatomic_ops
118  make install DESTDIR=$PKG || exit 1
119cd -
120
121# Remove static libraries that we don't want in the package, and fix the
122# .la files to remove the references to them:
123( cd $PKG/usr/lib${LIBDIRSUFFIX}
124  for static in libcord libgc libgccpp ; do
125    rm --verbose ${static}.a
126    sed -i "s#old_library='.*'#old_library=''#g" ${static}.la
127  done
128)
129
130find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
131  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
132
133# Compress and link manpages, if any:
134if [ -d $PKG/usr/man ]; then
135  ( cd $PKG/usr/man
136    for manpagedir in $(find . -type d -name "man*") ; do
137      ( cd $manpagedir
138        for eachpage in $( find . -type l -maxdepth 1) ; do
139          ln -s $( readlink $eachpage ).gz $eachpage.gz
140          rm $eachpage
141        done
142        gzip -9 *.?
143      )
144    done
145  )
146fi
147
148mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
149mv $PKG/usr/share/doc/* $PKG/usr/doc/$PKGNAM-$VERSION/
150rm -f $PKG/usr/doc/$PKGNAM-$VERSION/gc/gc.man
151rm -rf $PKG/usr/share
152cp -a \
153  README.QUICK TODO \
154  $PKG/usr/doc/$PKGNAM-$VERSION
155
156mkdir -p $PKG/install
157cat $CWD/slack-desc > $PKG/install/slack-desc
158
159cd $PKG
160/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
161
Note: See TracBrowser for help on using the repository browser.