krb5: Build pkgconfig files with libraries

For various reasons, trying to build 32-bit compatibility PCFILES
outside of a directory which is not a library doesn't work. Add a
new krb5/Makefile.pc with the build rule for .pc.in.pc, and use
this to build each pc file along with the library it's associated
with.

This means we automatically get 32-bit pcfiles in /usr/lib32, and
is arguably more correct anyway since if we don't build a library
for some reason, we also won't build its pcfiles.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D51986
This commit is contained in:
Lexi Winter 2025-08-18 18:45:26 +01:00
parent 131b3b5751
commit ce9c325a2e
8 changed files with 62 additions and 49 deletions

View file

@ -1,7 +1,7 @@
SUBDIR= util .WAIT \
include .WAIT \
lib .WAIT\
plugins libdata libexec usr.bin usr.sbin
plugins libexec usr.bin usr.sbin
# SUBDIR_PARALLEL=
.include <bsd.subdir.mk>

View file

@ -2,26 +2,15 @@
#
# SPDX-License-Identifier: BSD-2-Clause OR ISC
.include "../Makefile.inc"
.PATH: ${KRB5_DIR}/build-tools
PACKAGE=kerberos-lib
PCFILES=gssrpc.pc \
kadm-client.pc \
kadm-server.pc \
kdb.pc \
krb5.pc \
krb5-gssapi.pc \
mit-krb5.pc \
mit-krb5-gssapi.pc
CLEANFILES+= ${PCFILES}
.SUFFIXES: .pc .pc.in
.pc.in.pc:
@if ! grep -q "^PACKAGE_VERSION='${KRB5_VERSION}'$$" ${KRB5_DIR}/configure; then \
echo "KRB5_VERSION ${KRB5_VERSION} does not match the source:"; \
grep "^PACKAGE_VERSION=" ${KRB5_DIR}/configure; \
exit 1; \
fi >&2
sed -e 's,@prefix@,/usr,g ; \
s,@exec_prefix@,$${prefix},g ; \
s,@libdir@,${LIBDIR},g ; \
@ -33,12 +22,3 @@ CLEANFILES+= ${PCFILES}
s,@DEFCKTNAME@,FILE:/var/krb5/user/%{euid}/client.keytab,g ; \
s,@COM_ERR_LIB@,-lcom_err,g ;' \
${.IMPSRC} > ${.TARGET}
all: ${PCFILES}
@if ! grep -q "^PACKAGE_VERSION='${KRB5_VERSION}'$$" ${KRB5_DIR}/configure; then \
echo "KRB5_VERSION ${KRB5_VERSION} does not match the source:"; \
grep "^PACKAGE_VERSION=" ${KRB5_DIR}/configure; \
exit 1; \
fi >&2
.include <bsd.lib.mk>

View file

@ -10,12 +10,15 @@
.include <src.opts.mk>
.include "../Makefile.inc"
.include "${KRB5_SRCTOP}/Makefile.pc"
LIB= gssapi_krb5
# SHLIB_MAJOR= 2
LDFLAGS=-Wl,--no-undefined
LIBADD= krb5 k5crypto com_err krb5profile krb5support
LDFLAGS= -Wl,--no-undefined
LIBADD= krb5 k5crypto com_err krb5profile krb5support
VERSION_MAP= ${.CURDIR}/version.map
PCFILES= krb5-gssapi.pc \
mit-krb5-gssapi.pc
CLEANFILES+= ${PCFILES}
# This is a contcatonation of:
# crypto/krb5/src/lib/gssapi/libgssapi_krb5.exports
@ -44,4 +47,8 @@ CFLAGS+=${DEFINES} \
.include <bsd.lib.mk>
all: ${PCFILES}
.SUFFIXES: .h .c .et
.PATH: ${KRB5_DIR}/build-tools

View file

@ -10,12 +10,14 @@
.include <src.opts.mk>
.include "../Makefile.inc"
.include "${KRB5_SRCTOP}/Makefile.pc"
LIB= kadm5clnt_mit
# SHLIB_MAJOR= 12
LDFLAGS=-Wl,--no-undefined
LIBADD= krb5profile gssrpc gssapi_krb5 krb5 k5crypto krb5support com_err
LDFLAGS= -Wl,--no-undefined
LIBADD= krb5profile gssrpc gssapi_krb5 krb5 k5crypto krb5support com_err
VERSION_MAP= ${.CURDIR}/version.map
PCFILES= kadm-client.pc
CLEANFILES+= ${PCFILES}
SRCS= alt_prof.c \
chpass_util.c \
@ -88,6 +90,9 @@ afterinstall:
.include <bsd.lib.mk>
all: ${PCFILES}
.SUFFIXES: .h .c
.PATH: ${KRB5_DIR}/lib/kadm5
.PATH: ${KRB5_DIR}/build-tools \
${KRB5_DIR}/lib/kadm5

View file

@ -10,12 +10,14 @@
.include <src.opts.mk>
.include "../Makefile.inc"
.include "${KRB5_SRCTOP}/Makefile.pc"
LIB= kadm5srv_mit
# SHLIB_MAJOR= 12
LDFLAGS=-Wl,--no-undefined
LIBADD= krb5profile gssrpc gssapi_krb5 kdb5 krb5 k5crypto krb5support com_err
LDFLAGS= -Wl,--no-undefined
LIBADD= krb5profile gssrpc gssapi_krb5 kdb5 krb5 k5crypto krb5support com_err
VERSION_MAP= ${.CURDIR}/version.map
PCFILES= kadm-server.pc
CLEANFILES+= ${PCFILES}
SRCS= alt_prof.c \
chpass_util.c \
@ -88,6 +90,9 @@ ${GEN_CHPASS_UTIL_STRINGS_C}: ${GEN_CHPASS_UTIL_STRINGS}
.include <bsd.lib.mk>
all: ${PCFILES}
.SUFFIXES: .h .c .et
.PATH: ${KRB5_DIR}/lib/kadm5
.PATH: ${KRB5_DIR}/build-tools \
${KRB5_DIR}/lib/kadm5

View file

@ -10,12 +10,14 @@
.include <src.opts.mk>
.include "../Makefile.inc"
.include "${KRB5_SRCTOP}/Makefile.pc"
LIB= kdb5
# SHLIB_MAJOR= 10
LDFLAGS=-Wl,--no-undefined
LIBADD= krb5profile gssrpc krb5 k5crypto com_err krb5support gssapi_krb5
LDFLAGS= -Wl,--no-undefined
LIBADD= krb5profile gssrpc krb5 k5crypto com_err krb5support gssapi_krb5
VERSION_MAP= ${.CURDIR}/version.map
PCFILES= kdb.pc
CLEANFILES+= ${PCFILES}
SRCS= decrypt_key.c \
encrypt_key.c \
@ -60,6 +62,9 @@ ${ADB_ERR_C}: ${ADB_ERR}
.include <bsd.lib.mk>
all: ${PCFILES}
.SUFFIXES: .h .c
.PATH: ${KRB5_DIR}/lib/kdb
.PATH: ${KRB5_DIR}/build-tools \
${KRB5_DIR}/lib/kdb

View file

@ -10,12 +10,15 @@
.include <src.opts.mk>
.include "../Makefile.inc"
.include "${KRB5_SRCTOP}/Makefile.pc"
LIB= krb5
LDFLAGS=-Wl,--no-undefined
LIBADD= krb5profile k5crypto com_err krb5support
# SHLIB_MAJOR= 3
LDFLAGS= -Wl,--no-undefined
LIBADD= krb5profile k5crypto com_err krb5support
VERSION_MAP= ${.CURDIR}/version.map
PCFILES= krb5.pc \
mit-krb5.pc
CLEANFILES+= ${PCFILES}
SRCS= krb5_libinit.c
@ -67,6 +70,8 @@ KDCPACKAGE= kerberos-kdc
.include <bsd.lib.mk>
all: ${PCFILES}
.SUFFIXES: .et .man
.man.5:
@ -75,5 +80,6 @@ KDCPACKAGE= kerberos-kdc
.man.7:
@cp ${.ALLSRC} ${.TARGET}
.PATH: ${KRB5_DIR}/lib/krb5 \
.PATH: ${KRB5_DIR}/build-tools \
${KRB5_DIR}/lib/krb5 \
${KRB5_DIR}/man

View file

@ -10,12 +10,14 @@
.include <src.opts.mk>
.include "../Makefile.inc"
.include "${KRB5_SRCTOP}/Makefile.pc"
LIB= gssrpc
# SHLIB_MAJOR= 4
LDFLAGS=-Wl,--no-undefined
LIBADD= gssapi_krb5 krb5 k5crypto com_err krb5support
LDFLAGS= -Wl,--no-undefined
LIBADD= gssapi_krb5 krb5 k5crypto com_err krb5support
VERSION_MAP= ${.CURDIR}/version.map
PCFILES= gssrpc.pc
CLEANFILES+= ${PCFILES}
SRCS= auth_gss.c \
auth_gssapi.c \
@ -75,4 +77,7 @@ CFLAGS+=-I${KRB5_DIR}/lib/rpc \
.include <bsd.lib.mk>
.PATH: ${KRB5_DIR}/lib/rpc
all: ${PCFILES}
.PATH: ${KRB5_DIR}/build-tools \
${KRB5_DIR}/lib/rpc