add fvwm3
[slackbuilds.git] / fvwm3 / fvwm3.SlackBuild
blob81b2ab4afe2b08aa112f35c839ad33317ac9c935
1 #!/bin/bash
3 # Slackware build script for fvwm3
5 # Copyright 2020-2024, Alexander Verbovetsky, Moscow, Russia
6 # Copyright 2024, K. Eugene Carlson, Tsukuba, Japan
7 # All rights reserved.
9 # Redistribution and use of this script, with or without modification, is
10 # permitted provided that the following conditions are met:
12 # 1. Redistributions of this script must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
16 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 cd $(dirname $0) ; CWD=$(pwd)
28 PRGNAM=fvwm3
29 VERSION=${VERSION:-1.1.1}
30 BUILD=${BUILD:-1}
31 TAG=${TAG:-_SBo}
32 PKGTYPE=${PKGTYPE:-tgz}
34 if [ -z "$ARCH" ]; then
35 case "$( uname -m )" in
36 i?86) ARCH=i586 ;;
37 arm*) ARCH=arm ;;
38 *) ARCH=$( uname -m ) ;;
39 esac
42 if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
43 echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
44 exit 0
47 TMP=${TMP:-/tmp/SBo}
48 PKG=$TMP/package-$PRGNAM
49 OUTPUT=${OUTPUT:-/tmp}
51 if [ "$ARCH" = "i586" ]; then
52 SLKCFLAGS="-O2 -march=i586 -mtune=i686"
53 LIBDIRSUFFIX=""
54 elif [ "$ARCH" = "i686" ]; then
55 SLKCFLAGS="-O2 -march=i686 -mtune=i686"
56 LIBDIRSUFFIX=""
57 elif [ "$ARCH" = "x86_64" ]; then
58 SLKCFLAGS="-O2 -fPIC"
59 LIBDIRSUFFIX="64"
60 else
61 SLKCFLAGS="-O2"
62 LIBDIRSUFFIX=""
65 set -e
67 rm -rf $PKG
68 mkdir -p $TMP $PKG $OUTPUT
69 cd $TMP
70 rm -rf $PRGNAM-$VERSION
71 tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
72 cd $PRGNAM-$VERSION
74 # rename perl libraries to avoid collisions with the stock fvwm
75 # borrowed from ALT Linux
76 # https://git.altlinux.org/gears/f/fvwm3.git?a=blob_plain;f=0001-rename-perl-fvwm.patch
77 #zcat $CWD/0001-rename-perl-fvwm.patch.gz | patch -p2
78 # fix references to renamed man pages and binaries
79 #zcat $CWD/renamed-items.patch.gz | patch -p0
81 chown -R root:root .
82 find -L . \
83 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
84 -o -perm 511 \) -exec chmod 755 {} \; -o \
85 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
86 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
88 OSNAME="$(awk -F= '/^ID=/{print $2}' /etc/os-release)"
90 ./autogen.sh
91 CFLAGS="$SLKCFLAGS" \
92 CXXFLAGS="$SLKCFLAGS" \
93 ./configure \
94 --prefix=/usr \
95 --libdir=/usr/lib${LIBDIRSUFFIX} \
96 --sysconfdir=/etc \
97 --localstatedir=/var \
98 --mandir=/usr/man \
99 --enable-mandoc \
100 --docdir=/usr/doc/$PRGNAM-$VERSION \
101 --enable-golang \
102 --program-prefix= \
103 --program-suffix= \
104 --program-transform-name='/vwm[^3]/ s/vwm/vwm3/' \
105 --build=$ARCH-$OSNAME-linux
107 make
108 make install DESTDIR=$PKG
110 rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
112 zcat $CWD/startfvwm3.gz > $PKG/usr/bin/startfvwm3
113 chmod 755 $PKG/usr/bin/startfvwm3
115 mkdir -p $PKG/etc/X11/xinit
116 zcat $CWD/xinitrc.fvwm3.gz > $PKG/etc/X11/xinit/xinitrc.fvwm3
117 chmod 755 $PKG/etc/X11/xinit/xinitrc.fvwm3
119 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
120 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
122 find $PKG/usr/man -type f -exec gzip -9 {} \;
123 for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
125 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
126 cp -a CHANGELOG.md COPYING NEWS README.md $PKG/usr/doc/$PRGNAM-$VERSION
127 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
129 mkdir -p $PKG/install
130 cat $CWD/slack-desc > $PKG/install/slack-desc
132 cd $PKG
133 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE