Browse Source

l/zxcvbn-cpp: Install library as libzxcvbncpp.so.

slackware-14.2
Damien Goutte-Gattat 4 years ago
parent
commit
036f87b667
  1. 130
      l/zxcvbn-cpp/zxcvbn-cpp-autoconfiscate.diff
  2. 45
      l/zxcvbn-cpp/zxcvbn-cpp.SlackBuild

130
l/zxcvbn-cpp/zxcvbn-cpp-autoconfiscate.diff

@ -0,0 +1,130 @@
diff --git a/.gitignore b/.gitignore
index 8632252..1f93efd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,23 @@ lib
*.swp
*.swo
tmux-*.log
+native-src/zxcvbn/_frequency_lists.cpp
+native-src/zxcvbn/_frequency_lists.hpp
+native-src/zxcvbn/adjacency_graphs.cpp
+native-src/zxcvbn/adjacency_graphs.hpp
+native-src/zxcvbn/m4
+native-src/zxcvbn/autom4te.cache
+native-src/zxcvbn/config.log
+native-src/zxcvbn/config.status
+native-src/zxcvbn/config
+native-src/zxcvbn/configure
+native-src/zxcvbn/libtool
+native-src/zxcvbn/aclocal.m4
+native-src/zxcvbn/Makefile.in
+native-src/zxcvbn/Makefile
+native-src/zxcvbn/*.o
+native-src/zxcvbn/*.lo
+native-src/zxcvbn/*.la
+native-src/zxcvbn/.deps
+native-src/zxcvbn/.libs
+native-src/zxcvbn/zxcvbncpp.pc
diff --git a/native-src/zxcvbn/Makefile.am b/native-src/zxcvbn/Makefile.am
new file mode 100644
index 0000000..1620cda
--- /dev/null
+++ b/native-src/zxcvbn/Makefile.am
@@ -0,0 +1,45 @@
+ACLOCAL_AMFLAGS = -I m4 --install
+
+CXXFLAGS = -std=c++14
+
+lib_LTLIBRARIES = libzxcvbncpp.la
+
+libzxcvbncpp_la_SOURCES = feedback.cpp frequency_lists.cpp matching.cpp \
+ scoring.cpp time_estimates.cpp util.cpp \
+ zxcvbn.cpp _frequency_lists.cpp \
+ adjacency_graphs.cpp
+
+libzxcvbncpp_la_LDFLAGS = -version-info \
+ @ZXCVBNCPP_LT_CURRENT@:@ZXCVBNCPP_LT_REVISION@:@ZXCVBNCPP_LT_AGE@
+
+incdir = $(includedir)/zxcvbn
+inc_HEADERS = common.hpp feedback.hpp frequency_lists.hpp \
+ frequency_lists_common.hpp matching.hpp optional.hpp \
+ scoring.hpp time_estimates.hpp util.hpp zxcvbn.h \
+ _frequency_lists.hpp adjacency_graphs.hpp
+
+pkgconfig_DATA = zxcvbncpp.pc
+
+BUILT_SOURCES = _frequency_lists.hpp _frequency_lists.cpp \
+ adjacency_graphs.hpp adjacency_graphs.cpp
+
+CLEANFILES = $(BUILT_SOURCES)
+
+scripts_dir = $(top_srcdir)/../../data-scripts
+data_dir = $(top_srcdir)/../../data
+
+_frequency_lists.hpp:
+ $(scripts_dir)/build_frequency_lists.py $(data_dir) \
+ _frequency_lists.hpp
+
+_frequency_lists.cpp:
+ $(scripts_dir)/build_frequency_lists.py $(data_dir) \
+ _frequency_lists.cpp
+
+adjacency_graphs.hpp:
+ $(scripts_dir)/build_keyboard_adjacency_graphs.py \
+ adjacency_graphs.hpp
+
+adjacency_graphs.cpp:
+ $(scripts_dir)/build_keyboard_adjacency_graphs.py \
+ adjacency_graphs.cpp
diff --git a/native-src/zxcvbn/configure.ac b/native-src/zxcvbn/configure.ac
new file mode 100644
index 0000000..ea8f8d8
--- /dev/null
+++ b/native-src/zxcvbn/configure.ac
@@ -0,0 +1,28 @@
+dnl Configure template for the zxcvbn C++ library
+
+AC_INIT([zxcvbncpp], [0.1.0], [rian@alum.mit.edu])
+AC_CONFIG_SRCDIR([configure.ac])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([foreign])
+PKG_INSTALLDIR
+
+AC_PROG_CXX
+AC_PROG_INSTALL
+LT_INIT
+
+dnl Libtool version numbers
+dnl How to update:
+dnl Interfaces removed: CURRENT++, AGE=0, REVISION=0
+dnl Interfaces added: CURRENT++, AGE++, REVISION=0
+dnl No interfaces changed: REVISION++
+ZXCVBNCPP_LT_CURRENT=0
+ZXCVBNCPP_LT_AGE=0
+ZXCVBNCPP_LT_REVISION=0
+
+AC_SUBST(ZXCVBNCPP_LT_CURRENT)
+AC_SUBST(ZXCVBNCPP_LT_AGE)
+AC_SUBST(ZXCVBNCPP_LT_REVISION)
+
+AC_CONFIG_FILES([Makefile zxcvbncpp.pc])
+AC_OUTPUT
diff --git a/native-src/zxcvbn/zxcvbncpp.pc.in b/native-src/zxcvbn/zxcvbncpp.pc.in
new file mode 100644
index 0000000..183e144
--- /dev/null
+++ b/native-src/zxcvbn/zxcvbncpp.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Zxcvbn-cpp
+Description: Password strength estimation library
+Version: @VERSION@
+URL: https://github.com/rianhunter/zxcvbn-cpp
+Libs: -L${libdir} -lzxcvbncpp
+Cflags: -I${includedir}

45
l/zxcvbn-cpp/zxcvbn-cpp.SlackBuild

@ -36,7 +36,7 @@ REPO=${REPO:-https://github.com/rianhunter/zxcvbn-cpp.git}
# Build infos
NAMEPKG=${NAMEPKG:-zxcvbn-cpp}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
@ -84,42 +84,27 @@ if [ ! -r $ARCHIVE ]; then
fi
NAME=$NAMESRC-$VERSION
# Compile Python module
# Extract and patch
cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
patch -p 1 < $CWD/zxcvbn-cpp-autoconfiscate.diff
# Compile Python module
python setup.py build
python setup.py install --root=$PKG
# Compile C/C++ library
cd native-src
g++ -c -I. $CPUOPT -std=c++14 zxcvbn/_frequency_lists.cpp \
zxcvbn/adjacency_graphs.cpp \
zxcvbn/feedback.cpp \
zxcvbn/frequency_lists.cpp \
zxcvbn/matching.cpp \
zxcvbn/scoring.cpp \
zxcvbn/time_estimates.cpp \
zxcvbn/util.cpp \
zxcvbn/zxcvbn.cpp
g++ -shared -Wl,-soname,libzxcvbn.so -o libzxcvbn.so *.o
install -D -m 755 libzxcvbn.so $PKG/usr/lib$LIBDIRSUFFIX/libzxcvbn.so
mkdir -p $PKG/usr/include/zxcvbn
install -m 644 zxcvbn/_frequency_lists.hpp \
zxcvbn/adjacency_graphs.hpp \
zxcvbn/common.hpp \
zxcvbn/feedback.hpp \
zxcvbn/frequency_lists.hpp \
zxcvbn/frequency_lists_common.hpp \
zxcvbn/matching.hpp \
zxcvbn/optional.hpp \
zxcvbn/scoring.hpp \
zxcvbn/time_estimates.hpp \
zxcvbn/util.hpp \
zxcvbn/zxcvbn.hpp \
zxcvbn/zxcvbn.h \
$PKG/usr/include/zxcvbn
cd native-src/zxcvbn
autoreconf -f -i
CXXFLAGS=$CPUOPT \
./configure --prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--disable-static \
--build=$ARCH-slackware-linux
make -j $JOBS
make install DESTDIR=$PKG
# Strip binaries
find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \
@ -127,7 +112,7 @@ find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \
# Install the documentation
mkdir -p $PKG/usr/doc/$NAME
install -m 644 ../LICENSE.txt ../README.md $PKG/usr/doc/$NAME
install -m 644 ../../LICENSE.txt ../../README.md $PKG/usr/doc/$NAME
# Copy slack-desc file
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc

Loading…
Cancel
Save