desktop/gnome-icon-theme: New maintainer, noarch, speed up build.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2024-08-21 15:17:10 -04:00 committed by Willy Sudiarto Raharjo
parent 1ae74a6dcc
commit cde36b311e
No known key found for this signature in database
GPG key ID: 3F617144D7238786
4 changed files with 111 additions and 124 deletions

View file

@ -1,2 +1,4 @@
gnome-icon-theme (default icons used by GTK+)
The default icon theme used by the GNOME desktop. Some themes still use
this as a fallback, for example Tango.

View file

@ -0,0 +1,39 @@
#!/usr/bin/perl -w
# 20240821 bkw: Find symlinks. Call from a SlackBuild, after 'cd $PKG'
# and before 'makepkg'. Call as "perl $CWD/findsymlinks.pl >> install/doinst.sh".
# Do not expect this script's +x bit to be set; it won't be.
# For each symlink, print a pair of doinst.sh lines, then remove the symlink.
# This happens *many* times faster than makepkg's make_install_script()
# function, especially when there are thousands of symlinks. The output
# is (or should be) identical to the lines makepkg would add to doinst.sh.
# Feel free to use this in your own SlackBuilds. It has been
# thoroughly tested with gnome-icon-theme. If you run into problems
# with it, please email me at urchlay@slackware.uk so I can fix it.
use File::Find;
sub wanted { # dead or aliiive!
return unless -l $_; # only care about symlinks.
$found{join("/", $File::Find::dir, $_)} = [$File::Find::dir, $_];
}
find(\&wanted, ("."));
# since makepkg sorts the symlinks, we will too.
for(sort keys %found) {
my $dir = substr($found{$_}[0], 2); # remove leading ./
my $target = $found{$_}[1];
my $src = readlink($_);
for my $name ($dir, $src, $target) {
# escape special chars; regex comes from makepkg itself, but with
# ] and } added. \x27 is a single-quote, BTW.
$name =~ s,[] "#\$\&\x27()*;<>?[\\`{}|~],\\$&,g;
}
print "( cd $dir ; rm -rf $target )\n( cd $dir ; ln -sf $src $target )\n";
unlink $_;
}

View file

@ -2,46 +2,39 @@
# Slackware build script for gnome-icon-theme
# Copyright 2023 Petar Petrov slackalaxy@gmail.com
# Using Slackware 14.1 SlackBuild as a guide...
# 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.
# Originally written by Petar Petrov.
# Modified and now maintained by B. Watson <urchlay@slackware.uk>.
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20240821 bkw: BUILD=2
# - ARCH=noarch.
# - extract tarballs to a top-level dir, for easier cleanup.
# - factor repeated code into functions (makes the script shorter).
# - --disable-nls, to avoid creating 103 empty LC_MESSAGES/ dirs
# in /usr/share/locale. There's nothing to translate here.
# Oddly, configure complains:
# configure: WARNING: unrecognized options: --disable-nls
# ...but it actually works anyway (no /usr/share/locale installed).
# - funky doinst.sh creation and link removal. speed the build
# up 2.26x (was 2m20s, now 1m2s, on my test box).
# - add 'install_sh=/bin/install' to make command, which further
# cuts the time from 1m2s to 33s (4.24x as fast as the original).
# No idea why configure checks for the install command, then doesn't
# use it instead of the shipped (and much slower) install-sh script.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=gnome-icon-theme
VERSION=${VERSION:-3.12.0}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch
EXTRAS=$PRGNAM-extras
SYMBOL=$PRGNAM-symbolic
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
@ -51,119 +44,72 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
rm -rf $EXTRAS-$VERSION
rm -rf $SYMBOL-$VERSION
# 20240820 bkw: put everything in a top-level dir.
rm -rf $PRGNAM-build
mkdir -p $PRGNAM-build
cd $PRGNAM-build
TOPDIR=$( pwd )
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
tar xvf $CWD/$EXTRAS-$VERSION.tar.xz
tar xvf $CWD/$SYMBOL-$VERSION.tar.xz
# 20240821 bkw: --disable-dependency-tracking doesn't speed it up at all.
build() {
cd $TOPDIR
tar xvf $CWD/$1-$VERSION.tar.xz
cd $1-$VERSION
cd $TMP/$PRGNAM-$VERSION
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 {} \;
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 {} \+
[ "$2" != "" ] && patch -p1 < $2
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--enable-icon-mapping \
--disable-nls \
--localstatedir=/var/lib
make
make install DESTDIR=$PKG
make all install DESTDIR=$PKG install_sh=/bin/install
}
cd $TMP/$EXTRAS-$VERSION
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 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--enable-icon-mapping \
--localstatedir=/var/lib
make
make install DESTDIR=$PKG
cd $TMP/$SYMBOL-$VERSION
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 {} \;
# Same fix as in Slackware 14.1, updated for 3.12
patch -p1 -i $CWD/fix_gits_configure.patch
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--enable-icon-mapping \
--localstatedir=/var/lib
make
make install DESTDIR=$PKG
rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
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
build $PRGNAM
build $EXTRAS
build $SYMBOL $CWD/fix_gits_configure.patch
# As in the original SlackBuild, we don't want icon caches:
find $PKG/usr/share/icons -type f -name "icon-theme.cache" -exec rm -f {} \+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/{extras,symbolic}
cp -a \
$TMP/$PRGNAM-$VERSION/{AUTHORS,COPYING,NEWS,README} \
$PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
$TMP/$EXTRAS-$VERSION/{AUTHORS,COPYING,NEWS,README} \
$PKG/usr/doc/$PRGNAM-$VERSION/extras
cp -a $TMP/$SYMBOL-$VERSION/{AUTHORS,COPYING,NEWS,README} \
$PKG/usr/doc/$PRGNAM-$VERSION/symbolic
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cd $TOPDIR
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
install_doc() {
mkdir -p $PKGDOC/$2
cp -a $1-$VERSION/{AUTHORS,COPYING,NEWS,README} $PKGDOC/$2
}
install_doc $PRGNAM
install_doc $EXTRAS extras
install_doc $SYMBOL symbolic
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
# makepkg's "find symlinks and create doinst.sh" phase is painfully slow,
# especially when there are thousands of symlinks (this package has 3846
# of them).
# This perl script does the same job, *many* times faster. Like, less
# than 0.1 sec, compared to makepkg taking over a minute.
perl $CWD/findsymlinks.pl >> $PKG/install/doinst.sh
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View file

@ -2,13 +2,13 @@ PRGNAM="gnome-icon-theme"
VERSION="3.12.0"
HOMEPAGE="https://download.gnome.org"
DOWNLOAD="https://download.gnome.org/sources/gnome-icon-theme/3.12/gnome-icon-theme-3.12.0.tar.xz \
https://download.gnome.org/sources/gnome-icon-theme-extras/3.12/gnome-icon-theme-extras-3.12.0.tar.xz \
https://download.gnome.org/sources/gnome-icon-theme-symbolic/3.12/gnome-icon-theme-symbolic-3.12.0.tar.xz"
https://download.gnome.org/sources/gnome-icon-theme-extras/3.12/gnome-icon-theme-extras-3.12.0.tar.xz \
https://download.gnome.org/sources/gnome-icon-theme-symbolic/3.12/gnome-icon-theme-symbolic-3.12.0.tar.xz"
MD5SUM="f14bed7f804e843189ffa7021141addd \
91f8f7e35a3d8d926716d88b8b1e9a29 \
3c9c0e6b9fa04b3cbbb84da825a26fd9"
91f8f7e35a3d8d926716d88b8b1e9a29 \
3c9c0e6b9fa04b3cbbb84da825a26fd9"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Petar Petrov"
EMAIL="slackalaxy@gmail.com"
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"