aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorErik Ogan <erik@ogan.net>2019-10-06 20:11:52 -0700
committerErik Ogan <erik@ogan.net>2019-10-06 20:19:41 -0700
commita44459b1dbfcc436665906caff59edc66802ef94 (patch)
treec5da9f67f7ba178992f5d46ac99eaa750d6a65dc
parent5d7ef7c537b0ae8bf8c8696ea4241cf29a572853 (diff)
downloadzxcvbn-c-a44459b1dbfcc436665906caff59edc66802ef94.tar.gz
Add an RPM spec file for packaging
Also include the required patch file, so it can be referenced from a Github URL.
-rw-r--r--rpm/libzxcvbn-2.4-makefile-install.patch38
-rw-r--r--rpm/libzxcvbn.spec65
2 files changed, 103 insertions, 0 deletions
diff --git a/rpm/libzxcvbn-2.4-makefile-install.patch b/rpm/libzxcvbn-2.4-makefile-install.patch
new file mode 100644
index 0000000..763d71d
--- /dev/null
+++ b/rpm/libzxcvbn-2.4-makefile-install.patch
@@ -0,0 +1,38 @@
+--- zxcvbn-c-2.4.orig/makefile 2018-08-29 13:59:20.000000000 -0700
++++ zxcvbn-c-2.4/makefile 2019-09-28 12:10:36.000000000 -0700
+@@ -13,6 +13,8 @@
+ TARGET_LIB = libzxcvbn.so.0.0.0
+ SONAME = libzxcvbn.so.0
+
++LIBDIR := $(or $(LIBDIR),$(/usr/lib))
++
+ WORDS = words-eng_wiki.txt words-female.txt words-male.txt words-passwd.txt words-surname.txt words-tv_film.txt
+
+ all: test-file test-inline test-c++inline test-c++file test-shlib test-statlib test-internals
+@@ -44,7 +46,7 @@
+ $(CC) $(CPPFLAGS) $(CFLAGS) \
+ -o test-inline test.c zxcvbn-inline.o $(LDFLAGS) -lm
+
+-test-internals: test-internals.c zxcvbn.c dict-crc.h zxcvbn.h
++test-internals: test-internals.c zxcvbn.c dict-src.h dict-crc.h zxcvbn.h
+ $(CC) $(CPPFLAGS) $(CFLAGS) \
+ -o test-internals test-internals.c $(LDFLAGS) -lm
+
+@@ -101,6 +103,17 @@
+ ./test-c++inline -t testcases.txt
+ @echo Finished
+
++package: $(TARGET_LIB) libzxcvbn.a dict-crc.h dict-src.h
++
++install: package
++ mkdir -p $(DESTDIR)/usr/{include,share}/zxcvbn $(DESTDIR)/usr/bin $(DESTDIR)$(LIBDIR)
++ install -m 0644 *.h $(DESTDIR)/usr/include/zxcvbn
++ install -m 0644 $(TARGET_LIB) libzxcvbn.a $(DESTDIR)$(LIBDIR)
++ ln -s $(TARGET_LIB) $(DESTDIR)$(LIBDIR)/$(SONAME)
++ ln -s $(SONAME) $(basename $(DESTDIR)$(LIBDIR)/$(SONAME))
++ install -m 0755 dictgen $(DESTDIR)/usr/bin/zxcvbn-dictgen
++ install -m 0644 zxcvbn.dict $(DESTDIR)/usr/share/zxcvbn
++
+ clean:
+ rm -f test-file zxcvbn-file.o test-c++file zxcvbn-c++file.o
+ rm -f test-inline test-internals zxcvbn-inline.o zxcvbn-inline-pic.o test-c++inline zxcvbn-c++inline.o
diff --git a/rpm/libzxcvbn.spec b/rpm/libzxcvbn.spec
new file mode 100644
index 0000000..7985c91
--- /dev/null
+++ b/rpm/libzxcvbn.spec
@@ -0,0 +1,65 @@
+Summary: A library for password entropy checking
+Name: libzxcvbn
+Version: 2.4
+Release: 3%{?dist}
+License: MIT
+Source0: https://github.com/tsyrogit/zxcvbn-c/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
+Patch1: libzxcvbn-2.4-makefile-install.patch
+
+# For some reason adding the libzxcvbn.so in the Makefile messes up the provides
+%define ldversion 0
+Provides: libzxcvbn.so.%{ldversion}()(%{__isa_bits}bit)
+
+%global reponame zxcvbn-c
+
+%description
+This is a library for password entropy checks based on common names, words and
+patterns in US English.
+
+%package devel
+Group: Development/Libraries
+Summary: Support for development of applications using the libzxcvbn library
+Requires: libzxcvbn%{?_isa} = %{version}-%{release}
+Requires: pkgconfig
+
+%description devel
+Files needed for development of applications using the libzxcvbn library.
+
+%prep
+%setup -q -n %{reponame}-%{version}
+%patch1 -p1 -b .makefile-install
+
+%build
+make %{?_smp_mflags} package
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir} INSTALL='install -p'
+
+%check
+make test
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc README.md LICENSE.txt
+%{_bindir}/zxcvbn-dictgen
+%{_libdir}/libzxcvbn.so*
+%{_datarootdir}/zxcvbn/zxcvbn.dict
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/zxcvbn/*.h
+%{_libdir}/libzxcvbn.a
+
+%changelog
+* Sun Oct 6 2019 Erik Ogan <erik@stealthymonkeys.com> 2.4-3
+- Add make test to %check
+
+* Sat Sep 28 2019 Erik Ogan <erik@stealthymonkeys.com> 2.4-2
+- Add libzxcvbn.so link so ld can find the library
+
+* Sat Sep 21 2019 Erik Ogan <erik@stealthymonkeys.com> 2.4-1
+- Initial Spec