From 807403519c72da4c6bea5d5bb4a7d63a3067edb9 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Tue, 9 Apr 2024 10:31:41 +0900 Subject: [PATCH] Drop autotools support Signed-off-by: Daiki Ueno --- BUILD.md | 11 ++-- Makefile.am | 58 ---------------- configure.ac | 165 ---------------------------------------------- docs/Makefile.am | 4 -- src/Makefile.am | 76 --------------------- tests/Makefile.am | 143 ---------------------------------------- 6 files changed, 4 insertions(+), 453 deletions(-) delete mode 100644 Makefile.am delete mode 100644 configure.ac delete mode 100644 docs/Makefile.am delete mode 100644 src/Makefile.am delete mode 100644 tests/Makefile.am diff --git a/BUILD.md b/BUILD.md index 656f15cd..e8cc6884 100644 --- a/BUILD.md +++ b/BUILD.md @@ -3,17 +3,14 @@ This package requires the following: - OpenSSL 3.0.7+ libraries and development headers - OpenSSL tools (for testing) -- autoconf-archive packages for some m4 macros - NSS softoken, tools and development headers (for testing) - a C compiler that supports at least C11 semantics -- automake +- meson - pkg-config -- libtool - p11-kit, p11-kit-server, p11-kit-devel, opensc and softhsm (for testing) The usual command to build are: -- autoreconf -fi (if needed) -- ./configure (--with-openssl=/path/to/openssl if needed) -- make -- make check +- meson setup _build +- meson compile -C _build +- meson test -C _build diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index eb8a5457..00000000 --- a/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -ACLOCAL_AMFLAGS = -Im4 - -SUBDIRS = src tests docs -dist_doc_DATA = README.md - -check-style: - @lines=`git diff -U0 --no-color --relative origin/main -- ':!src/pkcs11.h' | clang-format-diff -p1 |wc -l`; \ - if [ "$$lines" != "0" ]; then \ - echo "Coding Style issues detected"; \ - exit 1; \ - else \ - echo "Coding Styles checks out"; \ - fi - -check-style-show: - git diff -U0 --no-color --relative origin/main -- ':!src/pkcs11.h' | clang-format-diff -p1 - -check-style-fix: - git diff -U0 --no-color --relative origin/main -- ':!src/pkcs11.h' | clang-format-diff -i -p1 - -generate-code: - for pfile in src/*.pre; do \ - gfile=`echo $${pfile} | sed s/\.pre/\.gen\.c/`; \ - echo "/* DO NOT EDIT, autogenerated from $${pfile} */" > "$${gfile}"; \ - echo "/* Modify $${pfile} then run make generate-code */" >> "$${gfile}"; \ - cat $${pfile} | $(CC) -E - | grep -v "^#" > "$${gfile}.tmp"; \ - sed -i -n -e '/^BEGIN:$$/,$$p' "$${gfile}.tmp"; \ - sed -i 's/^BEGIN:$$//' "$${gfile}.tmp"; \ - cat "$${gfile}.tmp" >> $${gfile}; \ - clang-format -i --verbose "$${gfile}"; \ - rm "$${gfile}.tmp"; \ - done - -generate-docs: - for mdfile in docs/*.md; do \ - echo "Processing $${mdfile}"; \ - manfile=`echo $${mdfile} | sed s/\.md//`; \ - pandoc --standalone --to man $${mdfile} -o $${manfile}; \ - done - -DISTCLEANFILES = \ - *~ - -MAINTAINERCLEANFILES = \ - Makefile.in \ - aclocal.m4 \ - ar-lib compile \ - config.guess \ - config.sub \ - configure \ - depcomp \ - install-sh \ - ltmain.sh \ - m4/* \ - missing \ - test-driver - -EXTRA_DIST = meson.build diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 6838f081..00000000 --- a/configure.ac +++ /dev/null @@ -1,165 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([pkcs11-provider], [0.3], [simo@redhat.com]) -AC_CONFIG_SRCDIR([src/provider.c]) -AC_CONFIG_HEADERS([src/config.h]) -AM_INIT_AUTOMAKE([foreign dist-xz -Wall -Werror]) -AC_CONFIG_MACRO_DIRS([m4]) - -# Checks for programs. -AC_PROG_CC -AM_PROG_AR -LT_INIT -PKG_PROG_PKG_CONFIG - -AX_CHECK_COMPILE_FLAG([-std=c11], - [CFLAGS="$CFLAGS -std=c11"], - AC_MSG_ERROR([C compiler must support at least C11 standard]) -) - -AX_VALGRIND_CHECK() - -STD_CFLAGS="-Wall -Wextra -Wwrite-strings -Wpointer-arith -Wno-missing-field-initializers -Wformat -Wshadow" - -# Temporarily disable unused parameter until the implementation is complete -STD_CFLAGS="$STD_CFLAGS -Wno-unused-parameter" - -# These should be always errors -STD_CFLAGS="$STD_CFLAGS -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=format-security -Werror=parentheses -Werror=implicit -Werror=strict-prototypes" - -# Don't enable warnings on VLA yet, but I would avoid using VLAs -# STD_CFLAGS"$STD_CFLAGS -Werror=vla" - -AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], - [STD_CFLAGS="$STD_CFLAGS -fno-strict-aliasing"]) -AX_CHECK_COMPILE_FLAG([-Werror -fno-delete-null-pointer-checks], - [STD_CFLAGS="$STD_CFLAGS -fno-delete-null-pointer-checks"]) -AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], - [STD_CFLAGS="$STD_CFLAGS -fdiagnostics-show-option"]) - -AC_SUBST([STD_CFLAGS]) - -AC_ARG_WITH([openssl], - [AS_HELP_STRING([--with-openssl],[the path to the OpenSSL files])], - [ - OPENSSL_DIR=${withval} - case "$OPENSSL_DIR" in - # Relative paths - ./*|../*) OPENSSL_DIR="`pwd`/$OPENSSL_DIR" - esac - if test -d "$OPENSSL_DIR/lib64"; then - libcrypto_path="$OPENSSL_DIR/lib64" - elif test -d "$OPENSSL_DIR/lib"; then - libcrypto_path="$OPENSSL_DIR/lib" - else - # Built but not installed - libcrypto_path="$OPENSSL_DIR" - fi - CFLAGS="-I$OPENSSL_DIR/include $CFLAGS" - LDFLAGS="-L${libcrypto_path} ${LDFLAGS}" - LIBS="$LIBS -L${libcrypto_path}" - CRYPTO_LIBS="-lcrypto" - OPENSSL_LIBS="-lcrypto -lssl" - AC_MSG_WARN([Custom openssl located in $OPENSSL_DIR is used, lib version check is skipped]) - ], - [ - # Checks for libraries. - PKG_CHECK_MODULES( - [CRYPTO], - [libcrypto >= 3.0.7], - , - [AC_MSG_ERROR([libcrypto >= 3.0.7 is required])] - ) - PKG_CHECK_MODULES( - [OPENSSL], - [libcrypto >= 3.0.7, libssl], - , - [AC_MSG_ERROR([libcrypto >= 3.0.7 is required])] - ) - ]) - -address_sanitizer_path="no" -AC_MSG_CHECKING(for --with-address-sanitizer) -AC_ARG_WITH(address_sanitizer, - AS_HELP_STRING([--with-address-sanitizer=yes|path_to_libasan.so], - [Enable Address Sanitizer @<:@default=no@:>@]), - [ - address_sanitizer_path=${withval} - CFLAGS="-fsanitize=address -fno-omit-frame-pointer $CFLAGS" - LDFLAGS="-fsanitize=address $LDFLAGS" - ], - [ - address_sanitizer_path="no" - ]) -AS_IF([test "x$address_sanitizer_path" != "xno"], - [AS_IF([test "x$address_sanitizer_path" == "xyes"], - [address_sanitizer_path=`realpath $($CC -print-file-name=libasan.so)`], - [])], - []) - -AC_MSG_RESULT($address_sanitizer_path) -AM_CONDITIONAL([ADDRESS_SANITIZER], [test x${address_sanitizer_path} != xno]) -AC_SUBST(ADDRESS_SANITIZER_PATH, "$address_sanitizer_path") - -AC_SUBST([SHARED_EXT], $(eval echo "${shrext_cmds}")) - -# Check whether we have a p11-kit to use as a default PKCS#11 module -PKG_CHECK_EXISTS([p11-kit-1], - [PKG_CHECK_VAR([DEFAULT_PKCS11_MODULE], - [p11-kit-1], - [proxy_module])], - [AC_MSG_WARN([The P11-kit proxy is not available. No fallback PKCS11 module used.])]) -if test "x$DEFAULT_PKCS11_MODULE" != "x"; then - AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_MODULE], "$DEFAULT_PKCS11_MODULE", - [Default PKCS11 module]) -fi - - -# Try nss-softoken first as used on Fedora, -# fallback to "nss" as used on Debian -PKG_CHECK_EXISTS( - [nss-softokn], - [PKG_CHECK_VAR([SOFTOKENDIR], [nss-softokn], [libdir])], - [PKG_CHECK_EXISTS( - [nss], - [PKG_CHECK_VAR([SOFTOKENDIR], [nss], [libdir])] - )] -) - -if ! test -f $SOFTOKENDIR/libsoftokn3$SHARED_EXT; then - if test -f $SOFTOKENDIR/nss/libsoftokn3$SHARED_EXT; then - AC_SUBST([SOFTOKEN_SUBDIR], "nss/") - else - AC_MSG_WARN([Softoken library missing, tests will fail!]) - fi -fi - -# find p11-kit-client to separate softhsm openssl context from our tests -PKG_CHECK_EXISTS([p11-kit-1], - [PKG_CHECK_VAR([P11_MODULE_PATH], - [p11-kit-1], - [p11_module_path])], - [AC_MSG_WARN([The p11-kit client not found. Can not run SoftHSM tests])]) -if test "$P11_MODULE_PATH" != "" ; then - # p11-kit-client is a module, so its name ends with .so also on macOS! - AC_SUBST([P11KITCLIENTPATH], "$P11_MODULE_PATH/p11-kit-client.so") -fi - -# Checks for header files. -AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([ is not found])]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_CHECK_HEADER_STDBOOL -AC_C_BIGENDIAN -AC_C_INLINE -AC_TYPE_SIZE_T - -AC_CONFIG_FILES([ - Makefile - docs/Makefile - src/Makefile - tests/Makefile -]) -AC_OUTPUT diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index c571d1c1..00000000 --- a/docs/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ - -dist_man_MANS = provider-pkcs11.7 - -EXTRA_DIST = meson.build diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 9e9822d8..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,76 +0,0 @@ - -AM_CFLAGS = $(STD_CFLAGS) - -noinst_HEADERS = \ - asymmetric_cipher.h \ - debug.h \ - encoder.h \ - decoder.h \ - digests.h \ - exchange.h \ - kdf.h \ - keymgmt.h \ - pk11_uri.h \ - interface.h \ - objects.h \ - pkcs11.h \ - platform/endian.h \ - provider.h \ - random.h \ - session.h \ - signature.h \ - slot.h \ - store.h \ - util.h -pkcs11_LTLIBRARIES = pkcs11.la - -SHARED_EXT=@SHARED_EXT@ - -pkcs11dir = $(libdir)/ossl-modules - -pkcs11_la_SOURCES = \ - asymmetric_cipher.c \ - debug.c \ - encoder.c \ - decoder.c \ - digests.c \ - exchange.c \ - kdf.c \ - keymgmt.c \ - pk11_uri.c \ - interface.c \ - objects.c \ - provider.h \ - provider.c \ - random.c \ - session.c \ - signature.c \ - slot.c \ - store.c \ - tls.c \ - util.c \ - provider.exports \ - provider.map \ - $(NULL) - -EXTRA_DIST = \ - interface.gen.c \ - encoder.gen.c \ - pk11_uri.gen.c \ - meson.build \ - $(NULL) - -pkcs11_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS) -Wall -Werror -pkcs11_la_LIBADD = $(CRYPTO_LIBS) - -pkcs11_la_LDFLAGS = \ - $(AM_LDFLAGS) -module \ - -shared -shrext $(SHARED_EXT) \ - -avoid-version \ - -export-symbols "$(srcdir)/provider.exports" - -DISTCLEANFILES = \ - *~ - -MAINTAINERCLEANFILES = \ - Makefile.in config.h.in diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 26c24fd8..00000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,143 +0,0 @@ -EXTRA_DIST = openssl.cnf.in \ - lsan.supp \ - explicit_ec.key.der explicit_ec.pub.der \ - meson.build - -libspath=@abs_top_builddir@/src/.libs -testsblddir=@abs_top_builddir@/tests -testssrcdir=@abs_srcdir@ - -@VALGRIND_CHECK_RULES@ -#VALGRIND_SUPPRESSIONS_FILES = $(top_srcdir)/tests/pkcs11-provider.supp -VALGRIND_FLAGS = --num-callers=30 -q --keep-debuginfo=yes - -check_PROGRAMS = tsession tgenkey tlsctx tdigests tdigest_dupctx treadkeys \ - tcmpkeys tfork pincache tfork_deadlock - -tsession_SOURCES = tsession.c -tsession_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tsession_LDADD = $(OPENSSL_LIBS) - -tgenkey_SOURCES = tgenkey.c -tgenkey_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tgenkey_LDADD = $(OPENSSL_LIBS) - -tlsctx_SOURCES = tlsctx.c -tlsctx_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tlsctx_LDADD = $(OPENSSL_LIBS) - -tdigests_SOURCES = tdigests.c -tdigests_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tdigests_LDADD = $(OPENSSL_LIBS) - -tdigest_dupctx_SOURCES = tdigest_dupctx.c -tdigest_dupctx_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tdigest_dupctx_LDADD = $(OPENSSL_LIBS) - -treadkeys_SOURCES = treadkeys.c -treadkeys_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -treadkeys_LDADD = $(OPENSSL_LIBS) - -tcmpkeys_SOURCES = tcmpkeys.c -tcmpkeys_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tcmpkeys_LDADD = $(OPENSSL_LIBS) - -tfork_SOURCES = tfork.c -tfork_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tfork_LDADD = $(OPENSSL_LIBS) - -pincache_SOURCES = pincache.c -pincache_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -pincache_LDADD = $(OPENSSL_LIBS) - -tfork_deadlock_SOURCES = tfork_deadlock.c -tfork_deadlock_CFLAGS = $(STD_CFLAGS) $(OPENSSL_CFLAGS) -tfork_deadlock_LDADD = $(OPENSSL_LIBS) - -tmp.softokn: - LIBSPATH=$(libspath) \ - TESTSSRCDIR=$(testssrcdir) \ - TESTBLDDIR=$(testsblddir) \ - SHARED_EXT=$(SHARED_EXT) \ - SOFTOKNPATH="$(SOFTOKENDIR)/$(SOFTOKEN_SUBDIR)" \ - $(testssrcdir)/setup-softokn.sh > setup-softokn.log 2>&1 -tmp.softhsm: - LIBSPATH=$(libspath) \ - TESTSSRCDIR=$(testssrcdir) \ - TESTBLDDIR=$(testsblddir) \ - SHARED_EXT=$(SHARED_EXT) \ - P11KITCLIENTPATH="$(P11KITCLIENTPATH)" \ - $(testssrcdir)/setup-softhsm.sh > setup-softhsm.log 2>&1 - -dist_check_SCRIPTS = \ - helpers.sh setup-softhsm.sh setup-softokn.sh softhsm-proxy.sh \ - test-wrapper tbasic tcerts tecc tecdh tedwards tdemoca thkdf \ - toaepsha2 trsapss tdigest ttls tpubkey tforking turi trand tecxc \ - tcms top_state tpem_encoder - -test_LIST = \ - basic-softokn.t basic-softhsm.t \ - pubkey-softokn.t pubkey-softhsm.t \ - certs-softokn.t certs-softhsm.t \ - ecc-softokn.t ecc-softhsm.t \ - edwards-softhsm.t \ - ecdh-softokn.t \ - democa-softokn.t democa-softhsm.t \ - digest-softokn.t digest-softhsm.t \ - forking-softokn.t forking-softhsm.t \ - oaepsha2-softokn.t \ - hkdf-softokn.t \ - rsapss-softokn.t \ - genkey-softokn.t genkey-softhsm.t \ - session-softokn.t session-softhsm.t \ - rand-softokn.t rand-softhsm.t \ - readkeys-softokn.t readkeys-softhsm.t \ - tls-softokn.t tls-softhsm.t \ - uri-softokn.t uri-softhsm.t \ - ecxc-softhsm.t \ - cms-softokn.t \ - op_state-softhsm.t \ - pem_encoder-softokn.t pem_encoder-softhsm.t - -.PHONY: $(test_LIST) - -TESTS = $(test_LIST) - -AM_TESTS_ENVIRONMENT = \ - export LC_ALL='C'; - -TEST_EXTENSIONS = .t -T_LOG_COMPILER = $(testssrcdir)/test-wrapper - -if ADDRESS_SANITIZER -# Avoids closing dlopened libraries for ASan to be able to print usable traces -FAKE_DLCLOSE=.libs/fake_dlclose.so -lib_LTLIBRARIES = fake_dlclose.la -fake_dlclose_la_SOURCES = fake_dlclose.c -fake_dlclose_la_CFLAGS = $(AM_CFLAGS) -Wall -Werror -fake_dlclose_la_LDFLAGS = $(AM_LDFLAGS) -module -shared -avoid-version - -# LD_PRELOAD is needed before invoking openssl as it is not instrumented with -# asan and asan needs to be loaded as a firs dynamic library of the process. -AM_TESTS_ENVIRONMENT += \ - export ASAN_OPTIONS='fast_unwind_on_malloc=0'; \ - export LSAN_OPTIONS='suppressions=$(testssrcdir)/lsan.supp'; \ - export DLCLOSE='$(testsblddir)/$(FAKE_DLCLOSE)'; \ - export CHECKER='env LD_PRELOAD=$(ADDRESS_SANITIZER_PATH):$(testsblddir)/$(FAKE_DLCLOSE)'; -endif - -$(TESTS): tmp.softokn tmp.softhsm $(FAKE_DLCLOSE) - -CLEANFILES = \ - setup-*.log \ - pinfile.txt - -clean-local: - rm -Rf tmp.softhsm - rm -Rf tmp.softokn - -DISTCLEANFILES = \ - *~ - -MAINTAINERCLEANFILES = \ - Makefile.in