added packages to the prereq list since we are not building them with the global...
[lxqt-slackware.git] / build_all.sh
CommitLineData
73c8ba7d 1#!/bin/bash
2
3# Main script, build all packages in the tree.
4
5set -e
6
7CWD=$(pwd)
8ERROR_LOG=${CWD}/build_error.log
9VERSIONING=${CWD}/versioning
10
11if [ ! -f $VERSIONING ];then
12 echo "NO $VERSIONING FOUND! ABORTING NOW." >> $ERROR_LOG
13 echo -e "file: $VERSIONING NOT found!! Aborting"
14 echo -e "run ${CWD}/GRAB_VERSION.SH to generate the file again."
15 exit 118
16else
17 # We source the versioning file here and use it later
18 . $VERSIONING
19fi
20
21if [ ! -f $ERROR_LOG ];then
22 touch $ERROR_LOG
23fi
24
25SLACKBUILD="$CWD/LXQt.SlackBuild"
26TMP=${TMP:-/tmp}
27BUILD_DIR=${BUILD_DIR:-$TMP/lxqt-build}
28
29check_already_built() {
30 local PKG=$1
31 RESULT=""
32 if [[ -z $(/bin/ls -A ${CWD}/packages) ]];then
33 # packages is empty
34 RESULT=""
35 elif [[ ! $(find ${CWD}/packages/${PKG} -name $PKG* -print > /dev/null 2>&1) ]]; then
36 # packages is not empty but we can't find $1
37 RESULT=""
38 else
39 # we found it
40 RESULT="found"
41 fi
42 return $RESULT
43}
44
45LIST=$(cat ${CWD}/build_order)
46COUNTER=0
47TOTAL=$(wc -l ${CWD}/build_order |cut -d " " -f1)
48for p in $LIST; do
49 let COUNTER=COUNTER+1
50 if [[ $p == 'libfm-extra' ]]; then
51 # libfm-extra doesn't have a source directory but uses libfm as well
52 PKGS=$(find ${CWD}/src -mindepth 1 -maxdepth 1 -type d -name 'libfm' -print)
53 else
54 PKGS=$(find ${CWD}/src -mindepth 1 -maxdepth 1 -type d -name $p -print)
55 fi
56 ALREADY_BUILT=$(check_already_built $p)
57 VNUM=${versions[${p}]}
58 if [[ -e $PKGS && $ALREADY_BUILT != "found" ]];then
59 echo -e "########################################################"
60 echo -e "#\t[$COUNTER / $TOTAL] building $p"
61 echo -e "########################################################"
62 export VERSION=$VNUM
63 ${CWD}/lxqt.SlackBuild $p
64 unset VERSION
65 echo -e "########################################################"
66 echo -e "# done building $p!"
67 echo -e "########################################################"
68 mkdir -p ${CWD}/packages/${p}
69 mv ${BUILD_DIR}/${p}*.txz ${CWD}/packages/${p}/
70 upgradepkg --reinstall --install-new ${CWD}/packages/${p}/${p}*.txz
71 else
72 echo $PKGS not found >> ${ERROR_LOG}
73 fi
74done
75