2003-04-05 20:30:30 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
.PATH: ${.CURDIR}/../../include
|
|
|
|
|
2003-04-06 21:46:44 +00:00
|
|
|
LIB= egacy
|
2012-09-11 22:38:33 +00:00
|
|
|
SRC=
|
2020-01-27 12:02:41 +00:00
|
|
|
INCSGROUPS= INCS SYSINCS CASPERINC UFSINCS FFSINCS MSDOSFSINCS DISKINCS
|
2012-09-11 22:38:33 +00:00
|
|
|
INCS=
|
2003-04-05 20:30:30 +00:00
|
|
|
|
2016-06-09 21:57:34 +00:00
|
|
|
SYSINCSDIR= ${INCLUDEDIR}/sys
|
2019-04-04 04:14:20 +00:00
|
|
|
CASPERINCDIR= ${INCLUDEDIR}/casper
|
2020-01-27 12:02:41 +00:00
|
|
|
# Also add ufs/ffs/msdosfs/disk headers to allow building makefs as a bootstrap tool
|
|
|
|
UFSINCSDIR= ${INCLUDEDIR}/ufs/ufs
|
|
|
|
FFSINCSDIR= ${INCLUDEDIR}/ufs/ffs
|
|
|
|
MSDOSFSINCSDIR= ${INCLUDEDIR}/fs/msdosfs
|
|
|
|
DISKINCSDIR= ${INCLUDEDIR}/sys/disk
|
2016-06-09 21:57:34 +00:00
|
|
|
|
2003-04-05 20:30:30 +00:00
|
|
|
BOOTSTRAPPING?= 0
|
|
|
|
|
2015-11-16 21:05:38 +00:00
|
|
|
_WITH_PWCACHEDB!= grep -c pwcache_groupdb /usr/include/grp.h || true
|
2013-01-11 20:51:02 +00:00
|
|
|
.if ${_WITH_PWCACHEDB} == 0
|
|
|
|
.PATH: ${.CURDIR}/../../contrib/libc-pwcache
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../contrib/libc-pwcache \
|
|
|
|
-I${.CURDIR}/../../lib/libc/include
|
|
|
|
SRCS+= pwcache.c
|
|
|
|
.endif
|
|
|
|
|
2015-11-16 21:05:38 +00:00
|
|
|
_WITH_STRSVIS!= grep -c strsvis /usr/include/vis.h || true
|
2013-01-11 20:51:02 +00:00
|
|
|
.if ${_WITH_STRSVIS} == 0
|
|
|
|
.PATH: ${.CURDIR}/../../contrib/libc-vis
|
|
|
|
SRCS+= vis.c
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../contrib/libc-vis \
|
|
|
|
-I${.CURDIR}/../../lib/libc/include
|
|
|
|
.endif
|
|
|
|
|
2015-11-16 21:05:38 +00:00
|
|
|
_WITH_REALLOCARRAY!= grep -c reallocarray /usr/include/stdlib.h || true
|
2015-05-15 22:19:35 +00:00
|
|
|
.if ${_WITH_REALLOCARRAY} == 0
|
|
|
|
.PATH: ${.CURDIR}/../../lib/libc/stdlib
|
|
|
|
INCS+= stdlib.h
|
|
|
|
SRCS+= reallocarray.c
|
|
|
|
CFLAGS+= -I${.CURDIR}/../../lib/libc/include
|
|
|
|
.endif
|
|
|
|
|
2016-06-09 21:57:34 +00:00
|
|
|
_WITH_UTIMENS!= grep -c utimensat /usr/include/sys/stat.h || true
|
|
|
|
.if ${_WITH_UTIMENS} == 0
|
|
|
|
SYSINCS+= stat.h
|
|
|
|
SRCS+= futimens.c utimensat.c
|
|
|
|
.endif
|
|
|
|
|
2018-07-16 11:03:05 +00:00
|
|
|
_WITH_EXPLICIT_BZERO!= grep -c explicit_bzero /usr/include/strings.h || true
|
|
|
|
.if ${_WITH_EXPLICIT_BZERO} == 0
|
|
|
|
.PATH: ${SRCTOP}/sys/libkern
|
|
|
|
INCS+= strings.h
|
|
|
|
SRCS+= explicit_bzero.c
|
|
|
|
.endif
|
|
|
|
|
2018-11-19 18:58:34 +00:00
|
|
|
.if exists(/usr/include/capsicum_helpers.h)
|
|
|
|
_WITH_CAPH_ENTER!= grep -c caph_enter /usr/include/capsicum_helpers.h || true
|
2019-08-01 19:26:16 +00:00
|
|
|
_WITH_CAPH_RIGHTS_LIMIT!= grep -c caph_rights_limit /usr/include/capsicum_helpers.h || true
|
2018-11-19 18:58:34 +00:00
|
|
|
.endif
|
2019-08-01 19:26:16 +00:00
|
|
|
.if !defined(_WITH_CAPH_ENTER) || ${_WITH_CAPH_ENTER} == 0 || ${_WITH_CAPH_RIGHTS_LIMIT} == 0
|
2018-11-19 18:58:34 +00:00
|
|
|
.PATH: ${SRCTOP}/lib/libcapsicum
|
|
|
|
INCS+= capsicum_helpers.h
|
|
|
|
.PATH: ${SRCTOP}/lib/libcasper/libcasper
|
|
|
|
INCS+= libcasper.h
|
|
|
|
.endif
|
|
|
|
|
2019-04-04 04:14:20 +00:00
|
|
|
CASPERINC+= ${SRCTOP}/lib/libcasper/services/cap_fileargs/cap_fileargs.h
|
|
|
|
|
2003-04-05 20:30:30 +00:00
|
|
|
.if empty(SRCS)
|
|
|
|
SRCS= dummy.c
|
|
|
|
.endif
|
|
|
|
|
2005-03-02 16:40:51 +00:00
|
|
|
.if defined(CROSS_BUILD_TESTING)
|
|
|
|
SUBDIR= cross-build
|
|
|
|
.endif
|
|
|
|
|
2020-01-27 12:02:41 +00:00
|
|
|
# To allow bootstrapping makefs on FreeBSD 11 or non-FreeBSD systems:
|
|
|
|
UFSINCS+= ${SRCTOP}/sys/ufs/ufs/dinode.h
|
|
|
|
UFSINCS+= ${SRCTOP}/sys/ufs/ufs/dir.h
|
|
|
|
FFSINCS+= ${SRCTOP}/sys/ufs/ffs/fs.h
|
|
|
|
|
|
|
|
MSDOSFSINCS+= ${SRCTOP}/sys/fs/msdosfs/bootsect.h
|
|
|
|
MSDOSFSINCS+= ${SRCTOP}/sys/fs/msdosfs/bpb.h
|
|
|
|
MSDOSFSINCS+= ${SRCTOP}/sys/fs/msdosfs/denode.h
|
|
|
|
MSDOSFSINCS+= ${SRCTOP}/sys/fs/msdosfs/direntry.h
|
|
|
|
MSDOSFSINCS+= ${SRCTOP}/sys/fs/msdosfs/fat.h
|
|
|
|
MSDOSFSINCS+= ${SRCTOP}/sys/fs/msdosfs/msdosfsmount.h
|
|
|
|
DISKINCS+= ${SRCTOP}/sys/sys/disk/bsd.h
|
|
|
|
|
2018-07-16 10:57:26 +00:00
|
|
|
# Needed to build config (since it uses libnv)
|
2019-06-15 09:45:00 +00:00
|
|
|
SYSINCS+= ${SRCTOP}/sys/sys/nv.h ${SRCTOP}/sys/sys/cnv.h \
|
|
|
|
${SRCTOP}/sys/sys/dnv.h
|
2018-07-16 10:57:26 +00:00
|
|
|
|
2018-11-05 19:51:10 +00:00
|
|
|
# We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't
|
|
|
|
# accidentally run tools that are incompatible but happen to be in $PATH.
|
|
|
|
# This is especially important when building on Linux/MacOS where many of the
|
|
|
|
# programs used during the build accept different flags or generate different
|
|
|
|
# output. On those platforms we only symlink the tools known to be compatible
|
|
|
|
# (e.g. basic utilities such as mkdir) into ${WORLDTMP} and build all others
|
|
|
|
# from the FreeBSD sources during the bootstrap-tools stage.
|
|
|
|
|
|
|
|
# basic commands: It is fine to use the host version for all of these even on
|
|
|
|
# Linux/MacOS since we only use flags that are supported by all of them.
|
|
|
|
_host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date \
|
|
|
|
dirname echo env false find fmt gzip gunzip head hostname id ln ls \
|
|
|
|
mkdir mv nice patch rm realpath sh sleep stat tee touch tr true uname \
|
|
|
|
uniq wc which
|
|
|
|
|
|
|
|
# We also need a symlink to the absolute path to the make binary used for
|
|
|
|
# the toplevel makefile. This is not necessarily the same as `which make`
|
|
|
|
# since e.g. on Linux and MacOS that will be GNU make.
|
|
|
|
_make_abs!= which "${MAKE}"
|
|
|
|
_host_abs_tools_to_symlink= ${_make_abs}:make ${_make_abs}:bmake
|
|
|
|
|
|
|
|
host-symlinks:
|
|
|
|
@echo "Linking host tools into ${DESTDIR}/bin"
|
|
|
|
.for _tool in ${_host_tools_to_symlink}
|
|
|
|
@if [ ! -e "${DESTDIR}/bin/${_tool}" ]; then \
|
|
|
|
source_path=`which ${_tool}`; \
|
|
|
|
if [ ! -e "$${source_path}" ] ; then \
|
|
|
|
echo "Cannot find host tool '${_tool}'"; false; \
|
|
|
|
fi; \
|
|
|
|
ln -sfnv "$${source_path}" "${DESTDIR}/bin/${_tool}"; \
|
|
|
|
fi
|
|
|
|
.endfor
|
|
|
|
.for _tool in ${_host_abs_tools_to_symlink}
|
|
|
|
@source_path="${_tool:S/:/ /:[1]}"; \
|
|
|
|
target_path="${DESTDIR}/bin/${_tool:S/:/ /:[2]}"; \
|
|
|
|
if [ ! -e "$${target_path}" ] ; then \
|
|
|
|
if [ ! -e "$${source_path}" ] ; then \
|
|
|
|
echo "Host tool '${src_path}' is missing"; false; \
|
|
|
|
fi; \
|
|
|
|
ln -sfnv "$${source_path}" "$${target_path}"; \
|
|
|
|
fi
|
|
|
|
.endfor
|
2020-01-12 04:18:36 +00:00
|
|
|
.if exists(/usr/libexec/flua)
|
|
|
|
ln -sf /usr/libexec/flua ${DESTDIR}/usr/libexec/flua
|
|
|
|
.endif
|
2018-08-20 10:39:53 +00:00
|
|
|
|
|
|
|
# Create all the directories that are needed during the legacy, bootstrap-tools
|
|
|
|
# and cross-tools stages. We do this here using mkdir since mtree may not exist
|
|
|
|
# yet (this happens if we are crossbuilding from Linux/Mac).
|
2019-10-28 20:45:29 +00:00
|
|
|
INSTALLDIR_LIST= \
|
|
|
|
bin \
|
|
|
|
lib/casper \
|
|
|
|
lib/geom \
|
|
|
|
usr/include/casper \
|
|
|
|
usr/include/private/zstd \
|
|
|
|
usr/lib \
|
2019-11-18 23:28:23 +00:00
|
|
|
usr/libexec
|
2019-10-28 20:45:29 +00:00
|
|
|
|
2018-08-20 10:39:53 +00:00
|
|
|
installdirs:
|
2019-10-28 20:45:29 +00:00
|
|
|
mkdir -p ${INSTALLDIR_LIST:S,^,${DESTDIR}/,}
|
|
|
|
|
2018-11-05 19:51:10 +00:00
|
|
|
# Link usr/bin, sbin, and usr/sbin to bin so that it doesn't matter whether a
|
|
|
|
# bootstrap tool was added to WORLTMP with a symlink or by building it in the
|
|
|
|
# bootstrap-tools phase. We could also overrride BINDIR when building bootstrap
|
|
|
|
# tools but adding the symlinks is easier and means all tools are also
|
|
|
|
# in the directory that they are installed to normally.
|
2018-11-05 21:30:00 +00:00
|
|
|
|
|
|
|
.for _dir in sbin usr/sbin usr/bin
|
|
|
|
# delete existing directories from before r340157
|
|
|
|
@if [ ! -L ${DESTDIR}/${_dir} ]; then \
|
|
|
|
echo "removing old non-symlink ${DESTDIR}/${_dir}"; \
|
|
|
|
rm -rf "${DESTDIR}/${_dir}"; \
|
|
|
|
fi
|
|
|
|
.endfor
|
|
|
|
ln -sfn bin ${DESTDIR}/sbin
|
|
|
|
ln -sfn ../bin ${DESTDIR}/usr/bin
|
|
|
|
ln -sfn ../bin ${DESTDIR}/usr/sbin
|
2018-08-20 10:39:53 +00:00
|
|
|
.for _group in ${INCSGROUPS:NINCS}
|
|
|
|
mkdir -p "${DESTDIR}/${${_group}DIR}"
|
|
|
|
.endfor
|
|
|
|
|
2003-04-05 20:30:30 +00:00
|
|
|
.include <bsd.lib.mk>
|