libcompat: Use WORLDTMP sysroot

Now that -m32 is fixed, just install libs in ${WORLDTMP}/lib/lib32
and use the installed headers.

Reviewed by:	imp, jhb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D34697
This commit is contained in:
Brooks Davis 2022-07-01 08:33:16 +01:00
parent bda5d2a45c
commit 724123b9f4
2 changed files with 11 additions and 37 deletions

View File

@ -12,7 +12,7 @@ __<${_this:T}>__:
LIBCOMPATWMAKEENV+= \
INSTALL="${INSTALL_CMD} -U" \
PATH=${TMPPATH} \
SYSROOT=${LIBCOMPATTMP} \
SYSROOT=${WORLDTMP} \
LIBDIR=/usr/lib${libcompat} \
SHLIBDIR=/usr/lib${libcompat} \
DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
@ -23,7 +23,7 @@ LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA
LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
DESTDIR=${LIBCOMPATTMP} \
DESTDIR=${WORLDTMP} \
-DNO_CPU_CFLAGS \
MK_BOOT=no \
MK_CTF=no \
@ -62,38 +62,12 @@ build${libcompat}: .PHONY
@echo "--------------------------------------------------------------"
@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
@echo "--------------------------------------------------------------"
.if ${MK_CLEAN} == "yes"
rm -rf ${LIBCOMPATTMP}
.else
${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
echo ">>> Deleting stale files in build${libcompat} tree..."; \
cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
DESTDIR=${LIBCOMPATTMP} \
delete-old delete-old-libs >/dev/null; \
fi
.endif # MK_CLEAN == "yes"
mkdir -p ${LIBCOMPATTMP}/usr/include
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
-p ${LIBCOMPATTMP}/usr >/dev/null
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${LIBCOMPATTMP}/usr/include >/dev/null
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
-p ${LIBCOMPATTMP}/usr >/dev/null
-p ${WORLDTMP}/usr >/dev/null
.if ${MK_DEBUG_FILES} != "no"
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
-p ${LIBCOMPATTMP}/usr/lib >/dev/null
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
-p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
-p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
.endif
mkdir -p ${WORLDTMP}
ln -sf ${.CURDIR}/sys ${WORLDTMP}
.for _t in ${_obj} includes
.for _dir in ${_LC_INCDIRS}
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
DIRPRFX=${_dir}/ ${_t}
.endfor
.endfor
.for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents}
.for _t in ${_obj} build-tools
${_+_}cd ${.CURDIR}/${_dir}; \

View File

@ -95,34 +95,34 @@ _LIBCOMPAT:= ${WANT_COMPAT}
# Set defaults based on type.
libcompat= ${_LIBCOMPAT:tl}
_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \
_MACHINE _MACHINE_ARCH WMAKEENV WMAKEFLAGS WMAKE
_MACHINE _MACHINE_ARCH \
WMAKEENV WMAKEFLAGS WMAKE WORLDTMP
.for _var in ${_LIBCOMPAT_MAKEVARS}
.if !empty(LIB${_LIBCOMPAT}${_var})
LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}}
.endif
.endfor
WORLDTMP?= ${SYSROOT}
# Shared flags
LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat}
LIBCOMPATTMP?= ${LIBCOMPAT_OBJTOP}/tmp
LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \
--sysroot=${LIBCOMPATTMP} \
--sysroot=${WORLDTMP} \
${BFLAGS}
LIBCOMPATLDFLAGS+= -L${LIBCOMPATTMP}/usr/lib${libcompat}
LIBCOMPATLDFLAGS+= -L${WORLDTMP}/usr/lib${libcompat}
LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE}
LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH}
# -B is needed to find /usr/lib32/crti.o for gcc.
LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat}
LIBCOMPATCFLAGS+= -B${WORLDTMP}/usr/lib${libcompat}
.if defined(WANT_COMPAT)
LIBDIR_BASE:= /usr/lib${libcompat}
_LIB_OBJTOP= ${LIBCOMPAT_OBJTOP}
LIBDESTDIR:= ${LIBCOMPATTMP}
SYSROOT:= ${LIBCOMPATTMP}
CFLAGS+= ${LIBCOMPATCFLAGS}
LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS}
MACHINE= ${LIBCOMPAT_MACHINE}