1#!/bin/sh 2 3rm -f src/*.o src/*.mk src/custom.h src/evilvte.h src/install.sh src/uninstall.sh 4 5DO_CAT=cat 6DO_ECHO=echo 7prefix="/usr/local" 8CONF_FILE="src/config.h" 9 10for opt do 11 case "$opt" in 12 --with-gtk=*) with_gtk=`echo $opt | cut -d '=' -f 2` 13 ;; 14 --quiet) DO_CAT=true 15 DO_ECHO=true 16 ;; 17 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` 18 ;; 19 --config=*) CONF_FILE=`echo $opt | cut -d '=' -f 2` 20 ;; 21 -h | "-?" | --help | --config | --prefix | --quiet=* | --with-gtk) 22 echo 23 echo " Options: --prefix=/usr/local (default)" 24 echo " --prefix=/usr" 25 echo 26 echo " --config=src/config.h (default)" 27 echo ' --config=$HOME/.config/evilvte/config.h' 28 echo 29 echo " --with-gtk=2.0 (default)" 30 echo " --with-gtk=3.0" 31 echo " --with-gtk=2+3" 32 echo " --with-gtk=3+2" 33 exec echo 34 ;; 35 *) 36 $DO_ECHO 37 $DO_ECHO Option '"'$opt'"' is not supported yet. | sed 's/=.* is/" is/' 38 ;; 39 esac 40done 41 42if [ ! -e $CONF_FILE ] || [ -d $CONF_FILE ]; then 43 $DO_ECHO 44 $DO_ECHO "[1m[31mWARNING:[m parsing error: $CONF_FILE" 45 HOME_ERR=`echo $CONF_FILE | grep '~'` 46 if [ "$HOME_ERR" != "" ]; then 47 $DO_ECHO ' Please do not use "~".' 48 else 49 $DO_ECHO " Please make sure your configuration file is correct." 50 fi 51 exec $DO_ECHO 52fi 53 54PROG=`grep PROGRAM_NAME $CONF_FILE | sed -e 's/\t/ /g' -e 's/^\( \)*//g' | grep -v ^\/\/ | tail -n 1 | cut -d '"' -f 2` 55[ "$PROG" = "" ] && PROG=evilvte 56 57SUSE_LD=`ld -v 2>&1 | tr A-Z a-z | grep suse` 58[ "$SUSE_LD" != "" ] && echo \#define DEF_TAB_LABEL >> src/config.mk 59 60ARCH_UNAME=`uname -a | grep -- '-ARCH '` 61[ "$ARCH_UNAME" != "" ] && echo \#define DEF_TAB_LABEL >> src/config.mk 62 63real_gtk=$with_gtk 64if [ "$with_gtk" != "2.0" ] && [ "$with_gtk" != "3.0" ]; then 65 with_gtk=2.0 66 VTEINC=`pkg-config --cflags vte 2> /dev/null` 67 if [ $? != 0 ]; then 68 VTEINC=`pkg-config --cflags vte-2.90 2> /dev/null` 69 [ $? = 0 ] && with_gtk=3.0 70 fi 71fi 72 73if [ "$real_gtk" = "3+2" ]; then 74 with_gtk=3.0 75 VTEINC=`pkg-config --cflags vte-2.90 2> /dev/null` 76 if [ $? != 0 ]; then 77 VTEINC=`pkg-config --cflags vte 2> /dev/null` 78 [ $? = 0 ] && with_gtk=2.0 79 fi 80fi 81 82if [ "$with_gtk" = "2.0" ]; then 83 VTEINC=`pkg-config --cflags vte 2> /dev/null` 84 [ $? != 0 ] && exec pkg-config --cflags vte 85 LIBS_VTE="-lgdk-x11-2.0 -lgtk-x11-2.0 -lvte" 86 LIBS_VTE_L=`pkg-config --libs-only-L vte 2> /dev/null` 87fi 88 89if [ "$with_gtk" = "3.0" ]; then 90 VTEINC=`pkg-config --cflags vte-2.90 2> /dev/null` 91 [ $? != 0 ] && exec pkg-config --cflags vte-2.90 92 LIBS_VTE="-lgdk-3 -lgtk-3 -lvte2_90" 93 LIBS_VTE_L=`pkg-config --libs-only-L vte-2.90 2> /dev/null` 94fi 95 96LIBS_VTE="${LIBS_VTE} -lintl" 97 98if [ "$real_gtk" = "2+3" ] || [ "$real_gtk" = "3+2" ]; then 99 real_gtk="all" 100 LIBS_VTE="-ldl" 101fi 102 103 $DO_ECHO 104 [ "$SUSE_LD" != "" ] && $DO_ECHO "OS :" [1m[33mSUSE[m 105 [ "$ARCH_UNAME" != "" ] && $DO_ECHO "OS :" [1m[33mArch Linux[m 106 [ "$with_gtk" = "2.0" ] && $DO_ECHO "VTE :" [1m[33m`pkg-config --modversion vte`[m 107 [ "$with_gtk" = "3.0" ] && $DO_ECHO "VTE :" [1m[33m`pkg-config --modversion vte-2.90`[m 108 $DO_ECHO "GTK+ :" [1m[33m`pkg-config --modversion gtk+-$with_gtk`[m 109 $DO_ECHO Prefix: [1m[33m$prefix[m 110 $DO_ECHO -n "Configuration: " 111 DEFINE_LINES=`cat $CONF_FILE | tr '\t' ' ' | tr -s ' ' ' ' | sed -e 's/^ //' -e 's~/\*~\n~g' | grep ^\#define | wc -l` 112 if [ "$DEFINE_LINES" = "0" ]; then 113 $DO_ECHO [1m[31mDisable everything.[m 114 else 115 $DO_ECHO 116 fi 117 $DO_CAT $CONF_FILE | tr '\t' ' ' | tr -s ' ' ' ' | sed -e 's/^ //' -e 's~/\*~\n~g' | grep ^\#define | grep -v \*\/ | \ 118 sed -e 's/$/[m/' \ 119 -e 's/"/[1m[32m"/' \ 120 -e 's/ 0/[1m[32m 0/' \ 121 -e 's/ 1/[1m[32m 1/' \ 122 -e 's/ 2/[1m[32m 2/' \ 123 -e 's/ 3/[1m[32m 3/' \ 124 -e 's/ 4/[1m[32m 4/' \ 125 -e 's/ 5/[1m[32m 5/' \ 126 -e 's/ 6/[1m[32m 6/' \ 127 -e 's/ 7/[1m[32m 7/' \ 128 -e 's/ 8/[1m[32m 8/' \ 129 -e 's/ 9/[1m[32m 9/' \ 130 -e 's/TRUE/[1m[32mTRUE/' \ 131 -e 's/FALSE/[1m[31mFALSE/' \ 132 -e 's/ AUTO/[1m[32m AUTO/' \ 133 -e 's/ ERASE_TTY/[1m[32m ERASE_TTY/' \ 134 -e 's/ BLOCK/[1m[32m BLOCK/' \ 135 -e 's/ IBEAM/[1m[32m IBEAM/' \ 136 -e 's/ UNDERLINE/[1m[32m UNDERLINE/' \ 137 -e 's/ BACKSPACE/[1m[32m BACKSPACE/g' \ 138 -e 's/BACKSPACE_KEY/[mBACKSPACE_KEY/' \ 139 -e 's/ DELETE/[1m[32m DELETE/g' \ 140 -e 's/DELETE_KEY/[mDELETE_KEY/' \ 141 -e 's/ LINUX/[1m[32m LINUX/' \ 142 -e 's/ RXVT/[1m[32m RXVT/' \ 143 -e 's/ TANGO/[1m[32m TANGO/' \ 144 -e 's/ XTERM/[1m[32m XTERM/' \ 145 -e 's/ ZENBURN/[1m[32m ZENBURN/' \ 146 -e 's/ g_/[1m[32m g_/' \ 147 -e 's/ RIGHT/[1m[32m RIGHT/' \ 148 -e 's/ LEFT/[1m[32m LEFT/' \ 149 -e 's/ OFF_R/[1m[32m OFF_R/' \ 150 -e 's/ OFF_L/[1m[32m OFF_L/' \ 151 -e 's/ TOP/[1m[32m TOP/' \ 152 -e 's/ BOTTOM/[1m[32m BOTTOM/' \ 153 -e 's/ ALT(/[1m[32m ALT(/' \ 154 -e 's/ ALT_SHIFT(/[1m[32m ALT_SHIFT(/' \ 155 -e 's/ CTRL(/[1m[32m CTRL(/' \ 156 -e 's/ CTRL_ALT(/[1m[32m CTRL_ALT(/' \ 157 -e 's/ CTRL_ALT_SHIFT(/[1m[32m CTRL_ALT_SHIFT(/' \ 158 -e 's/ CTRL_SHIFT(/[1m[32m CTRL_SHIFT(/' \ 159 -e 's/ SHIFT(/[1m[32m SHIFT(/' 160 $DO_ECHO 161 $DO_ECHO Please edit [1m[33m$CONF_FILE[m to customize your options. 162 $DO_ECHO 163 164bindir=$prefix/bin 165mandir=$prefix/man/man1 166deskdir=$prefix/share/applications 167ICON_DIR=$prefix/share/pixmaps 168THEME_DIR=$prefix/share/icons 169GNOME_DEF_APP=$prefix/share/gnome-control-center/default-apps 170PROGRAM_VERSION=`head -n 1 ChangeLog` 171 172echo "VTEINC=$VTEINC" >> src/config.mk 173# sed -i 's/-pthread//' src/config.mk 174echo "LIBS_VTE=$LIBS_VTE" >> src/config.mk 175echo "LIBS_VTE_L=$LIBS_VTE_L" >> src/config.mk 176echo "prefix=$prefix" >> src/config.mk 177echo "bindir=\$(DESTDIR)$bindir" >> src/config.mk 178echo "mandir=\$(DESTDIR)$mandir" >> src/config.mk 179echo "deskdir=\$(DESTDIR)$deskdir" >> src/config.mk 180echo \#define ICON_DIR '"'$ICON_DIR'"' >> src/config.mk 181echo "ICON_DIR_INSTALL=\$(DESTDIR)$ICON_DIR" >> src/config.mk 182echo "THEME_DIR=\$(DESTDIR)$THEME_DIR" >> src/config.mk 183echo "GNOME_DEF_APP=\$(DESTDIR)$GNOME_DEF_APP" >> src/config.mk 184echo "PROG=$PROG" >> src/config.mk 185echo \#ifndef PROGRAM_VERSION >> src/config.mk 186echo \#define PROGRAM_VERSION '"'$PROGRAM_VERSION'"' >> src/config.mk 187echo \#endif >> src/config.mk 188[ "$real_gtk" = "all" ] && echo \#define RULE_THEM_ALL >> src/config.mk 189echo "CONF_FILE=$CONF_FILE" >> src/config.mk 190head -n 1 $0 > src/uninstall.sh 191echo "set -x" >> src/uninstall.sh 192echo "rm -f $bindir/$PROG" >> src/uninstall.sh 193echo "rm -f $bindir/showvte" >> src/uninstall.sh 194echo "rmdir $bindir 2> /dev/null" >> src/uninstall.sh 195echo "rm -f $deskdir/evilvte.desktop" >> src/uninstall.sh 196echo "rmdir $deskdir 2> /dev/null" >> src/uninstall.sh 197echo "rm -f $GNOME_DEF_APP/evilvte.xml" >> src/uninstall.sh 198echo "rmdir $GNOME_DEF_APP 2> /dev/null" >> src/uninstall.sh 199echo "rmdir $prefix/share/gnome-control-center 2> /dev/null" >> src/uninstall.sh 200echo "rm -f $mandir/evilvte.1" >> src/uninstall.sh 201echo "rm -f $mandir/showvte.1" >> src/uninstall.sh 202echo "rmdir $mandir 2> /dev/null" >> src/uninstall.sh 203echo "rmdir $prefix/share/man 2> /dev/null" >> src/uninstall.sh 204echo "rm -f $ICON_DIR/evilvte.png" >> src/uninstall.sh 205echo "rmdir $ICON_DIR 2> /dev/null" >> src/uninstall.sh 206echo "rm -f $THEME_DIR/hicolor/16x16/apps/evilvte.png" >> src/uninstall.sh 207echo "rmdir $THEME_DIR/hicolor/16x16/apps 2> /dev/null" >> src/uninstall.sh 208echo "rmdir $THEME_DIR/hicolor/16x16 2> /dev/null" >> src/uninstall.sh 209echo "rm -f $THEME_DIR/hicolor/20x20/apps/evilvte.png" >> src/uninstall.sh 210echo "rmdir $THEME_DIR/hicolor/20x20/apps 2> /dev/null" >> src/uninstall.sh 211echo "rmdir $THEME_DIR/hicolor/20x20 2> /dev/null" >> src/uninstall.sh 212echo "rm -f $THEME_DIR/hicolor/22x22/apps/evilvte.png" >> src/uninstall.sh 213echo "rmdir $THEME_DIR/hicolor/22x22/apps 2> /dev/null" >> src/uninstall.sh 214echo "rmdir $THEME_DIR/hicolor/22x22 2> /dev/null" >> src/uninstall.sh 215echo "rm -f $THEME_DIR/hicolor/24x24/apps/evilvte.png" >> src/uninstall.sh 216echo "rmdir $THEME_DIR/hicolor/24x24/apps 2> /dev/null" >> src/uninstall.sh 217echo "rmdir $THEME_DIR/hicolor/24x24 2> /dev/null" >> src/uninstall.sh 218echo "rm -f $THEME_DIR/hicolor/32x32/apps/evilvte.png" >> src/uninstall.sh 219echo "rmdir $THEME_DIR/hicolor/32x32/apps 2> /dev/null" >> src/uninstall.sh 220echo "rmdir $THEME_DIR/hicolor/32x32 2> /dev/null" >> src/uninstall.sh 221echo "rm -f $THEME_DIR/hicolor/36x36/apps/evilvte.png" >> src/uninstall.sh 222echo "rmdir $THEME_DIR/hicolor/36x36/apps 2> /dev/null" >> src/uninstall.sh 223echo "rmdir $THEME_DIR/hicolor/36x36 2> /dev/null" >> src/uninstall.sh 224echo "rm -f $THEME_DIR/hicolor/40x40/apps/evilvte.png" >> src/uninstall.sh 225echo "rmdir $THEME_DIR/hicolor/40x40/apps 2> /dev/null" >> src/uninstall.sh 226echo "rmdir $THEME_DIR/hicolor/40x40 2> /dev/null" >> src/uninstall.sh 227echo "rm -f $THEME_DIR/hicolor/48x48/apps/evilvte.png" >> src/uninstall.sh 228echo "rmdir $THEME_DIR/hicolor/48x48/apps 2> /dev/null" >> src/uninstall.sh 229echo "rmdir $THEME_DIR/hicolor/48x48 2> /dev/null" >> src/uninstall.sh 230echo "rm -f $THEME_DIR/hicolor/64x64/apps/evilvte.png" >> src/uninstall.sh 231echo "rmdir $THEME_DIR/hicolor/64x64/apps 2> /dev/null" >> src/uninstall.sh 232echo "rmdir $THEME_DIR/hicolor/64x64 2> /dev/null" >> src/uninstall.sh 233echo "rm -f $THEME_DIR/hicolor/72x72/apps/evilvte.png" >> src/uninstall.sh 234echo "rmdir $THEME_DIR/hicolor/72x72/apps 2> /dev/null" >> src/uninstall.sh 235echo "rmdir $THEME_DIR/hicolor/72x72 2> /dev/null" >> src/uninstall.sh 236echo "rm -f $THEME_DIR/hicolor/96x96/apps/evilvte.png" >> src/uninstall.sh 237echo "rmdir $THEME_DIR/hicolor/96x96/apps 2> /dev/null" >> src/uninstall.sh 238echo "rmdir $THEME_DIR/hicolor/96x96 2> /dev/null" >> src/uninstall.sh 239echo "rm -f $THEME_DIR/hicolor/scalable/apps/evilvte.svg" >> src/uninstall.sh 240echo "rmdir $THEME_DIR/hicolor/scalable/apps 2> /dev/null" >> src/uninstall.sh 241echo "rmdir $THEME_DIR/hicolor/scalable 2> /dev/null" >> src/uninstall.sh 242echo "rmdir $THEME_DIR/hicolor 2> /dev/null" >> src/uninstall.sh 243echo "rmdir $THEME_DIR 2> /dev/null" >> src/uninstall.sh 244echo "rmdir $prefix/share 2> /dev/null" >> src/uninstall.sh 245echo "rmdir $prefix 2> /dev/null" >> src/uninstall.sh 246echo "true" >> src/uninstall.sh 247