diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2016-09-24 18:04:45 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-09-24 18:04:45 -0700 |
commit | 61666c011d6847bf53dd98336591b35bf9b39e72 (patch) | |
tree | c99a0f4229201de6ba37408b785bf23d67b931e4 /debian | |
parent | daf033c8535c6a08b06bf280267ee540687214e8 (diff) | |
download | zxcvbn-c-61666c011d6847bf53dd98336591b35bf9b39e72.tar.gz |
ensure -fPIC by compiling -inline.c twice
Diffstat (limited to 'debian')
-rw-r--r-- | debian/patches/targets-to-build-shlib.patch | 28 | ||||
-rw-r--r-- | debian/patches/targets-to-build-static-lib.patch | 10 |
2 files changed, 26 insertions, 12 deletions
diff --git a/debian/patches/targets-to-build-shlib.patch b/debian/patches/targets-to-build-shlib.patch index 69c6bb1..8af535a 100644 --- a/debian/patches/targets-to-build-shlib.patch +++ b/debian/patches/targets-to-build-shlib.patch @@ -7,11 +7,11 @@ This patch adds targets to build a shared library, instead. Forwarded: https://github.com/tsyrogit/zxcvbn-c/pull/8 --- - makefile | 24 +++++++++++++++++++++--- - 1 file changed, 21 insertions(+), 3 deletions(-) + makefile | 29 +++++++++++++++++++++++++---- + 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile -index ca5c352..d74b139 100644 +index ca5c352..143818b 100644 --- a/makefile +++ b/makefile @@ -1,9 +1,25 @@ @@ -35,13 +35,23 @@ index ca5c352..d74b139 100644 + if [ ! -e libzxcvbn.so ]; then ln -s $(TARGET_LIB) libzxcvbn.so; fi + gcc $(CFLAGS) -o $@ $< -L. -lzxcvbn -lm + -+$(TARGET_LIB): zxcvbn-inline.o ++$(TARGET_LIB): zxcvbn-inline-pic.o + gcc $(CFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,$(SONAME) -o $@ $^ -lm + if [ ! -e $(SONAME) ]; then ln -s $(TARGET_LIB) $(SONAME); fi test-file: test.c zxcvbn-file.o gcc $(CFLAGS) -DUSE_DICT_FILE -o test-file test.c zxcvbn-file.o -lm -@@ -42,11 +58,13 @@ zxcvbn-c++file.o: zxcvbn.c dict-crc.h zxcvbn.h +@@ -14,6 +30,9 @@ zxcvbn-file.o: zxcvbn.c dict-crc.h zxcvbn.h + test-inline: test.c zxcvbn-inline.o + gcc $(CFLAGS) -o test-inline test.c zxcvbn-inline.o -lm + ++zxcvbn-inline-pic.o: zxcvbn.c dict-src.h zxcvbn.h ++ gcc $(CFLAGS) -fPIC -c -o $@ $< ++ + zxcvbn-inline.o: zxcvbn.c dict-src.h zxcvbn.h + gcc $(CFLAGS) -c -o zxcvbn-inline.o zxcvbn.c + +@@ -42,11 +61,13 @@ zxcvbn-c++file.o: zxcvbn.c dict-crc.h zxcvbn.h if [ ! -e zxcvbn.cpp ]; then ln -s zxcvbn.c zxcvbn.cpp; fi g++ $(CPPFLAGS) -DUSE_DICT_FILE -c -o zxcvbn-c++file.o zxcvbn.cpp @@ -56,8 +66,12 @@ index ca5c352..d74b139 100644 @echo Testing C++ build, dictionary from file ./test-c++file -t testcases.txt @echo Testing C++ build, dictionary in executable -@@ -58,4 +76,4 @@ clean: - rm -f test-inline zxcvbn-inline.o test-c++inline zxcvbn-c++inline.o +@@ -55,7 +76,7 @@ test: test-file test-inline test-c++inline test-c++file testcases.txt + + clean: + rm -f test-file zxcvbn-file.o test-c++file zxcvbn-c++file.o +- rm -f test-inline zxcvbn-inline.o test-c++inline zxcvbn-c++inline.o ++ rm -f test-inline zxcvbn-inline.o zxcvbn-inline-pic.o test-c++inline zxcvbn-c++inline.o rm -f dict-*.h zxcvbn.dict zxcvbn.cpp test.cpp rm -f dictgen - diff --git a/debian/patches/targets-to-build-static-lib.patch b/debian/patches/targets-to-build-static-lib.patch index 35da165..d55e573 100644 --- a/debian/patches/targets-to-build-static-lib.patch +++ b/debian/patches/targets-to-build-static-lib.patch @@ -11,7 +11,7 @@ Forwarded: https://github.com/tsyrogit/zxcvbn-c/pull/8 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile -index d74b139..b44b6e6 100644 +index 143818b..adf3c9b 100644 --- a/makefile +++ b/makefile @@ -11,7 +11,7 @@ SONAME = libzxcvbn.so.0 @@ -23,7 +23,7 @@ index d74b139..b44b6e6 100644 test-shlib: test.c $(TARGET_LIB) if [ ! -e libzxcvbn.so ]; then ln -s $(TARGET_LIB) libzxcvbn.so; fi -@@ -21,6 +21,12 @@ $(TARGET_LIB): zxcvbn-inline.o +@@ -21,6 +21,12 @@ $(TARGET_LIB): zxcvbn-inline-pic.o gcc $(CFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,$(SONAME) -o $@ $^ -lm if [ ! -e $(SONAME) ]; then ln -s $(TARGET_LIB) $(SONAME); fi @@ -36,7 +36,7 @@ index d74b139..b44b6e6 100644 test-file: test.c zxcvbn-file.o gcc $(CFLAGS) -DUSE_DICT_FILE -o test-file test.c zxcvbn-file.o -lm -@@ -58,13 +64,15 @@ zxcvbn-c++file.o: zxcvbn.c dict-crc.h zxcvbn.h +@@ -61,13 +67,15 @@ zxcvbn-c++file.o: zxcvbn.c dict-crc.h zxcvbn.h if [ ! -e zxcvbn.cpp ]; then ln -s zxcvbn.c zxcvbn.cpp; fi g++ $(CPPFLAGS) -DUSE_DICT_FILE -c -o zxcvbn-c++file.o zxcvbn.cpp @@ -53,8 +53,8 @@ index d74b139..b44b6e6 100644 @echo Testing C++ build, dictionary from file ./test-c++file -t testcases.txt @echo Testing C++ build, dictionary in executable -@@ -76,4 +84,4 @@ clean: - rm -f test-inline zxcvbn-inline.o test-c++inline zxcvbn-c++inline.o +@@ -79,4 +87,4 @@ clean: + rm -f test-inline zxcvbn-inline.o zxcvbn-inline-pic.o test-c++inline zxcvbn-c++inline.o rm -f dict-*.h zxcvbn.dict zxcvbn.cpp test.cpp rm -f dictgen - rm -f ${TARGET_LIB} ${SONAME} libzxcvbn.so test-shlib |