#!/bin/bash # Slackware build script for bin2iso # Original written by Hunter Sezen. # Modified and now maintained by B. Watson . # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # 20240829 bkw: # - new maintainer. # - fix VERSION: it was "19b", for version 1.9b. # - use a non-slackware.uk download URL, since it sucks to keep the # original and the backup (sbosrcarch) on the same server. # - use a tarball that includes upstream's readme. # - fix a couple of compiler warnings. # - use a homepage that actually works. # - mention CD images in README and slack-desc. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=bin2iso VERSION=${VERSION:-1.9b} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} # 20240829 bkw: no tags in the github repo, use the one and only # commit tarball. COMMIT=${COMMIT:-a08f6f93b833878dc009fe59da072643f06a7830} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" else SLKCFLAGS="-O2" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$COMMIT tar xvf $CWD/$PRGNAM-$COMMIT.tar.gz --wildcards '*/*.txt' '*/src/linux_macos/*.c' cd $PRGNAM-$COMMIT chown -R root:root . find . -type f -exec chmod 644 {} + -o -type d -exec chmod 755 {} + # 20240829 bkw: Fix a couple of warnings, the ones we get *without* -Wall. # One of these constitutes an actual bug, but it only affects files that # aren't an even number of CD sectors (premature EOF; the last sector was # supposed to be zero-filled, but it used == instead of = for assignment). # Not gonna worry about the -Wall ones for now. patch -p1 < $CWD/fixwarnings.diff # 20240829 bkw: WALL=yes for my own use. [ "${WALL:-no}" = "yes" ] && SLKCFLAGS+=" -Wall" # 20240829 bkw: -Wl,-s builds stripped binaries. mkdir -p $PKG/usr/bin ${CC:-cc} $SLKCFLAGS -Wl,-s -o $PKG/usr/bin/$PRGNAM src/linux_macos/*.c PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKGDOC cp -a README.txt $PKGDOC cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE