kumquat-buildroot/package/libest/0002-Add-enable-disable-examples-flag-to-toggle-examples-.patch
Aleksandr Makarov f6f0e1e581 package/libest: new package
libest is a C implementation of RFC 7030 (Enrollment over
Secure Transport).

It can be used to provision public key certificates from
a certificate authority (CA) or registration authority (RA)
to end-user devices and network infrastructure devices.

https://github.com/cisco/libest

Notes on patches included in this package:

- libest bundles a stubbed version of libsafec, and has no provision
  to build against a system-installed full (non-stubbed) libsafec.
  We add a patch to make that possible.

- Added a configuration option --{enable,disable}-examples to toggle
  examples build by a separate patch.

- There's a configuration option `--enable-jni` which allows to build
  a JNI library for binding libest to Java programs. And that library
  would be using an outdated version of OpenSSL 1.0.
  We fix that by adding support for OpenSSL 1.1 API for that library.

- Fixed a bug when specifying either `--enable-FEATURE` or `--disable-FEATURE`
  has always been enabling the feature.

Signed-off-by: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
[Thomas:
- Added comments about the upstream status in existing patches
- Added a patch fixing an autoreconf issue
- Added a patch adding a missing "extern" on a variable to fix build
  with gcc 10
- Removed the glibc dependency by using the new libexecinfo package
- Drastically simplified the complex libcoap disabling and client-only
  mode vs. OpenJDK issue. libcoap support is now forcefully disabled,
  and client-mode only option is made invisible when OpenJDK is
  enabled.
- Fixed the license information;
- Added missing host-pkgconf
]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-01-08 14:29:27 +01:00

91 lines
3.5 KiB
Diff

From 4bd41ea12924161baca48add39ba5ecfab2cae30 Mon Sep 17 00:00:00 2001
From: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
Date: Mon, 13 Jul 2020 23:42:42 +0000
Subject: [PATCH] Add --{enable,disable}-examples flag to toggle examples
compilation
Upstream: https://github.com/cisco/libest/pull/81/. It was merged
upstream in commit 4fd7e74dc556519132b9ea4c8a0f022bd1254a31, but this
commit mixes multiple patches in one.
Signed-off-by: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
---
Makefile.am | 11 +++++++----
configure.ac | 24 ++++++++++++++++++------
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 9601de6..e2561e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,10 +4,13 @@ if ENABLE_JNI
libest_jni = java/jni
endif
-if ENABLE_CLIENT_ONLY
-SUBDIRS = safe_c_stub src $(libest_jni) example/client example/client-simple example/client-brski
-else
-SUBDIRS = safe_c_stub src $(libest_jni) example/client example/client-simple example/server example/proxy example/client-brski
+if ENABLE_EXAMPLES
+if ENABLE_CLIENT_ONLY
+examples = example/client example/client-simple example/client-brski
+else
+examples = example/client example/client-simple example/client-brski example/server example/proxy
+endif
endif
+SUBDIRS = safe_c_stub src $(libest_jni) $(examples)
EXTRA_DIST = autogen.sh example/util LICENSE README.brski $(srcdir)/build.gradle $(srcdir)/example/build_examples.gradle
diff --git a/configure.ac b/configure.ac
index d648030..95b3223 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,11 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT([libest],[3.2.0p],[libest-dev])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(src/est/est.c)
-AC_CONFIG_SRCDIR(example/client/estclient.c)
-AC_CONFIG_SRCDIR(example/client-simple/estclient-simple.c)
-AC_CONFIG_SRCDIR(example/client-brski/estclient-brski.c)
-AC_CONFIG_SRCDIR(example/server/estserver.c)
-AC_CONFIG_SRCDIR(example/proxy/estproxy.c)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
@@ -80,6 +75,15 @@ AM_COND_IF([DISABLE_PTHREAD], [],
[AC_CHECK_LIB([pthread], [pthread_create], [],
[AC_MSG_FAILURE([can't find pthread lib])])])
+AC_ARG_ENABLE([examples],
+ [AS_HELP_STRING([--disable-examples],
+ [Disable examples compilation])],
+ [],
+ [enable_examples="yes"])
+AC_MSG_CHECKING(whether to build examples)
+AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
+AM_COND_IF([ENABLE_EXAMPLES], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]))
+
AC_ARG_WITH([ssl-dir],
[AS_HELP_STRING([--with-ssl-dir],
[location of OpenSSL install folder, defaults to /usr/local/ssl])],
@@ -198,7 +202,15 @@ AC_PREFIX_DEFAULT([/usr/local/est])
cp confdefs.h est_config.h
-AC_CONFIG_FILES([Makefile version safe_c_stub/Makefile safe_c_stub/lib/Makefile src/Makefile src/est/Makefile example/client/Makefile example/client-simple/Makefile example/client-brski/Makefile example/server/Makefile example/proxy/Makefile])
+AC_CONFIG_FILES([Makefile version safe_c_stub/Makefile safe_c_stub/lib/Makefile src/Makefile src/est/Makefile])
AM_COND_IF([ENABLE_JNI],
[AC_CONFIG_FILES([java/jni/Makefile])])
+AM_COND_IF([ENABLE_EXAMPLES],
+[
+ AC_CONFIG_FILES([example/client/Makefile example/client-simple/Makefile example/client-brski/Makefile])
+ AM_COND_IF([ENABLE_CLIENT_ONLY],
+ [],
+ [AC_CONFIG_FILES([example/server/Makefile example/proxy/Makefile])])
+])
+
AC_OUTPUT
--
2.17.1