source: npl/overig/util-linux/util-linux.SlackBuild.orig

Last change on this file 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: 9.8 KB
Line 
1#!/bin/sh
2
3# Copyright 2008, 2009, 2010, 2011, 2012, 2013, 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# Slackware build script for util-linux
24
25VERSION=${VERSION:-$(echo util-linux*.tar.xz | cut -d - -f 3  | rev | cut -f 3- -d . | rev)}
26BUILD=${BUILD:-1}
27
28ADJTIMEXVERS=1.29
29SETSERIALVERS=2.17
30ZIPTOOLVERS=1.4.0
31
32NUMJOBS=${--j8}
33
34# Automatically determine the architecture we're building on:
35if [ -z "$ARCH" ]; then
36  case "$( uname -m )" in
37    i?86) export ARCH=i586 ;;
38    arm*) export ARCH=arm ;;
39    # Unless $ARCH is already set, use uname -m for all other archs:
40       *) export ARCH=$( uname -m ) ;;
41  esac
42fi
43
44if [ "$ARCH" = "i586" ]; then
45  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
46  LIBDIRSUFFIX=""
47elif [ "$ARCH" = "s390" ]; then
48  SLKCFLAGS="-O2"
49  LIBDIRSUFFIX=""
50elif [ "$ARCH" = "x86_64" ]; then
51  SLKCFLAGS="-O2 -fPIC"
52  LIBDIRSUFFIX="64"
53else
54  SLKCFLAGS="-O2"
55  LIBDIRSUFFIX=""
56fi
57
58CWD=$(pwd)
59TMP=${TMP:-/tmp}
60PKG=$TMP/package-util-linux
61
62rm -rf $PKG
63mkdir -p $TMP $PKG
64cd $TMP || exit 1
65rm -rf util-linux-$VERSION
66tar xvf $CWD/util-linux-$VERSION.tar.xz || exit 1
67cd util-linux-$VERSION || exit 1
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
75# Changing the fdisk -l output (this was done prior to util-linux-ng) broke
76# our installation scripts, so we have changed the name of partition type
77# 83 back to "Linux swap":
78zcat $CWD/util-linux.fdisk-no-solaris.diff.gz | patch -p1 --verbose || exit 1
79
80CFLAGS="$SLKCFLAGS" \
81./configure \
82  --prefix=/usr \
83  --libdir=/usr/lib${LIBDIRSUFFIX} \
84  --sysconfdir=/etc \
85  --localstatedir=/var \
86  --mandir=/usr/man \
87  --infodir=/usr/info \
88  --docdir=/usr/doc/util-linux-$VERSION \
89  --disable-static \
90  --enable-agetty \
91  --disable-eject \
92  --enable-kill \
93  --disable-last \
94  --enable-line \
95  --enable-mesg \
96  --enable-partx \
97  --enable-raw \
98  --enable-rename \
99  --enable-reset \
100  --disable-login \
101  --enable-schedutils \
102  --enable-wall \
103  --enable-write \
104  --enable-use-tty-group \
105  --enable-libblkid \
106  --enable-libmount \
107  --enable-libuuid \
108  --disable-uuidd \
109  --with-python=2 \
110  --without-readline \
111  --build=$ARCH-slackware-linux \
112  || exit 1
113
114# UNUSED, but maybe needed if we enable readline here:
115#
116# Yet another project that doesn't seem to get that -readline requires either
117# -ltermcap or -lncurses on systems that don't make assumptions...
118#sed -i -e 's|-lreadline|\0 -lncursesw|g' Makefile
119
120make $NUMBJOBS || make || exit 1
121make install DESTDIR=$PKG || make install DESTDIR=$PKG
122
123# Remove all overlap with the shadow package, since --disable-login doesn't quite do that:
124rm $PKG/bin/su $PKG/sbin/nologin $PKG/usr/man/man8/nologin.8 $PKG/sbin/sulogin $PKG/usr/man/man8/sulogin.8
125
126# Move the libblkid, libfdisk, libmount, libsmartcols, and
127# libuuid libraries to /lib${LIBSUFFIX}:
128mkdir -p $PKG/lib${LIBDIRSUFFIX}
129( cd $PKG/usr/lib${LIBDIRSUFFIX}
130  mv libblkid.so.1* $PKG/lib${LIBDIRSUFFIX}
131  mv libfdisk.so.1* $PKG/lib${LIBDIRSUFFIX}
132  mv libmount.so.1* $PKG/lib${LIBDIRSUFFIX}
133  mv libsmartcols.so.1* $PKG/lib${LIBDIRSUFFIX}
134  mv libuuid.so.1* $PKG/lib${LIBDIRSUFFIX}
135  rm -f libblkid.so libfdisk.so libmount.so libsmartcols.so libuuid.so
136  ln -sf ../../lib${LIBDIRSUFFIX}/libblkid.so.1 libblkid.so
137  ln -sf ../../lib${LIBDIRSUFFIX}/libfdisk.so.1 libfdisk.so
138  ln -sf ../../lib${LIBDIRSUFFIX}/libmount.so.1 libmount.so
139  ln -sf ../../lib${LIBDIRSUFFIX}/libsmartcols.so.1 libsmartcols.so
140  ln -sf ../../lib${LIBDIRSUFFIX}/libuuid.so.1 libuuid.so
141)
142
143# Moving things around that have been in the same place
144# for 15 years is, IMHO, not a wise idea AT ALL.
145# If this had to be moved, some place out of /usr might
146# have shown a grain of insight...
147if [ -r $PKG/usr/sbin/fdformat ]; then
148  mkdir -p $PKG/usr/bin
149  mv $PKG/usr/sbin/fdformat $PKG/usr/bin/fdformat
150  # Now since stuff will start looking in this new place,
151  # we have no choice but to link these:
152  ( cd $PKG/usr/sbin
153    ln -sf ../bin/fdformat .
154  )
155fi
156
157# ddate.{1,c} taken from https://github.com/bo0ts/ddate:
158cp -a $CWD/ddate.? .
159cc -O -o ddate ddate.c
160cp -a ddate $PKG/usr/bin
161cat ddate.1 > $PKG/usr/man/man1/ddate.1
162chown root:root $PKG/usr/bin/ddate
163
164# Build ziptool
165cd $TMP || exit 1
166rm -rf ziptool-$ZIPTOOLVERS
167tar xvf $CWD/ziptool-$ZIPTOOLVERS.tar.xz || exit 1
168cd ziptool-$ZIPTOOLVERS || exit 1
169zcat $CWD/ziptool-fix_build.patch.gz | patch -p1 || exit 1
170mkdir scsi
171cat $CWD/scsi_ioctl.h > scsi/scsi_ioctl.h
172chown -R root:root .
173make || exit 1
174strip ziptool
175cat ziptool > $PKG/sbin/ziptool
176chmod 0755 $PKG/sbin/ziptool
177mkdir -p $PKG/usr/doc/ziptool-$ZIPTOOLVERS
178cp -a README $PKG/usr/doc/ziptool-$ZIPTOOLVERS
179chmod 644 $PKG/usr/doc/ziptool-$ZIPTOOLVERS/*
180cat ziptool.1.gz > $PKG/usr/man/man1/ziptool.1.gz
181
182# Build bsdstrings
183cd $TMP || exit 1
184rm -rf bsdstrings
185tar xvf $CWD/bsdstrings.tar.gz || exit 1
186cd bsdstrings || exit 1
187zcat $CWD/bsdstrings-util-linux_overflow.diff.gz | patch -p1 --verbose || exit 1
188make || exit 1
189strip strings
190cat strings > $PKG/usr/bin/strings
191chmod 0755 $PKG/usr/bin/strings
192cat strings.1 | gzip -9c > $PKG/usr/man/man1/strings.1.gz
193
194# Add just the hostname utilities from net-tools, so that anyone
195# installing just the A series will not have a hostname (null):
196cd $TMP || exit 1
197rm -rf net-tools-1.60.20120726git
198tar xvf $CWD/net-tools-1.60.20120726git.tar.xz
199cd net-tools-1.60.20120726git
200zcat $CWD/net-tools.config.h.gz > config.h
201make
202make hostname
203strip hostname
204cat hostname > $PKG/bin/hostname
205chmod 755 $PKG/bin/hostname
206chown root:root $PKG/bin/hostname
207( cd $PKG/bin
208  ln -sf hostname dnsdomainname
209  ln -sf hostname nisdomainname
210  ln -sf hostname ypdomainname
211  ln -sf hostname domainname
212)
213cd man/en_US
214for page in hostname.1 dnsdomainname.1 nisdomainname.1 ypdomainname.1 \
215domainname.1 ; do
216  cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz
217done
218
219# Build adjtimex
220cd $TMP || exit 1
221rm -rf adjtimex-$ADJTIMEXVERS
222tar xvf $CWD/adjtimex_${ADJTIMEXVERS}.orig.tar.gz || exit 1
223cd adjtimex-$ADJTIMEXVERS || exit 1
224chown -R root:root .
225zcat $CWD/adjtimex_1.29-2.2.diff.gz | patch -p1 || exit 1
226CFLAGS=-O2 ./configure --prefix=/usr || exit 1
227make || exit 1
228strip adjtimex
229cat adjtimex > $PKG/sbin/adjtimex
230chmod 0755 $PKG/sbin/adjtimex
231cat adjtimex.8 | gzip -9c > $PKG/usr/man/man8/adjtimex.8.gz
232mkdir -p $PKG/usr/doc/adjtimex-$ADJTIMEXVERS
233cp -a COPYING COPYRIGHT README README.ru adjtimex.lsm \
234  $PKG/usr/doc/adjtimex-$ADJTIMEXVERS
235
236# Build setserial
237cd $TMP || exit 1
238rm -rf setserial-$SETSERIALVERS
239tar xvf $CWD/setserial-$SETSERIALVERS.tar.gz || exit 1
240cd setserial-$SETSERIALVERS || exit 1
241chown -R root:root .
242zcat $CWD/setserial-rc.serial.diff.gz | patch -E -p1 --verbose || exit 1
243zcat $CWD/setserial-undef_TIOCGHAYESESP.diff.gz | patch -E -p1 --verbose || exit 1
244# The original config.{guess,sub} do not work on x86_64
245#cp -p /usr/share/libtool/config/config.{guess,sub} .
246./configure --prefix=/usr || exit 1
247make || exit 1
248strip setserial
249cat setserial > $PKG/sbin/setserial
250chmod 0755 $PKG/sbin/setserial
251mkdir -p $PKG/etc/rc.d
252cat rc.serial > $PKG/etc/rc.d/rc.serial.new
253cat serial.conf > $PKG/etc/serial.conf.new
254cat setserial.8 | gzip -9c > $PKG/usr/man/man8/setserial.8.gz
255
256# These have always traditionally been available before /usr
257# might be mounted:
258( cd $PKG/usr/bin
259  mv getopt $PKG/bin
260  cd $PKG/usr/bin
261  ln -s ../../bin/getopt .
262  #ln -s ../../bin/setterm .
263)
264
265cd $TMP/util-linux-$VERSION # Go back home :)
266
267# Now let's add some important symlinks :)
268( cd $PKG/sbin
269  ln -s ../bin/mount .
270  ln -s ../bin/umount .
271  ln -s ziptool jaztool
272  ln -s hwclock clock
273  cd $PKG/usr/sbin
274  ln -s ../../sbin/cfdisk .
275  ln -s ../../sbin/ctrlaltdel .
276  ln -s ../../sbin/sfdisk .
277  cd $PKG/usr/bin
278  ln -s ../sbin/readprofile .
279  # tunelp was removed by upstream:
280  #ln -s ../sbin/tunelp .
281  ln -s ../../bin/more .
282  ln -s ../../sbin/raw .
283  cd $PKG/usr/man/man1
284  ln -s ziptool.1 jaztool.1
285  cd $PKG/usr/man/man8
286  ln -s hwclock.8 clock.8
287)
288
289find $PKG | xargs file | grep -e "executable" -e "shared object" \
290  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
291
292# Compress and if needed symlink the man pages:
293if [ -d $PKG/usr/man ]; then
294  ( cd $PKG/usr/man
295    for manpagedir in $(find . -type d -name "man*") ; do
296      ( cd $manpagedir
297        for eachpage in $( find . -type l -maxdepth 1) ; do
298          ln -s $( readlink $eachpage ).gz $eachpage.gz
299          rm $eachpage
300        done
301        gzip -9 *.?
302      )
303    done
304  )
305fi
306
307# Compress info page and remove dir file
308#rm $PKG/usr/info/dir
309#gzip -9 $PKG/usr/info/*
310
311mkdir -p $PKG/usr/doc/util-linux-$VERSION
312cp -a AUTHORS COPYING NEWS README* \
313  $PKG/usr/doc/util-linux-$VERSION
314
315mkdir $PKG/install
316cat $CWD/slack-desc > $PKG/install/slack-desc
317zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
318
319cd $PKG
320/sbin/makepkg -l y -c n $TMP/util-linux-$VERSION-$ARCH-$BUILD.txz
321
Note: See TracBrowser for help on using the repository browser.