2 # Copyright 2020 Danilo 'danix' Macrì < danix@danix.xyz >
5 # Redistribution and use of this script, with or without modification, is
6 # permitted provided that the following conditions are met:
8 # 1. Redistributions of this script must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
11 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
14 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
19 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
20 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 # Adapted from the lxqt modular build from Eric Hameleers <alien@slackware.com>
24 ### Run this script as lxqt.SlackBuild <program> to build the pkg "program"
28 # Set initial variables:
31 BUILD_DIR
=${BUILD_DIR:-$TMP/lxqt-build}
33 # some useful functions
36 [ -z "$target_dir" ] && target_dir
='.'
38 chown
-R root
:root
$target_dir
40 \
( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \
) \
41 -exec chmod 755 {} \
; -o \
42 \
( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \
) \
48 [ -z "$target_dir" ] && target_dir
='.'
50 find $target_dir |
xargs file |
grep "executable" |
grep ELF | cut
-f 1 -d : |
xargs strip
--strip-unneeded 2> /dev
/null
51 find $target_dir |
xargs file |
grep "shared object" |
grep ELF | cut
-f 1 -d : |
xargs strip
--strip-unneeded 2> /dev
/null
52 find $target_dir |
xargs file |
grep "current ar archive" |
grep ELF | cut
-f 1 -d : |
xargs strip
-g 2> /dev
/null
56 # Compress and if needed symlink the man pages:
57 if [ -d usr
/man
]; then
59 for manpagedir
in $
(find .
-type d
-name "man*") ; do
61 for eachpage
in $
( find .
-type l
-maxdepth 1) ; do
62 ln -s $
( readlink
$eachpage ).gz
$eachpage.gz
65 gzip -9 *.
* ||
{ touch ${BUILD_DIR}/${PROGRAM}.failed ; continue ; }
72 process_info_pages
() {
73 # Compress info pages and purge "dir" file from the package:
74 if [ -d usr
/info
]; then
83 # If there are docs, move them:
84 if [ -d usr
/share
/doc
]; then
86 mv usr
/share
/doc
/* usr
/doc
93 if [[ $PROGRAM == 'libfm-extra' ]]; then
96 VERSION
=${VERSION:-0.16.0}
97 PKG
="$BUILD_DIR/package-${PROGRAM}"
99 # Import the build configuration options for as far as they are not already set:
100 [ -r .
/lxqt.options
] && . .
/lxqt.options
102 # This avoids compiling a version number into LXQT's .la files:
103 QTDIR
=/usr
/lib
${LIBDIRSUFFIX}/qt
; export QTDIR
105 # Reset $PKGARCH to its initial value:
107 # Perhaps $PKGARCH should be something different:
108 if grep -wq "^${PROGRAM}$" ${CWD}/noarch
; then
112 rm -rf "$PKG" "$TMP/${PROGRAM}-$VERSION"
115 cp -R ${CWD}/src/${SOURCE} $TMP/${PROGRAM}-$VERSION
116 cd "${PROGRAM}"-$VERSION
120 # If any patches are needed, call this script to apply them:
121 if [ -r $CWD/patch
/${PROGRAM}.
patch ]; then
122 .
$CWD/patch
/${PROGRAM}.
patch ||
exit 1
125 # Check autotools builds before continuing with cmake programs
126 if [ -r $CWD/autotools
/${PROGRAM} ]; then
127 echo "sourcing autotools settings for $PROGRAM"
128 .
$CWD/autotools
/${PROGRAM}
130 if [ -r $CWD/cmake
/${PROGRAM} ]; then
131 echo "sourcing cmake settings for $PROGRAM"
132 .
$CWD/cmake
/${PROGRAM}
134 # This is the default configure script:
135 echo "setting generic cmake for $PROGRAM"
140 make $NUMJOBS ||
make ||
exit 1
141 make install DESTDIR
=$PKG ||
exit 1
143 # Get rid of zero-length junk files:
144 find $PKG/usr
/doc
/${PROGRAM}-$VERSION -type f -size 0 -exec rm --verbose "{}" \; || { touch ${BUILD_DIR}/${PROGRAM}.failed ; continue ; }
145 rmdir --verbose $PKG/usr
/doc
/${PROGRAM}-$VERSION 2> /dev/null || { touch ${BUILD_DIR}/${PROGRAM}.failed ; continue ; }
148 strip_binaries ||
{ touch ${BUILD_DIR}/${PROGRAM}.failed ; continue ; }
150 # If there's any special post-install things to do, do them:
151 if [ -r $CWD/post-install
/${PROGRAM}.post-install
]; then
152 .
$CWD/post-install
/${PROGRAM}.post-install
155 # If this package requires some doinst.sh material, add it here:
156 if [ -r $CWD/doinst.sh
/${PROGRAM} ]; then
157 mkdir
-p $PKG/install
158 cat $CWD/doinst.sh
/${PROGRAM} \
159 |
sed -e "s#usr/lib#usr/lib${LIBDIRSUFFIX}#g" \
160 >> $PKG/install
/doinst.sh
167 mkdir
-p $PKG/install
168 if [ -r $CWD/slack-desc
/${PROGRAM} ]; then
169 cat $CWD/slack-desc
/${PROGRAM} > $PKG/install
/slack-desc
171 touch $PKG/install
/slack-desc-missing
174 /sbin
/makepkg
-l y
-c n
"$BUILD_DIR/${PROGRAM}-$VERSION-$PKGARCH-$BUILD$TAG.txz"