Normalize the g(eom,cache,part,...) build.

Rather then combining hardlink creation for the geom(8) binary with
shared library build, move libraries to src/lib/geom so they are
built and installed normally.  Create a common Makefile.classes
which is included by both lib/geom/Makefile and sbin/geom/Makefile
so the symlink and libraries stay in sync.

The relocation of libraries allows libraries to be build for 32-bit
compat.  This also reduces the number of non-standard builds in
the system.

This commit is not sufficent to run a 32-bit /sbin/geom on a 64-bit
system out of the box as it will look in the wrong place for libraries
unless GEOM_LIBRARY_PATH is set appropriatly in the environment.

Reviewed by:	bdrewery
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15360
This commit is contained in:
Brooks Davis 2018-06-25 19:55:15 +00:00
parent 9c42fa94a6
commit e4b0a90e77
77 changed files with 55 additions and 85 deletions

View File

@ -952,7 +952,7 @@ _worldtmp: .PHONY
@touch ${WORLDTMP}/${.TARGET}
.for _dir in \
lib lib/casper usr legacy/bin legacy/usr
lib lib/casper lib/geom usr legacy/bin legacy/usr
mkdir -p ${WORLDTMP}/${_dir}
.endfor
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
@ -2507,6 +2507,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_cddl_lib_libavl} \
${_cddl_lib_libzfs_core} \
${_cddl_lib_libctf} \
lib/libufs \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
${_secure_lib_libssh} ${_secure_lib_libssl}

View File

@ -8,6 +8,8 @@
lib32
dtrace
..
geom
..
i18n
..
..

View File

@ -24,6 +24,7 @@ SUBDIR_BOOTSTRAP= \
SUBDIR= ${SUBDIR_BOOTSTRAP} \
.WAIT \
geom \
libalias \
libarchive \
libauditd \
@ -100,6 +101,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \
# Inter-library dependencies. When the makefile for a library contains LDADD
# libraries, those libraries should be listed as build order dependencies here.
SUBDIR_DEPEND_geom= libufs
SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma libmd
SUBDIR_DEPEND_libauditdm= libbsm
SUBDIR_DEPEND_libbsnmp= ${_libnetgraph}

6
lib/geom/Makefile Normal file
View File

@ -0,0 +1,6 @@
# $FreeBSD$
SUBDIR=${GEOM_CLASSES}
.include "Makefile.inc"
.include <bsd.subdir.mk>

View File

@ -1,13 +1,16 @@
# $FreeBSD$
SHLIBDIR?=${GEOM_CLASS_DIR}
.include <src.opts.mk>
SHLIBDIR=${GEOM_CLASS_DIR}
SHLIB_NAME?=geom_${GEOM_CLASS}.so
LINKS= ${BINDIR}/geom ${BINDIR}/g${GEOM_CLASS}
MAN= g${GEOM_CLASS}.8
SRCS+= geom_${GEOM_CLASS}.c subr.c
CFLAGS+=-I${SRCTOP}/sbin/geom
.PATH: ${SRCTOP}/sbin/geom/misc
NO_WMISSING_VARIABLE_DECLARATIONS=
CFLAGS+= -I${.CURDIR:H:H}
.include "Makefile.classes"
.include "../Makefile.inc"

View File

@ -1,28 +1,30 @@
# $FreeBSD$
.include <src.opts.mk>
.PATH: ${.CURDIR}/core ${.CURDIR}/misc
PACKAGE=runtime
PROG= geom
SRCS= geom.c subr.c
MAN= geom.8
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/core
CFLAGS+= -DGEOM_CLASS_DIR=\"${GEOM_CLASS_DIR}\"
LIBADD= geom util
.if defined(RESCUE) || defined(RELEASE_CRUNCH)
.PATH: ${SRCTOP}/lib/geom/part \
${SRCTOP}/lib/geom/label
.PATH: ${.CURDIR}/class/part \
${.CURDIR}/class/label \
${.CURDIR}/core \
${.CURDIR}/misc
PROG= geom
SRCS= geom.c geom_label.c geom_part.c subr.c
SRCS+= geom_label.c geom_part.c
MAN=
WARNS?= 2
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core -DSTATIC_GEOM_CLASSES
LIBADD= geom util
CFLAGS+=-DSTATIC_GEOM_CLASSES
.else
.include "${SRCTOP}/lib/geom/Makefile.classes"
LINKS= ${GEOM_CLASSES:S|^|${BINDIR}/geom ${BINDIR}/g|}
.endif
.include <bsd.prog.mk>
.else
SUBDIR= core class
.include <bsd.subdir.mk>
.endif

View File

@ -1,5 +0,0 @@
# $FreeBSD$
GEOM_CLASS_DIR?=/lib/geom
.include "../Makefile.inc"

View File

@ -1,24 +0,0 @@
# $FreeBSD$
.include <src.opts.mk>
SUBDIR= cache
SUBDIR+=concat
.if ${MK_OPENSSL} != "no"
SUBDIR+=eli
.endif
SUBDIR+=journal
SUBDIR+=label
SUBDIR+=mirror
SUBDIR+=mountver
SUBDIR+=multipath
SUBDIR+=nop
SUBDIR+=part
SUBDIR+=raid
SUBDIR+=raid3
SUBDIR+=sched
SUBDIR+=shsec
SUBDIR+=stripe
SUBDIR+=virstor
.include <bsd.subdir.mk>

View File

@ -1,17 +0,0 @@
# $FreeBSD$
.PATH: ${.CURDIR:H}/misc
PACKAGE=runtime
PROG= geom
MAN= geom.8
SRCS= geom.c subr.c
NO_SHARED=NO
CFLAGS+= -DGEOM_CLASS_DIR=\"${GEOM_CLASS_DIR}\"
CFLAGS+= -I${SRCTOP}/sys -I${.CURDIR} -I${.CURDIR:H}
LIBADD= geom util
.include <bsd.prog.mk>

View File

@ -70,22 +70,6 @@ DIRDEPS+= \
sbin/fsdb \
sbin/fsirand \
sbin/gbde \
sbin/geom/class/cache \
sbin/geom/class/concat \
sbin/geom/class/eli \
sbin/geom/class/journal \
sbin/geom/class/label \
sbin/geom/class/mirror \
sbin/geom/class/mountver \
sbin/geom/class/multipath \
sbin/geom/class/nop \
sbin/geom/class/part \
sbin/geom/class/raid \
sbin/geom/class/raid3 \
sbin/geom/class/sched \
sbin/geom/class/shsec \
sbin/geom/class/stripe \
sbin/geom/class/virstor \
sbin/geom/core \
sbin/ggate/ggatec \
sbin/ggate/ggated \

View File

@ -8,6 +8,22 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/atf/libatf-c \
lib/atf/libatf-c++ \
lib/geom/cache \
lib/geom/concat \
lib/geom/eli \
lib/geom/journal \
lib/geom/label \
lib/geom/mirror \
lib/geom/mountver \
lib/geom/multipath \
lib/geom/nop \
lib/geom/part \
lib/geom/raid \
lib/geom/raid3 \
lib/geom/sched \
lib/geom/shsec \
lib/geom/stripe \
lib/geom/virstor \
lib/lib80211 \
lib/libalias/libalias \
lib/libalias/modules/cuseeme \