forked from zephir-lang/zephir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·34 lines (31 loc) · 1.12 KB
/
install
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
#!/bin/bash
cd parser
rm -f *.o
rm -f *.lo
if [ ! -f lemon ]; then
gcc -g lemon.c -o lemon
fi
re2c -o scanner.c scanner.re && ./lemon -s parser.lemon && cat base.c >> parser.c
sed s/"\#line"/"\/\/"/g scanner.c > xx && mv -f xx scanner.c
sed s/"#line"/"\/\/"/g parser.c > xx && mv -f xx parser.c
#sed s/"YY"/"JJ"/g parser.c > xx && mv -f xx parser.c
#sed s/"yy"/"jj"/g parser.c > xx && mv -f xx parser.c
#sed s/"TOKEN"/"JTOKEN"/g parser.c > xx && mv -f xx parser.c
#sed s/"YY"/"JJ"/g scanner.c > xx && mv -f xx scanner.c
#sed s/"yy"/"jj"/g scanner.c > xx && mv -f xx scanner.c
export CFLAGS="-O2 -g"
gcc -Wl,-rpath /usr/local/lib -I/usr/local/lib -L/usr/local/lib -L/opt/local/lib -g3 parser.c scanner.c -ljson -ljson-c -o ../bin/zephir-parser
# Using the -c option will copy zephir in /usr/local/bin
options='c'
while getopts $options option
do
if [[ "$option" == "c" ]]; then
cd ..
ZEPHIRDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
sed "s#%ZEPHIRDIR%#$ZEPHIRDIR#g" bin/zephir > bin/zephir-cmd
chmod 755 bin/zephir-cmd
sudo cp bin/zephir-cmd /usr/local/bin/zephir
rm bin/zephir-cmd
exit 0
fi
done