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

Last change on this file was d8979f1, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

upgraded ccoreutils

  • Property mode set to 100755
File size: 7.4 KB
Line 
1#!/bin/sh
2
3# Copyright 2005-2016  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
23PKGNAM=coreutils
24VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
25BUILD=${BUILD:-1}
26
27NUMJOBS=${NUMJOBS:--j6}
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
39CWD=$(pwd)
40TMP=${TMP:-/tmp}
41PKG=$TMP/package-$PKGNAM
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" = "arm" ]; then
53  SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
54  LIBDIRSUFFIX=""
55elif [ "$ARCH" = "armel" ]; then
56  SLKCFLAGS="-O2 -march=armv4t"
57  LIBDIRSUFFIX=""
58else
59  SLKCFLAGS="-O2"
60  LIBDIRSUFFIX=""
61fi
62
63rm -rf $PKG
64mkdir -p $TMP $PKG
65cd $TMP
66
67rm -rf $PKGNAM-$VERSION
68if [ -r $CWD/$PKGNAM-$VERSION.tar.gz ]; then
69  tar xf $CWD/$PKGNAM-$VERSION.tar.gz || exit 1
70elif [ -r $CWD/$PKGNAM-$VERSION.tar.bz2 ]; then
71  tar xf $CWD/$PKGNAM-$VERSION.tar.bz2 || exit 1
72elif [ -r $CWD/$PKGNAM-$VERSION.tar.xz ]; then
73  tar xf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1
74elif [ -r $CWD/$PKGNAM-$VERSION.tar.lzma ]; then
75  tar xf $CWD/$PKGNAM-$VERSION.tar.lzma || exit 1
76else
77  exit 1
78fi
79
80cd $PKGNAM-$VERSION
81chown -R root:root .
82find . \
83 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
84 -exec chmod 755 {} \; -o \
85 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
86 -exec chmod 644 {} \;
87
88# Patch uname to correctly display CPU information:
89zcat $CWD/$PKGNAM.uname.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
90
91# Revert change to ls quoting style introduced in coreutils-8.25:
92zcat $CWD/no_ls_quoting.patch.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
93
94# Compilation with glibc version later than 2.3.2 needs the environment
95# variable DEFAULT_POSIX2_VERSION set to 199209.
96# Without that line, the coreutils will start complaining about 'obsolete'
97# command switches, like "tail -20" will be considered obsolete.
98# This behaviour breaks many other packages... the 'obsolete' parameters are
99# too commonly used to disregard them.  Better to stick with the older more
100# widely accepted standards until things begin to demand the new way.
101
102FORCE_UNSAFE_CONFIGURE=1 \
103CFLAGS="$SLKCFLAGS" \
104DEFAULT_POSIX2_VERSION=199209 \
105./configure \
106  --prefix=/usr \
107  --bindir=/bin \
108  --mandir=/usr/man \
109  --infodir=/usr/info \
110  --sysconfdir=/etc \
111  --libdir=/usr/lib${LIBDIRSUFFIX} \
112  --without-gmp \
113  --enable-install-program=arch \
114  --build=$ARCH-slackware-linux
115
116make $NUMJOBS || make || exit 1
117make install DESTDIR=$PKG
118
119find $PKG | xargs file | grep -e "executable" -e "shared object" \
120  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
121
122# We have had the mktemp from debianutils included with Slackware for quite a
123# long time, and certain options are changed here, like changing -u to mean a
124# dry-run rather than to unlink the tempfile when finished.  Since this could
125# break existing scripts, unless someone can tell me a good reason why we
126# should start using a new version of mktemp, we will continue to use the
127# one we've been using.  If the new one starts to become expected, let me know.
128# We'll figure out what the best options are and go from there.
129mv $PKG/bin/mktemp $PKG/bin/mktemp-gnu
130mv $PKG/usr/man/man1/mktemp.1 $PKG/usr/man/man1/mktemp-gnu.1
131
132# This seems wrong, and it stomps on files in the ksh93 package, though I'm
133# not sure the placement of those is correct, either...  The ksh93 package
134# installs them as flat text files, while coreutils installs empty directories
135# Oh well, this is what we've done for years, and nobody's complained...
136rm -rf $PKG/usr/share/locale/*/LC_TIME
137
138# Move "arch" to /bin
139#mv $PKG/usr/bin/arch $PKG/bin
140
141# These are important enough that they should probably all go into /bin at this
142# point...   Having some of them unavailable when /usr isn't mounted is just a
143# source of unending bug reports for various third party applications.
144# Time to end those reports.  :-)
145mkdir -p $PKG/bin $PKG/usr/bin
146( cd $PKG/usr/bin
147  for file in ../../bin/* ; do
148    ln --verbose -sf $file .
149  done
150)
151
152# Add some defaults, although a very slack-like set of default options are built
153# into /bin/ls now anyway:
154mkdir -p $PKG/etc
155zcat $CWD/DIR_COLORS.gz > $PKG/etc/DIR_COLORS.new
156
157# Since dircolors no longer provides any default aliases these scripts
158# will be needed for ls to act as expected:
159mkdir -p $PKG/etc/profile.d
160zcat $CWD/coreutils-dircolors.csh.gz > $PKG/etc/profile.d/coreutils-dircolors.csh
161zcat $CWD/coreutils-dircolors.sh.gz > $PKG/etc/profile.d/coreutils-dircolors.sh
162chmod 755 $PKG/etc/profile.d/*
163
164# Remove things that are provided by other Slackware packages:
165for dupe in hostname kill su uptime ; do
166  rm -f $PKG/bin/${dupe} $PKG/usr/bin/${dupe} \
167    $PKG/usr/sbin/${dupe} $PKG/usr/man/man?/${dupe}.* ;
168done
169
170# Add ginstall links (there's still a lot of stuff that needs this to compile):
171( cd $PKG/bin ; ln -sf install ginstall )
172( cd $PKG/usr/bin ; ln -sf ../../bin/ginstall ginstall )
173( cd $PKG/usr/man/man1 ; ln -sf install.1 ginstall.1 )
174
175# Compress and link manpages, if any:
176if [ -d $PKG/usr/man ]; then
177  ( cd $PKG/usr/man
178    for manpagedir in $(find . -type d -name "man*") ; do
179      ( cd $manpagedir
180        for eachpage in $( find . -type l -maxdepth 1) ; do
181          ln -s $( readlink $eachpage ).gz $eachpage.gz
182          rm $eachpage
183        done
184        gzip -9 *.?
185      )
186    done
187  )
188fi
189
190rm -f $PKG/usr/info/dir
191gzip -9 $PKG/usr/info/*
192
193mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
194cp -a \
195  AUTHORS COPYING* NEWS README* THANKS THANKS-to-translators TODO \
196  $PKG/usr/doc/$PKGNAM-$VERSION
197
198# If there's a ChangeLog, installing at least part of the recent history
199# is useful, but don't let it get totally out of control:
200if [ -r ChangeLog ]; then
201  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
202  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
203  touch -r ChangeLog $DOCSDIR/ChangeLog
204fi
205
206mkdir -p $PKG/install
207zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
208cat $CWD/slack-desc > $PKG/install/slack-desc
209
210# Build the package:
211cd $PKG
212/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
213
Note: See TracBrowser for help on using the repository browser.