-
Notifications
You must be signed in to change notification settings - Fork 6
/
makeall
executable file
·157 lines (137 loc) · 5.5 KB
/
makeall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash
#
#©K. D. Hedger. Tue 31 Jul 13:33:01 BST 2018 keithdhedger@gmail.com
#
#This file (makeall) is part of LFSDesktopProject.
#
#LFSDesktopProject is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#at your option) any later version.
#
#LFSDesktopProject is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with LFSDesktopProject. If not, see <http://www.gnu.org/licenses/>.
#
#
#Debug stuff
#CPPFLAGS="-Wunused -Wunreachable-code -Werror -ffunction-sections -fdata-sections -Wno-error=int-to-pointer-cast -Wno-error=sign-compare -Wno-error=unused-function -Wno-error=write-strings" LDFLAGS=" -Wl,--gc-sections,--print-gc-sections " ./configure --prefix=/usr
#CPPFLAGS="-Wunused -Wunreachable-code -Werror -ffunction-sections -fdata-sections -Wno-error=int-to-pointer-cast" LDFLAGS=" -Wl,--gc-sections,--print-gc-sections " ./configure --prefix=/usr
#make 2>&1|grep -i "Removing unused section"|grep -i "/src/"
#
action="$@"
RED='\e[0;31m'
GREEN='\e[0;32m'
BLACK='\e[0;30m'
BLUE='\e[0;34m'
NORMAL="\e[0;0m"
MAKEFLAGS=${MAKEFLAGS:-"-j$(($(nproc)-1))"}
export MAKEFLAGS
export PATH
BUILDOLDWM=0
CWD=$(pwd)
ONERROR=true
unset CFLAGS CXXFLAGS
if [ $BUILDOLDWM -eq 1 ];then
BUILDLFSWMANAGER="LFSWManager"
else
BUILDLFSWMANAGER=""
fi
#Set this to your own user name
CHANGEUSER=${CHANGEUSER:-$(logname)}
#Set this if needed.
LIBDIRSUFFIX=64
BUILDFOR=${BUILDFOR:-"LFSToolKit $BUILDLFSWMANAGER LFSWM2 LFSDesktop LFSSetWallpaper LFSApplications LFSPanel LFSDock"}
COLMAKE="make $MAKEFLAGS|GREP_COLORS='mt=1;32' grep -P --line-buffered --color=always '(\-D[^ ]*)'|GREP_COLORS='mt=1;37;41' grep -P --line-buffered --color=always '^[^ ]*'|GREP_COLORS='mt=1;33' grep -P --line-buffered --color=always '([[:alnum:]_/\.]+?(\.c+|\..p+|\.h)\b)'|GREP_COLORS='mt=1;36' grep -P --line-buffered --color=always -- '\s-(I|L)/.*?\s'|sed G"
runCommand ()
{
echo -e "${RED}Running $1 in ${GREEN}$app${RED} ... ${NORMAL}"
eval "$1"||$ONERROR
}
help ()
{
echo "Usage:"
echo " makeall OPTION"
echo
echo "OPTIONS:"
echo -e "${RED}distcleanup${NORMAL}\n\trun 'make distclean' on all project folders"
echo -e "${RED}cleanup\n\t${NORMAL}run 'make clean' on all project folders"
echo -e "${RED}uninstall\n\t${NORMAL}run 'make distclean;./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make uninstall' on all project folders"
echo -e "${RED}deploy\n\t${NORMAL}run 'make distclean;./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make $MAKEFLAGS;make install' on all project folders"
echo -e "${RED}deploytest\n\t${NORMAL}run 'make distclean;./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make $MAKEFLAGS;make install DESTDIR=/tmp/lfsdesktop-deploy' on all project folders"
echo -e "${RED}makeit\n\t${NORMAL}run './autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX};make $MAKEFLAGS' on all project folders"
echo -e "${RED}makelocal\n\t${NORMAL}run './autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} on LFSToolkit and\nCFLAGS=\"-Wfatal-errors -I/media/LinuxData/Development/Projects/LFSDesktopProject/LFSToolKit/LFSToolKit/lfstk -L/media/LinuxData/Development/Projects/LFSDesktopProject/LFSToolKit/LFSToolKit/app/.libs\" CXXFLAGS=\"\$CFLAGS\" ./configure --prefix=/usr;make $MAKEFLAGS' on all ther project folders"
echo -e "${RED}ownit\n\t${NORMAL}run 'chown -vR $CHANGEUSER:$CHANGEUSER .;find -mindepth 1 -exec touch {} ;' on all project folders"
}
distcleanup ()
{
runCommand "make distclean"
}
cleanup ()
{
runCommand "make clean"||true
}
uninstall ()
{
runCommand "make distclean"||true
runCommand "./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX}"
runCommand "make uninstall"
}
deploy ()
{
runCommand "make distclean"||true
runCommand "./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX}"
runCommand "$COLMAKE"
runCommand "make install --output-sync"
}
deploytest ()
{
runCommand "make distclean"||true
runCommand "./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX}"
runCommand "$COLMAKE"
runCommand "make install DESTDIR=/tmp/lfsdesktop-deploy --output-sync"
}
makeit ()
{
runCommand "./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX}"
runCommand "$COLMAKE"
}
makelocal ()
{
unset CFLAGS CXXFLAGS
if [[ "$(basename "$(pwd)")" = "LFSToolKit" ]];then
runCommand "./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX}"
else
ONERROR=false
CFLAGS="-O0 -g -Wfatal-errors -I${CWD}/LFSToolKit/LFSToolKit/lfstk/ -L${CWD}/LFSToolKit/LFSToolKit/app/.libs"
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS
runCommand "./autogen.sh --prefix=/usr"
fi
runCommand "$COLMAKE"
}
ownit ()
{
echo -e "${RED}Owning and touching files in ${GREEN}$(basename $(pwd))${RED} ... ${NORMAL}"
runCommand "chown -vR $CHANGEUSER:$CHANGEUSER ."
runCommand "find -mindepth 1 -exec touch {} ;"
}
if [[ $action = "help" ]];then
help
exit
fi
#for app in "LFSToolKit" $BUILDLFSWMANAGER "LFSWM2" "LFSDesktop" "LFSSetWallpaper" "LFSApplications" "LFSPanel" "LFSDock"
if [ $1 = "uninstall" ];then
BUILDFOR="$BUILDLFSWMANAGER LFSWM2 LFSDesktop LFSSetWallpaper LFSApplications LFSPanel LFSDock LFSToolKit"
fi
for app in $BUILDFOR
do
pushd $app
echo -e "${RED}Running $action in ${GREEN}$app${RED} ... ${NORMAL}"
$action
popd
done