add brightnessctl
[slackbuilds.git] / dwm / dwm.SlackBuild
blob225c496ad7c1aebd5320b6dc9f5279957ed237fa
1 #!/bin/bash
3 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
4 # Version 2, December 2004
6 # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
8 # Everyone is permitted to copy and distribute verbatim or modified
9 # copies of this license document, and changing it is allowed as long
10 # as the name is changed.
12 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
13 # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16 # 0. You just DO WHAT THE FUCK YOU WANT TO.
18 # SlackBuild script for dwm without any patches
19 # =============================================
20 # By: r1w1s1 (https://fosstodon.org/@r1w1s1)
21 # For: dwm
22 # Descr:
23 # URL: https://dwm.suckless.org/
24 # Changelog:
25 # v6.5: 12/july/2024 by r1w1s1 - Initial build.
28 cd "$(dirname "$0")" ; CWD=$(pwd)
30 PRGNAM=dwm
31 VERSION=${VERSION:-6.5}
32 BUILD=${BUILD:-3}
33 TAG=${TAG:-_r1w1s1}
34 PKGTYPE=${PKGTYPE:-tgz}
36 if [ -z "$ARCH" ]; then
37 case "$( uname -m )" in
38 i?86) ARCH=i586 ;;
39 arm*) ARCH=arm ;;
40 *) ARCH=$( uname -m ) ;;
41 esac
44 if [ -n "${PRINT_PACKAGE_NAME}" ]; then
45 echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
46 exit 0
49 TMP=${TMP:-/tmp/SBo}
50 PKG=$TMP/package-$PRGNAM
51 OUTPUT=${OUTPUT:-/tmp}
53 if [ "$ARCH" = "i586" ]; then
54 SLKCFLAGS="-O2 -march=i586 -mtune=i686"
55 LIBDIRSUFFIX=""
56 elif [ "$ARCH" = "i686" ]; then
57 SLKCFLAGS="-O3 -march=pentium4 -mtune=generic"
58 LIBDIRSUFFIX=""
59 elif [ "$ARCH" = "x86_64" ]; then
60 SLKCFLAGS="-O3 -march=x86-64 -mtune=generic -fPIC"
61 LIBDIRSUFFIX="64"
62 else
63 SLKCFLAGS="-O2"
64 LIBDIRSUFFIX=""
67 set -e
69 rm -rf "$PKG"
70 mkdir -p "$TMP" "$PKG" "$OUTPUT"
71 cd "$TMP"
73 #Download and extract the source code
74 rm -rf "${PRGNAM}-${VERSION}"
75 wget -O "${PRGNAM}-${VERSION}.tar.gz" "https://dl.suckless.org/${PRGNAM}/${PRGNAM}-${VERSION}.tar.gz"
76 tar xvf "${PRGNAM}-${VERSION}.tar.gz"
77 cd "${PRGNAM}-${VERSION}"
79 if [ -e "$CWD/config.h" ]; then
80 cp -v "$CWD/config.h" config.def.h
83 # Apply patches if available
84 for patch in "$CWD"/patches/*; do
85 [ -e "$patch" ] || break
86 patch -p1 < "$patch"
87 done
89 #Add systray support
90 #patch -p1 <$CWD/patches/dwm-systray-20230922-9f88553.diff
92 chown -R root:root .
93 find -L . \
94 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
95 -o -perm 511 \) -exec chmod 755 {} \; -o \
96 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
97 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
100 make CFLAGS="SLACKFLAGS" \
101 PREFIX=/usr \
102 MANPREFIX=/usr/man \
103 X11INC=/usr/include \
104 X11LIB=/usr/lib${LIBDIRSUFFIX}/X11
106 make install \
107 PREFIX=/usr \
108 MANPREFIX=/usr/man \
109 X11INC=/usr/include \
110 X11LIB=/usr/lib${LIBDIRSUFFIX}/X11 \
111 DESTDIR="$PKG"
113 install -vDm 0755 "$CWD/xinitrc.dwm" "$PKG/etc/X11/xinit/xinitrc.dwm"
114 strip --strip-unneeded "$PKG/usr/bin/$PRGNAM"
115 gzip -9 $PKG/usr/man/man?/*.?
117 mkdir -p "$PKG/usr/doc/$PRGNAM-$VERSION"
118 cp -a LICENSE README \
119 "$PKG/usr/doc/$PRGNAM-$VERSION"
120 cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild"
122 mkdir -p "$PKG"/install
123 cat "$CWD"/slack-desc > "$PKG"/install/slack-desc
125 cd "$PKG"
126 /sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"