121 lines
3.7 KiB
Bash
121 lines
3.7 KiB
Bash
#!/bin/bash
|
|
|
|
# Slackware build script for Wiimms ISO Tools
|
|
#
|
|
# Copyright 2010-2011 Marco Bonetti <sid77@slackware.it>
|
|
# Copyright 2015, 2018-2019 Hunter Sezen California, USA
|
|
# Copyright 2024 B. Watson
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use of this script, with or without modification, is
|
|
# permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# 20220209 bkw: Modified by SlackBuilds.org: fix build on 15.0.
|
|
|
|
# 20240902 bkw:
|
|
# - new maintainer.
|
|
# - update for v3.05a.
|
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
PRGNAM=wiimms-iso-tools
|
|
VERSION=${VERSION:-3.05a}
|
|
COMMIT=${COMMIT:-fc1c0b840cb3ac41ca6e4f1d5e16da12b47eab58}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_SBo}
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
|
|
|
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 -eu
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
cd $TMP
|
|
rm -rf $PRGNAM-$COMMIT
|
|
tar xvf $CWD/$PRGNAM-$COMMIT.tar.gz
|
|
cd $PRGNAM-$COMMIT
|
|
chown -R root:root .
|
|
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
|
|
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
|
|
|
|
cd project
|
|
|
|
# 20240902 bkw: do not rebuild everything on 'make install', after
|
|
# 'make' has been run.
|
|
sed -i '/^install:/s,: *all,:,' Makefile
|
|
|
|
# 20220209 bkw: I need to see the compile/link commands!
|
|
sed -i 's,@\$(CC),$(CC),g' Makefile
|
|
|
|
# 20220209 bkw: overriding in the environment or as make args just
|
|
# wasn't working, so I nuked it from orbit. It's the only way to be sure.
|
|
sed -i "s|-O3|$SLKCFLAGS|" Makefile test-libwbfs/Makefile
|
|
|
|
# 20240902 bkw: big pain in my ass: no DESTDIR support, and the
|
|
# scripts templates.sed install.sh get the install paths baked-in
|
|
# when I run 'make'. So using a different INSTALL_PATH and INSTBIN in
|
|
# the 'make install' command has no effect, and the executables end up
|
|
# with the /tmp/SBo/... path baked into them. This solution works and
|
|
# isn't too hard to understand:
|
|
make INSTALL_PATH=/usr INSTBIN=/usr/bin
|
|
make -B templates.sed install.sh INSTALL_PATH=$PKG/usr INSTBIN=$PKG/usr/bin
|
|
|
|
# 20240902 bkw: binaries already stripped.
|
|
make install
|
|
|
|
# 20240902 bkw: replace hard links with symlinks.
|
|
for i in cat dump; do
|
|
rm -f $PKG/usr/bin/wdf-$i
|
|
ln -s wdf $PKG/usr/bin/wdf-$i
|
|
done
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp -a gpl-2.0.txt $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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
|