-
Notifications
You must be signed in to change notification settings - Fork 21
/
configure
executable file
·242 lines (226 loc) · 9.98 KB
/
configure
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/bin/sh
rm -f src/*.o src/*.mk src/custom.h src/evilvte.h src/install.sh src/uninstall.sh
DO_CAT=cat
DO_ECHO=echo
prefix="/usr/local"
CONF_FILE="src/config.h"
for opt do
case "$opt" in
--with-gtk=*) with_gtk=`echo $opt | cut -d '=' -f 2`
;;
--quiet) DO_CAT=true
DO_ECHO=true
;;
--prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
;;
--config=*) CONF_FILE=`echo $opt | cut -d '=' -f 2`
;;
-h | "-?" | --help | --config | --prefix | --quiet=* | --with-gtk)
echo
echo " Options: --prefix=/usr/local (default)"
echo " --prefix=/usr"
echo
echo " --config=src/config.h (default)"
echo ' --config=$HOME/.config/evilvte/config.h'
echo
echo " --with-gtk=2.0 (default)"
echo " --with-gtk=3.0"
echo " --with-gtk=3+2"
exec echo
;;
*)
$DO_ECHO
$DO_ECHO Option '"'$opt'"' is not supported yet. | sed 's/=.* is/" is/'
;;
esac
done
if [ ! -e $CONF_FILE ] || [ -d $CONF_FILE ]; then
$DO_ECHO
$DO_ECHO "[1m[31mWARNING:[m parsing error: $CONF_FILE"
HOME_ERR=`echo $CONF_FILE | grep '~'`
if [ "$HOME_ERR" != "" ]; then
$DO_ECHO ' Please do not use "~".'
else
$DO_ECHO " Please make sure your configuration file is correct."
fi
exec $DO_ECHO
fi
PROG=`grep PROGRAM_NAME $CONF_FILE | sed -e 's/\t/ /g' -e 's/^\( \)*//g' | grep -v ^\/\/ | tail -n 1 | cut -d '"' -f 2`
[ "$PROG" = "" ] && PROG=evilvte
SUSE_LD=`ld -v 2>&1 | tr A-Z a-z | grep suse`
[ "$SUSE_LD" != "" ] && echo \#define DEF_TAB_LABEL >> src/config.mk
ARCH_UNAME=`uname -a | grep -- '-ARCH '`
[ "$ARCH_UNAME" != "" ] && echo \#define DEF_TAB_LABEL >> src/config.mk
real_gtk=$with_gtk
if [ "$with_gtk" != "2.0" ] && [ "$with_gtk" != "3.0" ]; then
with_gtk=2.0
VTEINC=`pkg-config --cflags vte 2> /dev/null`
if [ $? != 0 ]; then
VTEINC=`pkg-config --cflags vte-2.90 2> /dev/null`
[ $? = 0 ] && with_gtk=3.0
fi
fi
[ "$real_gtk" = "3+2" ] && with_gtk=3.0
[ "$real_gtk" = "dev" ] && with_gtk=3.0
if [ "$with_gtk" = "2.0" ]; then
VTEINC=`pkg-config --cflags vte 2> /dev/null`
[ $? != 0 ] && exec pkg-config --cflags vte
LIBS_VTE="-lgdk-x11-2.0 -lgtk-x11-2.0 -lvte"
LIBS_VTE_L=`pkg-config --libs-only-L vte 2> /dev/null`
ln -sf gtk2.c src/evilvte.c
fi
if [ "$with_gtk" = "3.0" ]; then
VTEINC=`pkg-config --cflags vte-2.90 2> /dev/null`
[ $? != 0 ] && exec pkg-config --cflags vte-2.90
LIBS_VTE="-lgdk-3 -lgtk-3 -lvte2_90"
LIBS_VTE_L=`pkg-config --libs-only-L vte-2.90 2> /dev/null`
ln -sf gtk3.c src/evilvte.c
fi
if [ "$real_gtk" = "3+2" ]; then
real_gtk="all"
LIBS_VTE="-ldl"
ln -sf dlopen.c src/evilvte.c
fi
[ "$real_gtk" = "dev" ] && ln -sf gtk3dev.c src/evilvte.c
$DO_ECHO
[ "$SUSE_LD" != "" ] && $DO_ECHO "OS :" [1m[33mSUSE[m
[ "$ARCH_UNAME" != "" ] && $DO_ECHO "OS :" [1m[33mArch Linux[m
[ "$with_gtk" = "2.0" ] && $DO_ECHO "VTE :" [1m[33m`pkg-config --modversion vte`[m
[ "$with_gtk" = "3.0" ] && $DO_ECHO "VTE :" [1m[33m`pkg-config --modversion vte-2.90`[m
$DO_ECHO "GTK+ :" [1m[33m`pkg-config --modversion gtk+-$with_gtk`[m
$DO_ECHO Prefix: [1m[33m$prefix[m
$DO_ECHO -n "Configuration: "
DEFINE_LINES=`cat $CONF_FILE | tr '\t' ' ' | tr -s ' ' ' ' | sed -e 's/^ //' -e 's~/\*~\n~g' | grep ^\#define | wc -l`
if [ "$DEFINE_LINES" = "0" ]; then
$DO_ECHO [1m[31mDisable everything.[m
else
$DO_ECHO
fi
$DO_CAT $CONF_FILE | tr '\t' ' ' | tr -s ' ' ' ' | sed -e 's/^ //' -e 's~/\*~\n~g' | grep ^\#define | grep -v \*\/ | \
sed -e 's/$/[m/' \
-e 's/"/[1m[32m"/' \
-e 's/ 0/[1m[32m 0/' \
-e 's/ 1/[1m[32m 1/' \
-e 's/ 2/[1m[32m 2/' \
-e 's/ 3/[1m[32m 3/' \
-e 's/ 4/[1m[32m 4/' \
-e 's/ 5/[1m[32m 5/' \
-e 's/ 6/[1m[32m 6/' \
-e 's/ 7/[1m[32m 7/' \
-e 's/ 8/[1m[32m 8/' \
-e 's/ 9/[1m[32m 9/' \
-e 's/TRUE/[1m[32mTRUE/' \
-e 's/FALSE/[1m[31mFALSE/' \
-e 's/ AUTO/[1m[32m AUTO/' \
-e 's/ ERASE_TTY/[1m[32m ERASE_TTY/' \
-e 's/ BLOCK/[1m[32m BLOCK/' \
-e 's/ IBEAM/[1m[32m IBEAM/' \
-e 's/ UNDERLINE/[1m[32m UNDERLINE/' \
-e 's/ BACKSPACE/[1m[32m BACKSPACE/g' \
-e 's/BACKSPACE_KEY/[mBACKSPACE_KEY/' \
-e 's/ DELETE/[1m[32m DELETE/g' \
-e 's/DELETE_KEY/[mDELETE_KEY/' \
-e 's/ LINUX/[1m[32m LINUX/' \
-e 's/ RXVT/[1m[32m RXVT/' \
-e 's/ TANGO/[1m[32m TANGO/' \
-e 's/ XTERM/[1m[32m XTERM/' \
-e 's/ ZENBURN/[1m[32m ZENBURN/' \
-e 's/ g_/[1m[32m g_/' \
-e 's/ RIGHT/[1m[32m RIGHT/' \
-e 's/ LEFT/[1m[32m LEFT/' \
-e 's/ OFF_R/[1m[32m OFF_R/' \
-e 's/ OFF_L/[1m[32m OFF_L/' \
-e 's/ TOP/[1m[32m TOP/' \
-e 's/ BOTTOM/[1m[32m BOTTOM/' \
-e 's/ ALT(/[1m[32m ALT(/' \
-e 's/ ALT_SHIFT(/[1m[32m ALT_SHIFT(/' \
-e 's/ CTRL(/[1m[32m CTRL(/' \
-e 's/ CTRL_ALT(/[1m[32m CTRL_ALT(/' \
-e 's/ CTRL_ALT_SHIFT(/[1m[32m CTRL_ALT_SHIFT(/' \
-e 's/ CTRL_SHIFT(/[1m[32m CTRL_SHIFT(/' \
-e 's/ SHIFT(/[1m[32m SHIFT(/'
$DO_ECHO
$DO_ECHO Please edit [1m[33m$CONF_FILE[m to customize your options.
$DO_ECHO
bindir=$prefix/bin
mandir=$prefix/share/man/man1
deskdir=$prefix/share/applications
ICON_DIR=$prefix/share/pixmaps
THEME_DIR=$prefix/share/icons
GNOME_DEF_APP=$prefix/share/gnome-control-center/default-apps
PROGRAM_VERSION=`head -n 1 ChangeLog`
echo "VTEINC=$VTEINC" >> src/config.mk
# sed -i 's/-pthread//' src/config.mk
echo "LIBS_VTE=$LIBS_VTE" >> src/config.mk
echo "LIBS_VTE_L=$LIBS_VTE_L" >> src/config.mk
echo "prefix=$prefix" >> src/config.mk
echo "bindir=\$(DESTDIR)$bindir" >> src/config.mk
echo "mandir=\$(DESTDIR)$mandir" >> src/config.mk
echo "deskdir=\$(DESTDIR)$deskdir" >> src/config.mk
echo \#define ICON_DIR '"'$ICON_DIR'"' >> src/config.mk
echo "ICON_DIR_INSTALL=\$(DESTDIR)$ICON_DIR" >> src/config.mk
echo "THEME_DIR=\$(DESTDIR)$THEME_DIR" >> src/config.mk
echo "GNOME_DEF_APP=\$(DESTDIR)$GNOME_DEF_APP" >> src/config.mk
echo "PROG=$PROG" >> src/config.mk
echo \#ifndef PROGRAM_VERSION >> src/config.mk
echo \#define PROGRAM_VERSION '"'$PROGRAM_VERSION'"' >> src/config.mk
echo \#endif >> src/config.mk
[ "$real_gtk" = "all" ] && echo \#define RULE_THEM_ALL >> src/config.mk
echo "CONF_FILE=$CONF_FILE" >> src/config.mk
head -n 1 $0 > src/uninstall.sh
echo "set -x" >> src/uninstall.sh
echo "rm -f $bindir/$PROG" >> src/uninstall.sh
echo "rm -f $bindir/showvte" >> src/uninstall.sh
echo "rmdir $bindir 2> /dev/null" >> src/uninstall.sh
echo "rm -f $deskdir/evilvte.desktop" >> src/uninstall.sh
echo "rmdir $deskdir 2> /dev/null" >> src/uninstall.sh
echo "rm -f $GNOME_DEF_APP/evilvte.xml" >> src/uninstall.sh
echo "rmdir $GNOME_DEF_APP 2> /dev/null" >> src/uninstall.sh
echo "rmdir $prefix/share/gnome-control-center 2> /dev/null" >> src/uninstall.sh
echo "rm -f $mandir/evilvte.1" >> src/uninstall.sh
echo "rm -f $mandir/showvte.1" >> src/uninstall.sh
echo "rmdir $mandir 2> /dev/null" >> src/uninstall.sh
echo "rmdir $prefix/share/man 2> /dev/null" >> src/uninstall.sh
echo "rm -f $ICON_DIR/evilvte.png" >> src/uninstall.sh
echo "rmdir $ICON_DIR 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/16x16/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/16x16/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/16x16 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/20x20/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/20x20/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/20x20 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/22x22/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/22x22/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/22x22 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/24x24/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/24x24/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/24x24 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/32x32/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/32x32/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/32x32 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/36x36/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/36x36/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/36x36 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/40x40/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/40x40/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/40x40 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/48x48/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/48x48/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/48x48 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/64x64/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/64x64/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/64x64 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/72x72/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/72x72/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/72x72 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/96x96/apps/evilvte.png" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/96x96/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/96x96 2> /dev/null" >> src/uninstall.sh
echo "rm -f $THEME_DIR/hicolor/scalable/apps/evilvte.svg" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/scalable/apps 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor/scalable 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR/hicolor 2> /dev/null" >> src/uninstall.sh
echo "rmdir $THEME_DIR 2> /dev/null" >> src/uninstall.sh
echo "rmdir $prefix/share 2> /dev/null" >> src/uninstall.sh
echo "rmdir $prefix 2> /dev/null" >> src/uninstall.sh
echo "true" >> src/uninstall.sh