-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-xfce4-git.sh
executable file
·213 lines (187 loc) · 5.61 KB
/
build-xfce4-git.sh
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/bin/bash
# Docs URL http://docs.xfce.org/xfce/building
SRC_URL="https://github.com/xfce-mirror"
TMP=/tmp/build_xfce4
PKGS="$TMP"/packages
PACKAGES=/var/log/packages
SLKCFLAGS="-O3 -fPIC -ffast-math -march=native"
XFCE="xfce4-dev-tools libxfce4util xfconf libxfce4ui garcon exo xfce4-panel tumbler thunar xfce4-settings xfce4-session xfwm4 xfdesktop xfce4-appfinder thunar-volman xfce4-power-manager parole xfce4-pulseaudio-plugin xfce4-notifyd xfce4-screenshooter xfce4-taskmanager xfce4-volumed-pulse xfce4-systemload-plugin xfce4-clipman-plugin xfce4-weather-plugin xfce4-xkb-plugin thunar-media-tags-plugin xfce4-sensors-plugin xfce4-mount-plugin xfce4-diskperf-plugin"
## comes with Slackware:
WITH_SLACK="Thunar exo garcon gtk-xfce-engine libxfce4ui libxfce4util orage xfwm4 thunar-volman tumbler xfce4-appfinder xfce4-clipman-plugin xfce4-dev-tools xfce4-notifyd xfce4-panel xfce4-power-manager xfce4-pulseaudio-plugin xfce4-screenshooter xfce4-session xfce4-settings xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal xfce4-weather-plugin xfconf xfdesktop"
HELP="Options:
$0 -b | --build - Builds and install XFCE4 base and extra apps in a specific order.
$0 -u | --uninstall - Removes all packages.
"
SECONDS=0
uninstall_packages ()
{
printf "Removing installed packages.\\n"
for package in $XFCE $WITH_SLACK
do
if is_installed "$package"
then
printf "Removing package %s.\\n" "$package"
/sbin/removepkg "$package" &> /dev/null
fi
done
}
get_all_source ()
{
cd $TMP || exit 1
for APP in $XFCE
do
if [[ ! -d "$APP" ]]
then
git clone "${SRC_URL}/${APP}" || exit 1
else
cd "$APP" || exit 1
printf "Using cloned repo of %s after re-pulling master.\\n" "$APP"
make clean &> /dev/null
git checkout master &> /dev/null
git pull &> /dev/null
cd ..
fi
done
}
init ()
{
if [[ ! -d "$PKGS" ]]
then
mkdir -p "$PKGS"
fi
cd "$PKGS" || exit 1
cd "$TMP" || exit 1
}
is_installed ()
{
if ls $PACKAGES/"${1}"* &> /dev/null
then
return 0
else
return 1
fi
}
fix_perm ()
{
cd "$1" || exit 1
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
}
striper ()
{
cd "$1" || exit 1
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
}
mans ()
{
cd "$1" || exit 1
if [[ -d usr/man ]]
then
cd usr/man || exit
for manpagedir in $(find . -type d -name "man*")
do
cd "$manpagedir" || exit 1
for eachpage in $( find . -type l -maxdepth 1)
do
ln -s "$( readlink "$eachpage" )".gz "$eachpage".gz
rm "$eachpage"
done
gzip -f -9 ./*.?
done
fi
}
build_packages ()
{
cd "$TMP" || exit 1
printf "Now working on %s.\\n" "$1"
cd "$1" || exit 1
fix_perm "$(pwd)"
make clean
CFLAGS=$SLKCFLAGS \
./autogen.sh \
--prefix=/usr \
--libdir=/usr/lib64 \
--mandir=/usr/man \
--enable-gtk-doc \
--docdir=/usr/doc/"$1"-git \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-shared=yes \
--enable-gtk3 \
--enable-libnotify \
--enable-keybinder \
--enable-pluggable-dialogs \
--enable-sound-settings \
--enable-libxklavier \
--enable-xrandr \
--enable-xcursor \
--enable-gio-unix \
--enable-notifications \
--enable-thunarx \
--enable-exif \
--enable-pcre \
--enable-dbus \
--enable-gudev \
--with-mixer-command=pavucontrol \
--disable-static \
--disable-debug \
--with-vendor-info=Slackware \
--build=x86_64-slackware-linux || exit 1
printf "Building %s.\\n" "$1"
make || exit 1
PKG="$TMP/package-$1"
rm -rf "$PKG"
mkdir -p "$PKG"
printf "Creating a package for %s.\\n" "$1"
make install DESTDIR="$PKG" || exit 1
mkdir -p "$PKG/usr/doc/$1-git" || exit 1
cp -a \
AUTHORS BUGS COMPOSITOR COPYING* FAQ HACKING INSTALL NEWS NOTES README* THANKS TODO ChangeLog \
"$PKG/usr/doc/$1-git" 2> /dev/null
striper "$PKG"
mans "$PKG"
find "$PKG/usr/share/icons" -type f -name "icon-theme.cache" -exec rm -f {} \; 2> /dev/null
cd "$PKG" || exit 1
FINAL="$TMP/$1-git-x86_64-1_cmyster.txz"
/sbin/makepkg -l y -c n "$FINAL" || exit 1
printf "Installing %s.\\n" "$1"
/sbin/installpkg "$FINAL" || exit 1
mv "$FINAL" "$PKGS"
printf "\n\nDone working on %s.\n\n" "$1"
}
build_all ()
{
uninstall_packages
get_all_source
for component in $XFCE
do
build_packages "$component" xfce
done
libtool --finish /usr/lib64/ &> /dev/null
printf "Done.\nIt took %s minutes and %s seconds to build it all.\n" "$(( SECONDS / 60 ))" "$(( SECONDS % 60 ))"
}
case "$1" in
--build)
init
build_all
;;
-b)
init
build_all
;;
--list)
init
list_installed
;;
-l)
init
list_installed
;;
--uninstall) uninstall_packages ;;
-u) uninstall_packages ;;
*) printf "%s" "$HELP" && exit 0 ;;
esac