slackware-current/source/n/bluez/bluez.SlackBuild
Patrick J Volkerding 381482b7fe Mon Sep 9 17:27:00 UTC 2024
ap/stow-2.4.1-x86_64-1.txz:  Upgraded.
l/cairo-1.18.2-x86_64-1.txz:  Upgraded.
l/gc-8.2.8-x86_64-1.txz:  Upgraded.
n/bluez-5.78-x86_64-1.txz:  Upgraded.
n/netatalk-3.2.8-x86_64-1.txz:  Upgraded.
  Bump bundled WolfSSL library to stable version 5.7.2, GitHub #1433.
  For more information, see:
    https://www.cve.org/CVERecord?id=CVE-2024-1544
    https://www.cve.org/CVERecord?id=CVE-2024-5288
    https://www.cve.org/CVERecord?id=CVE-2024-5991
    https://www.cve.org/CVERecord?id=CVE-2024-5814
  (* Security fix *)
x/ibus-m17n-1.4.32-x86_64-1.txz:  Upgraded.
2024-09-09 19:59:46 +02:00

199 lines
6.5 KiB
Bash
Executable file

#!/bin/bash
# Copyright 2009, 2010, 2011, 2012, 2013, 2016, 2018, 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.
cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=bluez
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i686 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
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-$ARCH-$BUILD.txz"
exit 0
fi
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
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $CWD/${PKGNAM}-${VERSION}.tar.?z || exit 1
cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \+
sed -i -e 's|-lreadline|\0 -lncursesw|g' Makefile.{in,tools}
autoreconf -vif
# We're adding --enable-deprecated due to this commit:
#
# commit b1eb2c4cd057624312e0412f6c4be000f7fc3617
#Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
#Date: Wed Jan 4 14:23:58 2017 +0200
#
# build: Hide deprecated tools under --enable-deprecated
#
# This marks the following tools as deprecated as they are not longer
# maintained or have been replaced by other tools:
#
# hciattach hciconfig hcitool hcidump rfcomm sdptool ciptool gatttool
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
LDFLAGS="-L/usr/lib$LIBDIRSUFFIX" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--mandir=/usr/man \
--localstatedir=/var \
--docdir=/usr/doc/${PKGNAM}-${VERSION} \
--enable-library \
--disable-systemd \
--enable-deprecated \
--build=$ARCH-slackware-linux || exit 1
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
# Don't ship .la files:
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
# Use reset=1 for the btusb module, which supposedly fixes reconnect problems:
mkdir -p $PKG/lib/modprobe.d
cp -a $CWD/btusb.conf $PKG/lib/modprobe.d
chown root:root $PKG/lib/modprobe.d/btusb.conf
chmod 644 $PKG/lib/modprobe.d/btusb.conf
# Add bluetoothd to /usr/sbin
mkdir -p $PKG/usr/sbin
ln -s ../libexec/bluetooth/bluetoothd $PKG/usr/sbin
# Move the dbus config file to the system directory (we're replacing it anyway, so this is just in case)
mkdir -p $PKG/usr/share/dbus-1/system.d/
mv $PKG/etc/dbus-1/system.d/* $PKG/usr/share/dbus-1/system.d/
rmdir --parents $PKG/etc/dbus-1/system.d/
# Install the non-systemd service file. Not all sessions run systemd --user
# (actually, the majority don't even on machines using that thing), so the dbus
# daemon must be able to spawn obexd directly, and to do so it needs the full
# path of the daemon.
mkdir -p $PKG/usr/share/dbus-1/services
cp -a $CWD/config/org.bluez.obex.service $PKG/usr/share/dbus-1/services
chown root:root $PKG/usr/share/dbus-1/services/org.bluez.obex.service
chmod 644 $PKG/usr/share/dbus-1/services/org.bluez.obex.service
# Install default options config file:
mkdir -p $PKG/etc/default
cat $CWD/config/defaultconfig > $PKG/etc/default/bluetooth.new
# Add an init script
mkdir -p $PKG/etc/rc.d
cat $CWD/config/rc.bluetooth > $PKG/etc/rc.d/rc.bluetooth.new
# Let's go ahead and let that start by default, unless an existing init
# script is not executable:
chmod 755 $PKG/etc/rc.d/rc.bluetooth.new
# Make the other config files .new:
for config in input.conf main.conf network.conf ; do
mv $PKG/etc/bluetooth/${config} $PKG/etc/bluetooth/${config}.new
done
# If the deprecated utility gatttool was built, go ahead and install it:
if [ -x attrib/gatttool ]; then
cp attrib/gatttool $PKG/usr/bin
chown root:root $PKG/usr/bin/gatttool
chmod 755 $PKG/usr/bin/gatttool
fi
# Compress and if needed symlink the man pages:
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
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a \
AUTHORS COPYING* INSTALL README* TODO \
$PKG/usr/doc/$PKGNAM-$VERSION
# 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/${PKGNAM}-$VERSION)
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
touch -r ChangeLog $DOCSDIR/ChangeLog
fi
mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz