-
Notifications
You must be signed in to change notification settings - Fork 18
/
configure
executable file
·120 lines (101 loc) · 2.3 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
#!/bin/sh
prefix=/usr/local
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
echo "Usage: ./configure [options]"
echo " --help print this message"
echo " --prefix=PREFIX default:/usr/local"
echo " --bindir=BINDIR default:$prefix/bin"
echo " --datadir=BINDIR default:$prefix/share"
echo ""
exit 1
fi
if test ! -d ./libqqwry
then
echo there is no ./libqqwry
echo see http://code.google.com/p/qqwry/
exit 1
fi
if test ! -f ./share/QQWry.Dat
then
echo please download QQWry.Dat from https://chenze.name/wenjian/QQWry.Dat
exit 1
fi
# parse options
for opt do
optarg="${opt#*=}"
case "$opt" in
--prefix=*)
prefix="$optarg"
;;
--bindir=*)
bindir="$optarg"
;;
--datadir=*)
datadir="$optarg"
;;
esac
done
if test "z$bindir" = "z"
then
bindir=${prefix}/bin
fi
if test "z$datadir" = "z"
then
datadir=${prefix}/share
fi
# generate config files
cat > config.mak << EOF
prefix=$prefix
bindir=$bindir
datadir=$datadir
EOF
cat > config.h << EOF
#define NALI_QQWRY_PATH "$datadir/QQWry.Dat"
EOF
cat > bin/nali << EOF
#!/bin/sh
if test \$# -gt 0
then
echo \$@|perl $datadir/nali.pl
else
perl $datadir/nali.pl
fi
EOF
cat > bin/nali-update << EOF
#!/bin/sh
#qqwry_dat_url="https://chenze.name/wenjian/QQWry.Dat";
qqwry_dat_url="https://github.com/out0fmemory/qqwry.dat/raw/master/qqwry_lastest.dat";
qqwry_dat_local_path="$datadir/QQWry.Dat"
curl=\`which curl\`
wget=\`which wget\`
if ! test -w \$qqwry_dat_local_path
then
echo You may need sudo
exit 1
fi
if test -f /tmp/QQWry.Dat
then
rm -f /tmp/QQWry.Dat || exit 1
fi
if test "x\$curl" != "x" && test -x \$curl
then
command="\$curl -L -k --compressed \$qqwry_dat_url -o /tmp/QQWry.Dat"
elif test "x\$wget" != "x" && test -x \$wget
then
command="\$wget --no-check-certificate \$qqwry_dat_url -O /tmp/QQWry.Dat"
else
echo Error: Please install curl or wget
exit 1
fi
echo Updating \$qqwry_dat_local_path
\$command && mv /tmp/QQWry.Dat \$qqwry_dat_local_path && echo Successfully Updated && exit 0
echo Failed to update
exit 1
EOF
echo '***** Configure Successfully *****'
echo
echo "Install:"
echo 'make && make install'
echo
echo "Usage and Examples:";
echo 'http://www.surfchen.org/wiki/Nali'