summaryrefslogtreecommitdiffstats
path: root/external/openldap
diff options
context:
space:
mode:
Diffstat (limited to 'external/openldap')
-rw-r--r--external/openldap/ExternalProject_openldap.mk65
-rw-r--r--external/openldap/Makefile7
-rw-r--r--external/openldap/Module_openldap.mk17
-rw-r--r--external/openldap/README3
-rw-r--r--external/openldap/UnpackedTarball_openldap.mk26
-rw-r--r--external/openldap/configure-c99.patch11
-rw-r--r--external/openldap/openldap-2.4.44.patch.185
7 files changed, 214 insertions, 0 deletions
diff --git a/external/openldap/ExternalProject_openldap.mk b/external/openldap/ExternalProject_openldap.mk
new file mode 100644
index 000000000..5f85fb323
--- /dev/null
+++ b/external/openldap/ExternalProject_openldap.mk
@@ -0,0 +1,65 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,openldap))
+
+$(eval $(call gb_ExternalProject_use_externals,openldap,nss3))
+
+$(eval $(call gb_ExternalProject_register_targets,openldap,\
+ build \
+))
+
+openldap_CFLAGS =
+ifeq ($(OS),LINUX) # i.e., assuming glibc
+# glibc needs at least _XOPEN_SOURCE=500 to declare pthread_getconcurrency and
+# pthread_setconcurrency in <pthread.h> (and once that is defined, it also needs either
+# _DEFUALT_SOURCE (glibc >= 2.19) or the deprecated _BSD_SOURCE (glibc <= 2.18) to be defined
+# explicitly, so that e.g. u_char is declared in <sys/types.h>):
+openldap_CFLAGS = -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_BSD_SOURCE
+endif
+
+openldap_LDFLAGS = $(call gb_ExternalProject_get_link_flags,openldap)
+ifeq ($(SYSTEM_NSS),)
+openldap_LDFLAGS += -L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib \
+ $(if $(filter AIX,$(OS)),-Wl$(COMMA)-brtl)
+endif
+# Help openldap's configure determine that it needs -lpthread even if libasan.so
+# contains a pthread_create override:
+ifneq ($(filter -fsanitize=address,$(CC)),)
+openldap_LDFLAGS += -pthread
+endif
+
+$(call gb_ExternalProject_get_state_target,openldap,build) :
+ $(call gb_Trace_StartRange,openldap,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(gb_RUN_CONFIGURE) ./configure \
+ --disable-slapd \
+ --with-pic \
+ --with-tls=moznss \
+ --without-cyrus-sasl \
+ --disable-shared \
+ --enable-static \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(CROSS_COMPILING), \
+ --with-yielding_select=yes \
+ ac_cv_func_memcmp_working=yes \
+ ) \
+ $(if $(SYSTEM_NSS), \
+ CPPFLAGS="$(CPPFLAGS) $(NSS_CFLAGS)" CFLAGS="$(CFLAGS) $(openldap_CFLAGS) $(NSS_CFLAGS) $(call gb_ExternalProject_get_build_flags,openldap)" LDFLAGS="$(LDFLAGS) $(NSS_LIBS)" \
+ , \
+ CPPFLAGS="$(CPPFLAGS) -I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss -I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" \
+ CFLAGS="$(CFLAGS) $(openldap_CFLAGS) $(call gb_ExternalProject_get_build_flags,openldap) -I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss -I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" \
+ ) \
+ $(if $(openldap_LDFLAGS),LDFLAGS="$(LDFLAGS) $(openldap_LDFLAGS)") \
+ && MAKEFLAGS= && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,openldap,EXTERNAL)
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openldap/Makefile b/external/openldap/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/openldap/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openldap/Module_openldap.mk b/external/openldap/Module_openldap.mk
new file mode 100644
index 000000000..c6a22bc4e
--- /dev/null
+++ b/external/openldap/Module_openldap.mk
@@ -0,0 +1,17 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,openldap))
+
+$(eval $(call gb_Module_add_targets,openldap,\
+ ExternalProject_openldap \
+ UnpackedTarball_openldap \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openldap/README b/external/openldap/README
new file mode 100644
index 000000000..0c1828c12
--- /dev/null
+++ b/external/openldap/README
@@ -0,0 +1,3 @@
+OpenLDAP provides an LDAP client library
+
+http://www.openldap.org/
diff --git a/external/openldap/UnpackedTarball_openldap.mk b/external/openldap/UnpackedTarball_openldap.mk
new file mode 100644
index 000000000..999a1edda
--- /dev/null
+++ b/external/openldap/UnpackedTarball_openldap.mk
@@ -0,0 +1,26 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,openldap))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,openldap,$(OPENLDAP_TARBALL),,openldap))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,openldap,0))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,openldap,\
+ build \
+ contrib/ldapc++ \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,openldap,\
+ external/openldap/openldap-2.4.44.patch.1 \
+ external/openldap/configure-c99.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openldap/configure-c99.patch b/external/openldap/configure-c99.patch
new file mode 100644
index 000000000..f1c3da6c4
--- /dev/null
+++ b/external/openldap/configure-c99.patch
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -14691,7 +14691,7 @@
+ #include <sys/types.h>
+ #include <regex.h>
+ static char *pattern, *string;
+-main()
++int main()
+ {
+ int rc;
+ regex_t re;
diff --git a/external/openldap/openldap-2.4.44.patch.1 b/external/openldap/openldap-2.4.44.patch.1
new file mode 100644
index 000000000..317ef9a62
--- /dev/null
+++ b/external/openldap/openldap-2.4.44.patch.1
@@ -0,0 +1,85 @@
+-*- Mode: diff -*-
+--- openldap.org/configure
++++ openldap/configure
+@@ -15735,7 +15735,7 @@
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lnss3 $LIBS"
++LIBS="-lnss3 -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+--- openldap.org/configure.in
++++ openldap/configure.in
+@@ -1239,7 +1239,8 @@
+ AC_CHECK_HEADERS([nssutil.h])
+ if test "$ac_cv_header_nssutil_h" = yes ; then
+ AC_CHECK_LIB([nss3], [NSS_Initialize],
+- [ have_moznss=yes ], [ have_moznss=no ])
++ [ have_moznss=yes ], [ have_moznss=no ],
++ [ -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 ])
+ fi
+
+ if test "$have_moznss" = yes ; then
+--- openldap.org/libraries/libldap/tls_m.c
++++ openldap/libraries/libldap/tls_m.c
+@@ -49,17 +49,17 @@
+ #include <termios.h> /* for echo on/off */
+ #endif
+
+-#include <nspr/nspr.h>
+-#include <nspr/private/pprio.h>
+-#include <nss/nss.h>
+-#include <nss/ssl.h>
+-#include <nss/sslerr.h>
+-#include <nss/sslproto.h>
+-#include <nss/pk11pub.h>
+-#include <nss/secerr.h>
+-#include <nss/keyhi.h>
+-#include <nss/secmod.h>
+-#include <nss/cert.h>
++#include <nspr.h>
++#include <private/pprio.h>
++#include <nss.h>
++#include <ssl.h>
++#include <sslerr.h>
++#include <sslproto.h>
++#include <pk11pub.h>
++#include <secerr.h>
++#include <keyhi.h>
++#include <secmod.h>
++#include <cert.h>
+
+ #undef NSS_VERSION_INT
+ #define NSS_VERSION_INT ((NSS_VMAJOR << 24) | (NSS_VMINOR << 16) | \
+--- openldap.org/libraries/libldap/tls2.c
++++ openldap.org/libraries/libldap/tls2.c
+@@ -80,6 +80,8 @@
+ { BER_BVNULL, BER_BVNULL }
+ };
+
++int ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in );
++
+ #ifdef HAVE_TLS
+
+ void
+--- openldap.org/Makefile.in
++++ openldap/Makefile.in
+@@ -13,7 +13,7 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
+
+-SUBDIRS= include libraries clients servers tests doc
++SUBDIRS= include libraries
+ CLEANDIRS=
+ INSTALLDIRS=
+
+@@ -32,7 +32,3 @@
+ $(RM) config.status libtool stamp-h stamp-h.in
+
+ distclean: veryclean FORCE
+-
+-check: test
+-test: FORCE
+- cd tests; $(MAKE) test