slackware-current/source/a/bash/bash.SlackBuild
Patrick J Volkerding 1eecf47a49 Fri Oct 4 23:37:01 UTC 2024
a/bash-5.2.037-x86_64-2.txz:  Rebuilt.
  Set a default BASH_LOADABLES_PATH pointing to the bash loadables directory.
  Thanks to Lockywolf.
a/haveged-1.9.19-x86_64-1.txz:  Upgraded.
a/kernel-firmware-20241004_919f79f-noarch-1.txz:  Upgraded.
a/kernel-generic-6.10.13-x86_64-1.txz:  Upgraded.
a/mkinitrd-1.4.11-x86_64-37.txz:  Rebuilt.
  Upgraded to busybox-1.37.0.
d/kernel-headers-6.10.13-x86-1.txz:  Upgraded.
k/kernel-source-6.10.13-noarch-1.txz:  Upgraded.
kde/krita-5.2.6-x86_64-1.txz:  Upgraded.
kde/kstars-3.7.3-x86_64-1.txz:  Upgraded.
kde/pulseaudio-qt-1.6.0-x86_64-1.txz:  Upgraded.
l/gtk4-4.16.3-x86_64-1.txz:  Upgraded.
l/libproxy-0.5.9-x86_64-1.txz:  Upgraded.
l/nodejs-20.18.0-x86_64-1.txz:  Upgraded.
n/dhcpcd-10.1.0-x86_64-1.txz:  Upgraded.
isolinux/initrd.img:  Rebuilt.
kernels/*:  Upgraded.
testing/packages/kernel-generic-6.11.2-x86_64-1.txz:  Upgraded.
testing/packages/kernel-headers-6.11.2-x86-1.txz:  Upgraded.
testing/packages/kernel-source-6.11.2-noarch-1.txz:  Upgraded.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
2024-10-05 03:05:25 +02:00

202 lines
6.2 KiB
Bash
Executable file

#!/bin/bash
# Copyright 2005-2024 Patrick J. Volkerding, Sebeka, Minnesota, USA
# 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.
# Modified 2011, 2012 by Eric Hameleers <alien at slackware.com> for ARM port.
# Set initial variables:
cd $(dirname $0) ; CWD=$(pwd)
if [ "$TMP" = "" ]; then
TMP=/tmp
fi
PKG=$TMP/package-bash
PKGNAM=bash
VERSION=${VERSION:-$(echo bash-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-2}
# Automatically determine the architecture we're building on:
MARCH=$( uname -m )
if [ -z "$ARCH" ]; then
case "$MARCH" in
i?86) export ARCH=i686 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$MARCH ;;
esac
fi
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
if [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=pentium4 -mtune=generic"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -march=x86-64 -mtune=generic -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
case "$ARCH" in
arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
*) TARGET=$ARCH-slackware-linux ;;
esac
if [ ! -d $TMP ]; then
mkdir -p $TMP # location to build the source
fi
rm -rf $PKG
mkdir -p $PKG
# Determine bash patchlevel:
PATCHLEVEL="$( cd $CWD/bash-${VERSION}-patches ; /bin/ls bash5?-??? 2> /dev/null | tail -1 | cut -f 2 -d -)"
if [ "$PATCHLEVEL" = "" ]; then
PATCHLEVEL=000
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PKGNAM-$VERSION.$PATCHLEVEL-$ARCH-$BUILD.txz"
exit 0
fi
cd $TMP
rm -rf bash-$VERSION
tar xvf $CWD/bash-$VERSION.tar.?z || exit 1
cd bash-$VERSION || exit 1
chown -R root:root .
find . -perm 664 | xargs chmod 644
find . -perm 775 | xargs chmod 755
# Fix .so errors in manpages (needed for strict implementations such as mandoc):
zcat $CWD/bash_manpages.patch.gz | patch -p1 --verbose || exit 1
if [ -d $CWD/bash-${VERSION}-patches ]; then
( cd $CWD/bash-${VERSION}-patches ; cat bash5?-??? ) | patch -p0 --verbose || exit 1
fi
# End of preparations
if echo "$*" | grep -qw -- --prep ; then
exit 0
fi
# Reconf due to configure.ac patch:
autoreconf -vif
# The above will generate an error, but it still works...
# Set default BASH_LOADABLES_PATH. Yes, there's -DDEFAULT_BASH_LOADABLES_PATH,
# but good luck getting it to behave.
sed -i "s|/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.|/usr/lib${LIBDIRSUFFIX}/bash|g" config-top.h
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/bash-$VERSION \
--build=$TARGET || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/bin
mv $PKG/usr/bin/bash $PKG/bin/bash5.new
# We don't include the "bashbug" script.
rm -rf $PKG/usr/bin $PKG/usr/man/man1/bashbug.1
# Strip binaries:
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
# Compress and link manpages, if any:
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
for manpagedir in $(find . -type d -name "man*") ; do
( cd $manpagedir
for eachpage in $( find . -type l -maxdepth 1) ; do
ln -s $( readlink $eachpage ).gz $eachpage.gz
rm $eachpage
done
gzip -9 *.?
)
done
)
fi
# bash.1 is already installed by "make install"
( cd doc
for page in builtins.1 rbash.1 ; do
cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz
done
)
# Compress info files, if any:
if [ -d $PKG/usr/info ]; then
( cd $PKG/usr/info
rm -f dir
gzip -9 *
)
fi
mkdir -p $PKG/usr/doc/bash-$VERSION
cp -a AUTHORS CHANGES COMPAT COPYING* INSTALL MANIFEST NEWS NOTES \
README* Y2K doc/FAQ doc/INTRO \
$PKG/usr/doc/bash-$VERSION
( cd doc ; groff -ms -Tascii article.ms > $PKG/usr/doc/bash-$VERSION/article.txt )
# If there's a ChangeLog, installing at least part of the recent history
# is useful, but don't let it get totally out of control:
if [ -r ChangeLog ]; then
DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
touch -r ChangeLog $DOCSDIR/ChangeLog
fi
# If there's a CHANGES file, installing at least part of the recent history
# is useful, but don't let it get totally out of control:
if [ -r CHANGES ]; then
DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
cat CHANGES | head -n 1000 > $DOCSDIR/CHANGES
touch -r CHANGES $DOCSDIR/CHANGES
fi
# If there's a NEWS file, installing at least part of the recent history
# is useful, but don't let it get totally out of control:
if [ -r NEWS ]; then
DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
cat NEWS | head -n 1000 > $DOCSDIR/NEWS
touch -r NEWS $DOCSDIR/NEWS
fi
mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/bash-$VERSION.$PATCHLEVEL-$ARCH-$BUILD.txz