summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:11:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:11:40 +0000
commit2886df93860f983d875b7d6acb418faa31491d5a (patch)
treeb596ddcbb70247c1994f3b1d8ba9e793b9788a9d /debian/rules
parentAdding upstream version 2.4.57+dfsg. (diff)
downloadopenldap-debian.tar.xz
openldap-debian.zip
Adding debian version 2.4.57+dfsg-3+deb11u1.debian/2.4.57+dfsg-3+deb11u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules232
1 files changed, 232 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..5b8b75f
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,232 @@
+#!/usr/bin/make -f
+
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/pkg-info.mk
+
+# Set this variable if you're building packages outside of Debian and don't
+# want the checks for DFSG-freeness.
+#DFSG_NONFREE = 1
+
+export DEB_CFLAGS_MAINT_APPEND := -Wall -Wno-format-extra-args -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+export DEB_BUILD_MAINT_OPTIONS := hardening=+pie,+bindnow
+
+# Configure calls AM_INIT_AUTOMAKE, but Automake fails as there is no Makefile.am.
+# Tell dh-autoreconf to skip automake.
+export AUTOMAKE = true
+
+# Expose maintainer address to build/mkversion (see debian/patches/set-maintainer-name)
+export DEB_MAINTAINER := $(shell sed -ne 's/Maintainer:\s\+//p' debian/control)
+
+# Expose DEB_VERSION to build/version.sh (see debian/patches/debian-version)
+export DEB_VERSION
+
+# Workaround for bad glibc behavior when resolving localhost
+export RESOLV_MULTI = off
+
+CONFIG = $(shell grep -v "^\#" debian/configure.options)
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+ CONFIG += --disable-bdb --disable-hdb --disable-mdb
+endif
+ifneq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+ CONFIG += --disable-slapd
+endif
+
+CONTRIB_MODULES = autogroup lastbind passwd passwd/argon2 passwd/pbkdf2 passwd/sha2 smbk5pwd
+
+# Ensure CC is set correctly for cross builds, unless it has already
+# been set explicitly.
+ifeq ($(origin CC),default)
+ export CC := $(DEB_HOST_GNU_TYPE)-gcc
+endif
+
+installdir := $(CURDIR)/debian/tmp
+builddir := $(CURDIR)/debian/build
+slapddir := $(CURDIR)/debian/slapd/usr/sbin
+
+MAKEVARS := STRIP=
+
+# Standard variables used in contrib Makefiles.
+# We override these in make invocations rather than patch every one.
+CONTRIB_MAKEVARS := \
+ LDAP_BUILD='$(builddir)' \
+ prefix=/usr \
+ ldap_subdir=/ldap \
+ moduledir='$$(libdir)$$(ldap_subdir)'
+
+# These variables are used only by get-orig-source, which will normally only
+# be run by maintainers.
+VERSION = $(subst +dfsg,,$(DEB_VERSION_UPSTREAM))
+URL = https://www.openldap.org/software/download/OpenLDAP/openldap-release/
+
+# Download the upstream source and make changes as required for DFSG reasons.
+# Assumes wget is available, as this is generally only used by the package
+# maintainers.
+get-orig-source:
+ @if [ ! -d "debian/schema" ] ; then \
+ echo 'Run this from the top directory of the Debian source' >&2; \
+ exit 1; \
+ fi
+ wget $(URL)/openldap-$(VERSION).tgz
+ tar xzf openldap-$(VERSION).tgz
+ rm -r openldap-$(VERSION)/doc/drafts
+ rm -r openldap-$(VERSION)/doc/rfc
+ set -e; for schema in debian/schema/*.schema debian/schema/*.ldif ; do \
+ file=`basename "$$schema"`; \
+ rm openldap-$(VERSION)/servers/slapd/schema/$$file; \
+ done
+ mv openldap-$(VERSION) openldap-$(VERSION)+dfsg
+ tar cf openldap_$(VERSION)+dfsg.orig.tar openldap-$(VERSION)+dfsg
+ rm -r openldap-$(VERSION)+dfsg
+ gzip -9 openldap_$(VERSION)+dfsg.orig.tar
+
+DH = dh $@ --builddirectory=$(builddir)
+.PHONY: build
+build:
+ $(DH)
+%:
+ $(DH)
+
+# Only contrib/ldapc++ uses Automake, so special care is needed to update
+# config.guess and config.sub at the top level.
+autoreconf:
+ autoreconf -f -i . contrib/ldapc++
+ cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub build/
+
+override_dh_autoreconf:
+ dh_autoreconf debian/rules -- autoreconf
+
+override_dh_auto_configure:
+ # Check if we include the RFCs, Internet-Drafts, or upstream schemas
+ # with RFC text (which are non DFSG-free). You can set DFSG_NONFREE
+ # to build the packages from the unchanged upstream sources but Debian
+ # can not ship the RFCs in main so this test is here to make sure it
+ # does not get in by accident again. -- Torsten
+ if [ -z "$(DFSG_NONFREE)" ]; then \
+ if [ -e doc/drafts ] || [ -e doc/rfc ]; then exit 1; fi; \
+ if [ -e servers/slapd/schema/core.schema ] \
+ && grep -q 'RFC 4519 definition' servers/slapd/schema/core.schema; \
+ then \
+ exit 1; \
+ fi; \
+ fi
+
+ # Copy our stripped schema versions into where upstream expects them.
+ if [ -z "$(DFSG_NONFREE)" ]; then \
+ cp debian/schema/*.schema debian/schema/*.ldif \
+ servers/slapd/schema/; \
+ fi
+
+ dh_auto_configure -- $(CONFIG)
+
+override_dh_auto_build:
+ dh_auto_build -- $(MAKEVARS)
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+ for mod in $(CONTRIB_MODULES); do \
+ dh_auto_build -Dcontrib/slapd-modules/$$mod -Bcontrib/slapd-modules/$$mod -- $(CONTRIB_MAKEVARS) || exit $$?; \
+ done
+endif
+
+override_dh_auto_test:
+ifeq ($(DEB_HOST_ARCH),ppc64el)
+ # Disable test060-mt-host on ppc64el until #866122 is fixed.
+ rm -f tests/scripts/test060-mt-hot
+endif
+ dh_auto_test
+
+override_dh_auto_install:
+ dh_auto_install -- $(MAKEVARS)
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+ for mod in $(CONTRIB_MODULES); do \
+ dh_auto_install -Dcontrib/slapd-modules/$$mod -Bcontrib/slapd-modules/$$mod -- $(CONTRIB_MAKEVARS) || exit $$?; \
+ done
+
+ # Empty the dependency_libs file in the .la files.
+ for F in $(installdir)/usr/lib/ldap/*.la; do \
+ sed -i "s/^dependency_libs=.*/dependency_libs=''/" $$F; \
+ done
+endif
+
+ # Check all built libraries for unresolved symbols except for the
+ # libslapi library. It is a special case since the SLAPI interface
+ # depends on symbols defined in slapd itself. Those symbols will
+ # remain unresolved until the plugin is loaded into slapd.
+ for F in $(installdir)/usr/lib/$(DEB_HOST_MULTIARCH)/*.so.*.*.*; do \
+ if echo "$$F" | grep -q libslapi ; then \
+ continue; \
+ fi; \
+ if LD_LIBRARY_PATH=$(installdir)/usr/lib/$(DEB_HOST_MULTIARCH) ldd -d -r $$F 2>&1 | grep '^undefined symbol:'; then \
+ echo; \
+ echo "library $$F has undefined references. Please fix this before continuing."; \
+ exit 1; \
+ fi; \
+ done
+
+ # Upstream manpages are section 8C but installed as section 8
+ find $(installdir)/usr/share/man -name \*.8 \
+ | xargs perl -pi -e 's#(\.TH \w+ 8)C#$$1#'
+
+override_dh_installinit:
+ dh_installinit -- "defaults 19 80"
+
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+override_dh_installman:
+ dh_installman
+ rm -f $(CURDIR)/debian/slapd/usr/share/man/man5/slapo-smbk5pwd.*
+
+override_dh_fixperms-arch:
+ dh_fixperms
+ chmod +x $(CURDIR)/debian/slapd/usr/share/slapd/ldiftopasswd
+endif
+
+override_dh_strip:
+ dh_strip -plibldap-2.4-2 --dbgsym-migration='libldap-2.4-2-dbg (<< 2.4.45+dfsg-1~)'
+ dh_strip -pslapd --dbgsym-migration='slapd-dbg (<< 2.4.45+dfsg-1~)'
+ dh_strip --remaining-packages
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+ # hardlink these so not confined by apparmor; do this here and not
+ # in dh_link so that dh_strip doesn't get confused and put the wrong
+ # binary in the debug package.
+ for f in slapacl slapadd slapauth slapcat slapdn slapindex slappasswd slaptest slapschema ; do \
+ ln -f $(slapddir)/slapd $(slapddir)/$$f ; \
+ done
+endif
+
+override_dh_link:
+ for pkg in libldap2-dev libldap-2.4-2; do \
+ sed -e"s/\$${DEB_HOST_MULTIARCH}/$(DEB_HOST_MULTIARCH)/g" < debian/$$pkg.links.in > debian/$$pkg.links; \
+ done
+ dh_link
+
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+override_dh_makeshlibs:
+ echo "slapd:Provides=$$(objdump -p debian/slapd/usr/lib/$(DEB_HOST_MULTIARCH)/libslapi-*.so.* \
+ | sed -ne '/SONAME/ { s/[[:space:]]*SONAME[[:space:]]*//; \
+ s/\.so\./-/; p; q }' \
+ )" >> debian/slapd.substvars
+ dh_makeshlibs -pslapd -X/usr/lib/ldap/ -V "$$(sed -ne's/slapd:Provides=//p' debian/slapd.substvars)"
+ dh_makeshlibs --remaining-packages
+endif
+
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+override_dh_installdeb:
+ dh_installdeb
+ perl -w debian/dh_installscripts-common -p slapd
+endif
+
+override_dh_auto_clean:
+ dh_auto_clean
+ # Update translation templates for debconf
+ debconf-updatepo
+ifeq ($(filter pkg.openldap.noslapd,$(DEB_BUILD_PROFILES)),)
+ # Remove our stripped schema from the upstream source area.
+ if [ -z "$(DFSG_NONFREE)" ]; then \
+ set -e; for s in debian/schema/*.schema debian/schema/*.ldif; do \
+ rm -f servers/slapd/schema/`basename $$s`; \
+ done; \
+ fi
+
+ # Clean the contrib directory
+ for mod in $(CONTRIB_MODULES); do \
+ dh_auto_clean -Dcontrib/slapd-modules/$$mod -Bcontrib/slapd-modules/$$mod || exit $?; \
+ done
+endif