-
-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f0d9a7
commit 182c87d
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
cd parser | ||
rm -f *.o *.lo | ||
|
||
#Compile lemon | ||
if [ ! -f lemon ]; then | ||
gcc -w lemon.c -o lemon | ||
fi | ||
|
||
TEST=`re2c -v` | ||
if [ $? != 2 ]; then | ||
echo "error: re2c is not installed" | ||
exit 2 | ||
fi | ||
|
||
re2c -o scanner.c scanner.re && ./lemon -s parser.lemon && cat base.c >> parser.c | ||
if [ ! -f parser.c ]; then | ||
echo "error: re2c is not installed" | ||
exit 2 | ||
fi | ||
|
||
sed s/"\#line"/"\/\/"/g scanner.c > xx && mv -f xx scanner.c | ||
sed s/"#line"/"\/\/"/g parser.c > xx && mv -f xx parser.c | ||
gcc -Wl,-rpath /usr/local/lib -I/usr/local/include -L/usr/local/lib -L/opt/local/lib -g3 -O0 -w parser.c scanner.c -ljson-c -o ../bin/zephir-parser | ||
|
||
cd .. | ||
|
||
ZEPHIRDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
sed "s#%ZEPHIRDIR%#$ZEPHIRDIR#g" bin/zephir > bin/zephir-cmd | ||
chmod 755 bin/zephir-cmd | ||
|
||
if [ ! -d "~/bin" ]; then | ||
mkdir ~/bin | ||
fi | ||
|
||
cp bin/zephir-cmd ~/bin/zephir | ||
rm bin/zephir-cmd |