Charlie Li 4f0eba1efd
python.mk: rename PYTHON_EXT_SUFFIX to PYTHON_TAG, document, etc
EXT_SUFFIX, according to PEP 3149, refers to the full tag and
extension for compiled extension module objects, eg .cpython-311.so,
.cpython-313t.so, etc. We do not use the correct semantic meaning,
and this usage becomes ambiguous and confusing when tags do not
match between bytecode and compiled extension module objects.

Rename our PYTHON_EXT_SUFFIX to PYTHON_TAG to align with PEP 3147's
specification of a magic tag, which consists of implementation name
and shorthand version only. This is meant for bytecode and other
files containing this tag in their filename that do not depend on
a specific Python ABI for the same version. Chase all existing
consumers.

Introduce PYTHON_SOABI to align with PEP 3149's specification of a
tag, which consists of implementation name, shorthand version and
any ABI flags present (this and PYTHON_TAG are identical without
ABI flags). This is meant for compiled extension module objects and
other files that depend on a specific Python ABI for the same
version.

Add documentation for these variables that our PYTHON_EXT_SUFFIX
never had.

PR: 274671
Event: Kitchener-Waterloo Hackathon 202506
2025-06-19 16:28:47 -04:00

144 lines
4.5 KiB
Makefile

PORTNAME= ldb
PORTVERSION= 2.9.2
PORTREVISION= 2
CATEGORIES= databases
MASTER_SITES= SAMBA
PKGNAMESUFFIX?= ${PORTVERSION:C/([[:digit:]]+)[.]([[:digit:]]+).*/\1\2/}
MAINTAINER= samba@FreeBSD.org
COMMENT= LDAP-like embedded database
WWW= https://ldb.samba.org/
LICENSE= GPLv3+
IGNORE_NONTHREAD_PYTHON= needs port lang/python${PYTHON_SUFFIX} to be \
build with THREADS support
BUILD_DEPENDS= ${_LDB_DEPENDS} \
cmocka>=1.1.3:sysutils/cmocka
RUN_DEPENDS= ${_LDB_DEPENDS}
TEST_DEPENDS= ${_LDB_DEPENDS} \
cmocka>=1.1.3:sysutils/cmocka
USES= compiler ldap localbase:ldflags pkgconfig
USE_LDCONFIG= yes
HAS_CONFIGURE= yes
CONFIGURE_LOG= ${BUILD_WRKSRC}/bin/config.log
PKGCONFIGDIR?= ${PREFIX}/libdata/pkgconfig
CONFIGURE_ARGS+= --bundled-libraries=!talloc,!tevent,!tdb,!popt,!cmocka \
--disable-rpath \
--with-modulesdir=${PREFIX}/lib/shared-modules \
--with-openldap=${LOCALBASE} \
--with-privatelibdir=${PREFIX}/lib/ldb \
--without-gettext
CONFIGURE_ENV+= NOCOLOR=yes
MAKE_ENV+= NOCOLOR=yes
CFLAGS+= ${_CFLAGS_${COMPILER_TYPE}}
DEBUG_FLAGS= -g -ggdb3 -O0
# Some symbols in ldb's linker version scripts are not defined, but since the
# scripts are generated dynamically, suppress errors with lld >= 17 due to these
# undefined symbols.
LDFLAGS+= -Wl,--undefined-version
CONFLICTS_INSTALL= ldb[0-9][0-9] # include/ldb.h
BINARY_ALIAS= python3=${PYTHON_CMD}
PLIST_FILES= ${_LDB_BINS} \
${_LDB_LIBS_64} \
${_LDB_LIBS} \
${PKGCONFIGDIR}/ldb.pc \
include/ldb.h \
include/ldb_errors.h \
include/ldb_handlers.h \
include/ldb_module.h \
include/ldb_version.h
PLIST_SUB+= PKGCONFIGDIR=${PKGCONFIGDIR:S;${PREFIX}/;;}
OPTIONS_DEFINE= MANPAGES PYTHON3
OPTIONS_DEFAULT= MANPAGES PYTHON3
MANPAGES_BUILD_DEPENDS= ${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl \
xsltproc:textproc/libxslt
MANPAGES_CONFIGURE_ENV_OFF= XSLTPROC="false"
PYTHON3_USES= gettext-runtime python
PYTHON3_USES_OFF= python:build,test
PYTHON3_CONFIGURE_OFF= --disable-python
PYTHON3_PLIST_FILES= ${PKGCONFIGDIR}/pyldb-util${PYTHON_TAG}.pc \
${PYTHON_SITELIBDIR}/_ldb_text.py \
${PYTHON_SITELIBDIR}/ldb${PYTHON_TAG}.so \
include/pyldb.h \
lib/libpyldb-util${PYTHON_TAG}.so \
lib/libpyldb-util${PYTHON_TAG}.so.2
# No fancy color error messages
_CFLAGS_clang= -fno-color-diagnostics
_LDB_DEPENDS= talloc242>=2.4.2:devel/talloc242 tevent016>=0.16.0:devel/tevent016 \
tdb1410>=1.4.10:databases/tdb1410 lmdb>=0.9.23:databases/lmdb \
popt>=0:devel/popt
_LDB_BINS= bin/ldbedit bin/ldbmodify bin/ldbadd bin/ldbdel bin/ldbsearch \
bin/ldbrename
_LDB_LIBS= lib/libldb.so lib/libldb.so.2 lib/ldb/libldb-tdb-int.so \
lib/ldb/libldb-tdb-err-map.so lib/ldb/libldb-key-value.so \
lib/ldb/libldb-cmdline.so lib/shared-modules/ldb/skel.so \
lib/shared-modules/ldb/server_sort.so \
lib/shared-modules/ldb/sample.so \
lib/shared-modules/ldb/rdn_name.so \
lib/shared-modules/ldb/paged_searches.so \
lib/shared-modules/ldb/ldb.so lib/shared-modules/ldb/ldap.so \
lib/shared-modules/ldb/asq.so lib/shared-modules/ldb/tdb.so
_LDB_MAN1= share/man/man1/ldbadd.1.gz share/man/man1/ldbdel.1.gz \
share/man/man1/ldbedit.1.gz share/man/man1/ldbmodify.1.gz \
share/man/man1/ldbrename.1.gz share/man/man1/ldbsearch.1.gz
_LDB_MAN3= share/man/man3/ldb.3.gz
.include <bsd.port.options.mk>
.if defined(WITH_DEBUG)
CONFIGURE_ARGS+= --enable-debug \
--verbose
.endif
# Only for 64-bit architectures
.if ${ARCH} != armv6 && ${ARCH} != armv7 && ${ARCH} != i386 && ${ARCH} != mips && \
${ARCH} != powerpc && ${ARCH} != powerpcspe
_LDB_LIBS_64= lib/ldb/libldb-mdb-int.so lib/shared-modules/ldb/mdb.so
.endif
.if ${PORT_OPTIONS:MMANPAGES}
PLIST_FILES+= ${_LDB_MAN1} \
${_LDB_MAN3}
.endif
.if defined(NO_PYTHON)
WARNING+= "${PKGNAME} does not support NO_PYTHON anymore; use option PYTHON3 instead"
.endif
post-patch:
@${REINPLACE_CMD} -e 's|%%PKGCONFIGDIR%%|${PKGCONFIGDIR}|g' \
${BUILD_WRKSRC}/wscript
# Use threading (or multiprocessing) but not thread (renamed in python 3+).
pre-configure:
@if ! ${PYTHON_CMD} -c "import multiprocessing;" 2>/dev/null; then \
${ECHO_CMD}; \
${ECHO_MSG} "===> ${PKGNAME} "${IGNORE_NONTHREAD_PYTHON:Q}.; \
${ECHO_CMD}; \
${FALSE}; \
fi
post-install:
.for lib in ${_LDB_BINS} ${_LDB_LIBS} ${_LDB_LIBS_64}
${STRIP_CMD} ${STAGEDIR}${PREFIX}/${lib}
.endfor
post-install-PYTHON3-on:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libpyldb-util${PYTHON_TAG}.so
${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/ldb${PYTHON_TAG}.so
.include <bsd.port.mk>