Browse Source

l/zxcvbn-cpp: Rebuilt without autotools.

slackware-14.2
Damien Goutte-Gattat 4 years ago
parent
commit
4bd65d9bc2
  1. 138
      l/zxcvbn-cpp/zxcvbn-cpp-autoconfiscate.diff
  2. 89
      l/zxcvbn-cpp/zxcvbn-cpp-makefile.diff
  3. 30
      l/zxcvbn-cpp/zxcvbn-cpp.SlackBuild

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

@ -1,138 +0,0 @@
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..4c88e16
--- /dev/null
+++ b/native-src/zxcvbn/configure.ac
@@ -0,0 +1,36 @@
+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_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [Compile with debugging support])],
+ [], [enable_debug=no])
+AS_IF([test "x$enable_debug" != xyes],
+ [AC_DEFINE([NDEBUG], [1])],
+ [CPPFLAGS="${CPPFLAGS} -g -O0"])
+
+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}

89
l/zxcvbn-cpp/zxcvbn-cpp-makefile.diff

@ -0,0 +1,89 @@
diff --git a/.gitignore b/.gitignore
index 8632252..b33bda3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,8 @@ lib
*.swp
*.swo
tmux-*.log
+native-src/zxcvbn/*.o
+native-src/zxcvbn/*.so
+native-src/zxcvbn/_frequency_lists.?pp
+native-src/zxcvbn/adjacency_graphs.?pp
+
diff --git a/native-src/zxcvbn/Makefile b/native-src/zxcvbn/Makefile
new file mode 100644
index 0000000..279c802
--- /dev/null
+++ b/native-src/zxcvbn/Makefile
@@ -0,0 +1,70 @@
+CXX = g++
+CXXFLAGS = -c -std=c++14 -Wall -Wextra -fPIC
+CPPFLAGS = -I..
+
+ifeq ($(DEBUG),yes)
+ CXXFLAGS += -g -O0
+else
+ CXXFLAGS += -O2
+ CPPFLAGS += -DNDEBUG
+endif
+
+PREFIX = /usr/local
+LIBDIR = $(PREFIX)/lib
+INCLUDEDIR = $(PREFIX)/include
+
+LIBRARY = libzxcvbncpp.so
+
+SCRIPTS_DIR = ../../data-scripts
+DATA_DIR = ../../data
+
+OBJS = _frequency_lists.o \
+ adjacency_graphs.o \
+ feedback.o \
+ frequency_lists.o \
+ matching.o \
+ scoring.o \
+ time_estimates.o \
+ util.o \
+ zxcvbn.o
+
+HEADERS = _frequency_lists.hpp \
+ adjacency_graphs.hpp \
+ common.hpp \
+ feedback.hpp \
+ frequency_lists.hpp \
+ frequency_lists_common.hpp \
+ matching.hpp \
+ optional.hpp \
+ scoring.hpp \
+ time_estimates.hpp \
+ util.hpp \
+ zxcvbn.h
+
+$(LIBRARY): $(OBJS)
+ $(CXX) -shared -Wl,-soname,$(LIBRARY) -o $(LIBRARY) $(OBJS)
+
+_frequency_lists.cpp:
+ $(SCRIPTS_DIR)/build_frequency_lists.py $(DATA_DIR) $@
+
+_frequency_lists.hpp:
+ $(SCRIPTS_DIR)/build_frequency_lists.py $(DATA_DIR) $@
+
+adjacency_graphs.cpp:
+ $(SCRIPTS_DIR)/build_keyboard_adjacency_graphs.py $@
+
+adjacency_graphs.hpp:
+ $(SCRIPTS_DIR)/build_keyboard_adjacency_graphs.py $@
+
+%.o: %.cpp $(HEADERS)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+
+install: $(LIBRARY)
+ install -s -m 755 -D $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY)
+ mkdir -p $(DESTDIR)$(INCLUDEDIR)/zxcvbn
+ install -m 644 $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/zxcvbn
+
+clean:
+ rm -f $(OBJS)
+
+.PHONY: clean

30
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:-3GGD}
BUILD=${BUILD:-4GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
JOBS=${JOBS:-1}
EXT=${EXT:-txz}
@ -47,6 +47,9 @@ OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMEPKG}
CWD=$(pwd)
LIBDIRSUFFIX=
[ "x$ARCH" = xx86_64 ] && LIBDIRSUFFIX=64
set -e # Quit if a command returns non-zero
# Sanity checks
@ -59,21 +62,6 @@ if [ ! -d $TMP ]; then
exit 1
fi
# Compilation flags
LIBDIRSUFFIX=""
case "$ARCH" in
i?86)
CPUOPT="-O2 -march=$ARCH -mtune=i686"
;;
x86_64)
CPUOPT="-O2 -fPIC"
LIBDIRSUFFIX="64"
;;
*)
CPUOPT="-O2"
;;
esac
# Get the source code
if [ ! -r $ARCHIVE ]; then
git clone $REPO $NAMESRC
@ -89,7 +77,7 @@ cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
patch -p 1 < $CWD/zxcvbn-cpp-autoconfiscate.diff
patch -p 1 < $CWD/zxcvbn-cpp-makefile.diff
# Compile Python module
python setup.py build
@ -97,14 +85,8 @@ python setup.py install --root=$PKG
# Compile C/C++ library
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
make install DESTDIR=$PKG PREFIX=/usr LIBDIR=/usr/lib$LIBDIRSUFFIX
# Strip binaries
find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \

Loading…
Cancel
Save