Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): fixes build process for split project #3

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,12 @@ dmypy.json

# Pyre type checker
.pyre/

# Upstream git repo
upstream/
libinjection/libinjection.h
fzipi marked this conversation as resolved.
Show resolved Hide resolved
libinjection/libinjection.py
libinjection/libinjection_xss.*
libinjection/libinjection_html5.*
libinjection/libinjection_sqli*
libinjection/libinjection_wrap*
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ all: build
#
#

build: copy libinjection/libinjection_wrap.c
build: upstream libinjection/libinjection_wrap.c
rm -f libinjection.py libinjection.pyc
python setup.py --verbose build --force

Expand All @@ -21,29 +21,31 @@ test: test-unit
speed:
./speedtest.py

upstream:
[ -d $@ ] || git clone --depth=1 https://github.com/libinjection/libinjection.git upstream

words.py: Makefile json2python.py ../src/sqlparse_data.json
./json2python.py < ../src/sqlparse_data.json > words.py
libinjection/libinjection.h libinjection/libinjection_sqli.h: upstream
cp -f upstream/src/libinjection*.h upstream/src/libinjection*.c libinjection/

words.py: Makefile json2python.py upstream
./json2python.py < upstream/src/sqlparse_data.json > words.py


libinjection/libinjection_wrap.c: libinjection/libinjection.i libinjection/libinjection.h libinjection/libinjection_sqli.h
swig -version
swig -python -builtin -Wall -Wextra libinjection/libinjection.i

swig -py3 -python -builtin -Wall -Wextra libinjection/libinjection.i

copy:
cp ../src/libinjection*.h ../src/libinjection*.c libinjection/

.PHONY: copy

libinjection.so: copy
libinjection.so: libinjection/libinjection_wrap.c
gcc -std=c99 -Wall -Werror -fpic -c libinjection/libinjection_sqli.c
gcc -std=c99 -Wall -Werror -fpic -c libinjection/libinjection_xss.c
gcc -std=c99 -Wall -Werror -fpic -c libinjection/libinjection_html5.c
gcc -dynamiclib -shared -o libinjection.so libinjection_sqli.o libinjection_xss.o libinjection_html5.o

clean:
@rm -rf build dist
@rm -rf build dist upstream
@rm -f *.pyc *~ *.so *.o
@rm -f nosetests.xml
@rm -f words.py
Expand Down