[c5c522c] | 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 | |
---|
| 25 | VERSION=${VERSION:-$(echo util-linux*.tar.xz | cut -d - -f 3 | rev | cut -f 3- -d . | rev)} |
---|
| 26 | BUILD=${BUILD:-1} |
---|
| 27 | |
---|
| 28 | ADJTIMEXVERS=1.29 |
---|
| 29 | SETSERIALVERS=2.17 |
---|
| 30 | ZIPTOOLVERS=1.4.0 |
---|
| 31 | |
---|
| 32 | NUMJOBS=${--j8} |
---|
| 33 | |
---|
| 34 | # Automatically determine the architecture we're building on: |
---|
| 35 | if [ -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 |
---|
| 42 | fi |
---|
| 43 | |
---|
| 44 | if [ "$ARCH" = "i586" ]; then |
---|
| 45 | SLKCFLAGS="-O2 -march=i586 -mtune=i686" |
---|
| 46 | LIBDIRSUFFIX="" |
---|
| 47 | elif [ "$ARCH" = "s390" ]; then |
---|
| 48 | SLKCFLAGS="-O2" |
---|
| 49 | LIBDIRSUFFIX="" |
---|
| 50 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 51 | SLKCFLAGS="-O2 -fPIC" |
---|
| 52 | LIBDIRSUFFIX="64" |
---|
| 53 | else |
---|
| 54 | SLKCFLAGS="-O2" |
---|
| 55 | LIBDIRSUFFIX="" |
---|
| 56 | fi |
---|
| 57 | |
---|
| 58 | CWD=$(pwd) |
---|
| 59 | TMP=${TMP:-/tmp} |
---|
| 60 | PKG=$TMP/package-util-linux |
---|
| 61 | |
---|
| 62 | rm -rf $PKG |
---|
| 63 | mkdir -p $TMP $PKG |
---|
| 64 | cd $TMP || exit 1 |
---|
| 65 | rm -rf util-linux-$VERSION |
---|
| 66 | tar xvf $CWD/util-linux-$VERSION.tar.xz || exit 1 |
---|
| 67 | cd util-linux-$VERSION || exit 1 |
---|
| 68 | chown -R root.root . |
---|
| 69 | find . \ |
---|
| 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": |
---|
| 78 | zcat $CWD/util-linux.fdisk-no-solaris.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 79 | |
---|
| 80 | CFLAGS="$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 | |
---|
| 120 | make $NUMBJOBS || make || exit 1 |
---|
| 121 | make install DESTDIR=$PKG || make install DESTDIR=$PKG |
---|
| 122 | |
---|
| 123 | # Remove all overlap with the shadow package, since --disable-login doesn't quite do that: |
---|
| 124 | rm $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}: |
---|
| 128 | mkdir -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... |
---|
| 147 | if [ -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 | ) |
---|
| 155 | fi |
---|
| 156 | |
---|
| 157 | # ddate.{1,c} taken from https://github.com/bo0ts/ddate: |
---|
| 158 | cp -a $CWD/ddate.? . |
---|
| 159 | cc -O -o ddate ddate.c |
---|
| 160 | cp -a ddate $PKG/usr/bin |
---|
| 161 | cat ddate.1 > $PKG/usr/man/man1/ddate.1 |
---|
| 162 | chown root:root $PKG/usr/bin/ddate |
---|
| 163 | |
---|
| 164 | # Build ziptool |
---|
| 165 | cd $TMP || exit 1 |
---|
| 166 | rm -rf ziptool-$ZIPTOOLVERS |
---|
| 167 | tar xvf $CWD/ziptool-$ZIPTOOLVERS.tar.xz || exit 1 |
---|
| 168 | cd ziptool-$ZIPTOOLVERS || exit 1 |
---|
| 169 | zcat $CWD/ziptool-fix_build.patch.gz | patch -p1 || exit 1 |
---|
| 170 | mkdir scsi |
---|
| 171 | cat $CWD/scsi_ioctl.h > scsi/scsi_ioctl.h |
---|
| 172 | chown -R root:root . |
---|
| 173 | make || exit 1 |
---|
| 174 | strip ziptool |
---|
| 175 | cat ziptool > $PKG/sbin/ziptool |
---|
| 176 | chmod 0755 $PKG/sbin/ziptool |
---|
| 177 | mkdir -p $PKG/usr/doc/ziptool-$ZIPTOOLVERS |
---|
| 178 | cp -a README $PKG/usr/doc/ziptool-$ZIPTOOLVERS |
---|
| 179 | chmod 644 $PKG/usr/doc/ziptool-$ZIPTOOLVERS/* |
---|
| 180 | cat ziptool.1.gz > $PKG/usr/man/man1/ziptool.1.gz |
---|
| 181 | |
---|
| 182 | # Build bsdstrings |
---|
| 183 | cd $TMP || exit 1 |
---|
| 184 | rm -rf bsdstrings |
---|
| 185 | tar xvf $CWD/bsdstrings.tar.gz || exit 1 |
---|
| 186 | cd bsdstrings || exit 1 |
---|
| 187 | zcat $CWD/bsdstrings-util-linux_overflow.diff.gz | patch -p1 --verbose || exit 1 |
---|
| 188 | make || exit 1 |
---|
| 189 | strip strings |
---|
| 190 | cat strings > $PKG/usr/bin/strings |
---|
| 191 | chmod 0755 $PKG/usr/bin/strings |
---|
| 192 | cat 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): |
---|
| 196 | cd $TMP || exit 1 |
---|
| 197 | rm -rf net-tools-1.60.20120726git |
---|
| 198 | tar xvf $CWD/net-tools-1.60.20120726git.tar.xz |
---|
| 199 | cd net-tools-1.60.20120726git |
---|
| 200 | zcat $CWD/net-tools.config.h.gz > config.h |
---|
| 201 | make |
---|
| 202 | make hostname |
---|
| 203 | strip hostname |
---|
| 204 | cat hostname > $PKG/bin/hostname |
---|
| 205 | chmod 755 $PKG/bin/hostname |
---|
| 206 | chown 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 | ) |
---|
| 213 | cd man/en_US |
---|
| 214 | for page in hostname.1 dnsdomainname.1 nisdomainname.1 ypdomainname.1 \ |
---|
| 215 | domainname.1 ; do |
---|
| 216 | cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz |
---|
| 217 | done |
---|
| 218 | |
---|
| 219 | # Build adjtimex |
---|
| 220 | cd $TMP || exit 1 |
---|
| 221 | rm -rf adjtimex-$ADJTIMEXVERS |
---|
| 222 | tar xvf $CWD/adjtimex_${ADJTIMEXVERS}.orig.tar.gz || exit 1 |
---|
| 223 | cd adjtimex-$ADJTIMEXVERS || exit 1 |
---|
| 224 | chown -R root:root . |
---|
| 225 | zcat $CWD/adjtimex_1.29-2.2.diff.gz | patch -p1 || exit 1 |
---|
| 226 | CFLAGS=-O2 ./configure --prefix=/usr || exit 1 |
---|
| 227 | make || exit 1 |
---|
| 228 | strip adjtimex |
---|
| 229 | cat adjtimex > $PKG/sbin/adjtimex |
---|
| 230 | chmod 0755 $PKG/sbin/adjtimex |
---|
| 231 | cat adjtimex.8 | gzip -9c > $PKG/usr/man/man8/adjtimex.8.gz |
---|
| 232 | mkdir -p $PKG/usr/doc/adjtimex-$ADJTIMEXVERS |
---|
| 233 | cp -a COPYING COPYRIGHT README README.ru adjtimex.lsm \ |
---|
| 234 | $PKG/usr/doc/adjtimex-$ADJTIMEXVERS |
---|
| 235 | |
---|
| 236 | # Build setserial |
---|
| 237 | cd $TMP || exit 1 |
---|
| 238 | rm -rf setserial-$SETSERIALVERS |
---|
| 239 | tar xvf $CWD/setserial-$SETSERIALVERS.tar.gz || exit 1 |
---|
| 240 | cd setserial-$SETSERIALVERS || exit 1 |
---|
| 241 | chown -R root:root . |
---|
| 242 | zcat $CWD/setserial-rc.serial.diff.gz | patch -E -p1 --verbose || exit 1 |
---|
| 243 | zcat $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 |
---|
| 247 | make || exit 1 |
---|
| 248 | strip setserial |
---|
| 249 | cat setserial > $PKG/sbin/setserial |
---|
| 250 | chmod 0755 $PKG/sbin/setserial |
---|
| 251 | mkdir -p $PKG/etc/rc.d |
---|
| 252 | cat rc.serial > $PKG/etc/rc.d/rc.serial.new |
---|
| 253 | cat serial.conf > $PKG/etc/serial.conf.new |
---|
| 254 | cat 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 | |
---|
| 265 | cd $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 | |
---|
| 289 | find $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: |
---|
| 293 | if [ -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 | ) |
---|
| 305 | fi |
---|
| 306 | |
---|
| 307 | # Compress info page and remove dir file |
---|
| 308 | #rm $PKG/usr/info/dir |
---|
| 309 | #gzip -9 $PKG/usr/info/* |
---|
| 310 | |
---|
| 311 | mkdir -p $PKG/usr/doc/util-linux-$VERSION |
---|
| 312 | cp -a AUTHORS COPYING NEWS README* \ |
---|
| 313 | $PKG/usr/doc/util-linux-$VERSION |
---|
| 314 | |
---|
| 315 | mkdir $PKG/install |
---|
| 316 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 317 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
| 318 | |
---|
| 319 | cd $PKG |
---|
| 320 | /sbin/makepkg -l y -c n $TMP/util-linux-$VERSION-$ARCH-$BUILD.txz |
---|
| 321 | |
---|