aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-09-24 15:23:26 -0700
committerSean Whitton <spwhitton@spwhitton.name>2016-09-24 15:23:26 -0700
commitaa538bbdab14cf430398c1bdae0636eff1554b48 (patch)
treeead925b292a360808543944594b804bc3481b957
parenta92ada5c231eec57ac67699a14e9c1e91d314069 (diff)
downloadzxcvbn-c-aa538bbdab14cf430398c1bdae0636eff1554b48.tar.gz
build & install static lib, too
-rwxr-xr-xdebian/libzxcvbn-dev.install1
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/targets-to-build-static-lib.patch57
3 files changed, 59 insertions, 0 deletions
diff --git a/debian/libzxcvbn-dev.install b/debian/libzxcvbn-dev.install
index 0e55b14..3c2ab27 100755
--- a/debian/libzxcvbn-dev.install
+++ b/debian/libzxcvbn-dev.install
@@ -1,3 +1,4 @@
#!/usr/bin/dh-exec
zxcvbn.h usr/include/
libzxcvbn.so usr/lib/${DEB_HOST_MULTIARCH}/
+libzxcvbn.a usr/lib/${DEB_HOST_MULTIARCH}/
diff --git a/debian/patches/series b/debian/patches/series
index f874646..9dc3255 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ patch-README-for-Debian.patch
conditionally-define-CFLAGS.patch
angled-include-zxcvbn.h.patch
targets-to-build-shlib.patch
+targets-to-build-static-lib.patch
diff --git a/debian/patches/targets-to-build-static-lib.patch b/debian/patches/targets-to-build-static-lib.patch
new file mode 100644
index 0000000..5f63401
--- /dev/null
+++ b/debian/patches/targets-to-build-static-lib.patch
@@ -0,0 +1,57 @@
+From: Sean Whitton <spwhitton@spwhitton.name>
+Date: Sat, 24 Sep 2016 15:20:43 -0700
+Subject: targets to build static lib
+
+---
+ makefile | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/makefile b/makefile
+index c438f1a..c2b5df1 100644
+--- a/makefile
++++ b/makefile
+@@ -11,7 +11,7 @@ SONAME = libzxcvbn.so.0
+
+ WORDS = words-10k-pass.txt words-english.txt words-female.txt words-male.txt words-surname.txt
+
+-all: test-file test-inline test-c++inline test-c++file test-shlib
++all: test-file test-inline test-c++inline test-c++file test-shlib test-statlib
+
+ test-shlib: test.c $(TARGET_LIB)
+ if [ ! -e libzxcvbn.so ]; then ln -s $(TARGET_LIB) libzxcvbn.so; fi
+@@ -20,6 +20,12 @@ test-shlib: test.c $(TARGET_LIB)
+ $(TARGET_LIB): zxcvbn-inline.o
+ gcc $(CFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,$(SONAME) -o $@ $^ -lm
+
++test-statlib: test.c libzxcvbn.a
++ gcc $(CFLAGS) $(LDFLAGS) -static -o $@ test.c -L. -lm -lzxcvbn
++
++libzxcvbn.a: zxcvbn-inline.o
++ ar rcs $@ $^
++
+ test-file: test.c zxcvbn-file.o
+ gcc $(CFLAGS) -DUSE_DICT_FILE -o test-file test.c zxcvbn-file.o -lm
+
+@@ -57,13 +63,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
+
+-test: test-file test-inline test-c++inline test-c++file test-shlib testcases.txt
++test: test-file test-inline test-c++inline test-c++file test-shlib test-statlib testcases.txt
+ @echo Testing C build, dictionary from file
+ ./test-file -t testcases.txt
+ @echo Testing C build, dictionary in executable
+ ./test-inline -t testcases.txt
+ @echo Testing C shlib, dictionary in shlib
+ LD_LIBRARY_PATH=. ./test-shlib -t testcases.txt
++ @echo Testing C static lib, dictionary in lib
++ ./test-statlib -t testcases.txt
+ @echo Testing C++ build, dictionary from file
+ ./test-c++file -t testcases.txt
+ @echo Testing C++ build, dictionary in executable
+@@ -74,4 +82,4 @@ 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 dictgen
+- rm -f ${TARGET_LIB} libzxcvbn.so test-shlib
++ rm -f ${TARGET_LIB} libzxcvbn.so test-shlib libzxcvbn.a test-statlib