slackbuilds/_unmaintained/y/steam/SlackBuild
Gwenhael Le Moine 406fa29927
archive steam
2024-02-08 14:55:31 +01:00

146 lines
5.3 KiB
Bash
Executable file

#!/bin/bash
# Slackware build script for steam
# Copyright 2016 Talos Thoren
# All rights reserved.
# Copyright 2019,20 Christoph Willing, Brisbane, Australia
# Copyright 2020 Gwenhael Le Moine
# 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.
CWD=$(pwd)
PRGNAM=$(basename $CWD)
#VERSION=${VERSION:-1.0.0.63}
BRANCH=${BRANCH:-beta} # stable ; beta
BUILD=${BUILD:-1}
TAG=${TAG:-gwh}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
mkdir -p $REPOSITORY
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf ${PRGNAM}-launcher
[ -e $REPOSITORY/steam_latest-$BRANCH.tar.gz ] && rm $REPOSITORY/steam_latest-$BRANCH.tar.gz
wget -c https://repo.steampowered.com/steam/archive/precise/steam_latest-$BRANCH.tar.gz -O $REPOSITORY/steam_latest-$BRANCH.tar.gz
tar xvf $REPOSITORY/steam_latest-$BRANCH.tar.gz
cd ${PRGNAM}-launcher
VERSION=$(cat client-versions.json | grep -o "[0-9.]*" | sed 'N;s/\n/_/')
# Use Slackware-specific installation directories
patch -p0 < $CWD/patch-slackdirs.diff
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# alienBOB's trick for unfound system apps
sed -i -e '\/usr\/bin\/env\ bash/{N;s#$#\nexport PATH="/usr/lib/steam/local:$PATH"\n#}' bin_steam.sh
mkdir -p $PKG/usr/lib/steam/local
ln -sf /sbin/pidof $PKG/usr/lib/steam/local/pidof
ln -sf /sbin/lspci $PKG/usr/lib/steam/local/lspci
sed -i -e "s/distribution.\\\n/distribution.\\\n Actually, don't worry - this is Slackware\!\\\n\\\n/" bin_steamdeps.py
make install DESTDIR=$PKG VERSION=$VERSION
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/lib/udev/rules.d
install -p -m 0644 subprojects/steam-devices/*.rules $PKG/lib/udev/rules.d/
sed -i -e 's/^KERNEL=="uinput".*/& GROUP="plugdev"/' $PKG/lib/udev/rules.d/60-steam-input.rules
mkdir -p $PKG/usr/doc/$PRGNAM
cp subprojects/steam-devices/LICENSE $PKG/usr/doc/$PRGNAM/
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
steam: steam (digital distribution)
steam:
steam: Steam is an internet-based digital distribution, digital rights
steam: management, multiplayer, and social networking platform developed by
steam: Valve Corporation.
steam: Steam provides the user with installation and automatic updating of
steam: games on multiple computers, and community features such as friends
steam: lists and groups, cloud saving, and in-game voice and chat
steam: functionality.
steam:
steam: Project URL: http://store.steampowered.com
EOF
cat <<EOF > $PKG/install/doinst.sh
# Update the desktop database:
if [ -x usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database usr/share/applications > /dev/null 2>&1
fi
# Update hicolor theme cache:
if [ -d usr/share/icons/hicolor ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor 1> /dev/null 2> /dev/null
fi
fi
# Update the mime database:
if [ -x usr/bin/update-mime-database ]; then
/usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
fi
# Reload the udev rules to include our newly installed steam rules
if [ -x /sbin/udevadm ]; then
/sbin/udevadm control --reload
fi
EOF
cd $PKG
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}