Page MenuHomeFreeBSD

D39744.id120818.diff
No OneTemporary

D39744.id120818.diff

diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk
--- a/share/mk/local.dirdeps.mk
+++ b/share/mk/local.dirdeps.mk
@@ -60,7 +60,17 @@
rm -rf ${OBJTOP}/tmp
beforedirdeps: cleanup_worldtmp
.endif
+
+# pseudo option for building host tools on old or non-FreeBSD host
+# allows us to leverage Makefile.depend.options with
+# DIRDEPS_OPTIONS = host_egacy
+.if ${.MAKE.OS} != "FreeBSD" || ${_HOST_OSREL:R} < ${OS_REVISION:R}
+MK_host_egacy.host= yes
.endif
+# this will apply otherwise
+MK_host_egacy= no
+
+.endif # !target(_DIRDEP_USE)
# reset this each time
DIRDEPS_FILTER.xtras=
@@ -71,6 +81,7 @@
.if ${DEP_MACHINE} != "host"
# this is how we can handle optional dependencies
+# actually Makefile.depend.options is better
.if ${DEP_RELDIR} == "lib/libc"
DIRDEPS += lib/libc_nonshared
.if ${MK_SSP:Uno} != "no"
diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk
--- a/share/mk/local.init.mk
+++ b/share/mk/local.init.mk
@@ -19,7 +19,8 @@
CXXFLAGS_LAST+= --sysroot=${SYSROOT}
LDADD+= --sysroot=${SYSROOT}
.elif ${MK_STAGING} == "yes"
-CFLAGS+= -isystem ${STAGE_INCLUDEDIR}
+ISYSTEM?= ${STAGE_INCLUDEDIR}
+CFLAGS+= -isystem${ISYSTEM}
# XXX: May be needed for GCC to build with libc++ rather than libstdc++. See Makefile.inc1
#CXXFLAGS+= -std=gnu++11
#LDADD+= -L${STAGE_LIBDIR}/libc++
@@ -38,4 +39,8 @@
.-include "src.init.mk"
.-include <site.init.mk>
.-include "${.CURDIR}/local.init.mk"
+
+.if !empty(HAVE_FLAGS)
+CFLAGS+= ${HAVE_FLAGS:U:@F@-D${F}=${$F:U1}@}
+.endif
.endif
diff --git a/share/mk/src.init.linux.mk b/share/mk/src.init.linux.mk
new file mode 100644
--- /dev/null
+++ b/share/mk/src.init.linux.mk
@@ -0,0 +1,33 @@
+# We want to build some host tools (eg makefs, mkimg) for Linux
+
+.if ${MACHINE:Nhost*} == ""
+
+CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux
+
+WARNS= 0
+
+CFLAGS+= -DEFTYPE=EINVAL
+
+.ifdef PROG
+LOCAL_LIBRARIES+= bsd egacy
+LIBADD+= egacy m
+# static linking does not work
+NO_SHARED= no
+.endif
+
+MK_TESTS= no
+MK_MAN= no
+
+# override some HAVE_FLAGS
+HAVE_STRUCT_STAT_ST_FLAGS= 0
+
+# someone used __unused for struct padding on Linux
+# we don't care enough about linux/sysctl.h to work around it
+CFLAGS+= -D__unused= -D_LINUX_SYSCTL_H
+
+# avoid type conflicts
+CFLAGS+= -D__va_list=__builtin_va_list
+
+CFLAGS+= -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_XOPEN_SOURCE
+
+.endif
diff --git a/share/mk/src.init.mk b/share/mk/src.init.mk
--- a/share/mk/src.init.mk
+++ b/share/mk/src.init.mk
@@ -8,4 +8,20 @@
${_+_}@env BUILDENV_DIR=${.CURDIR} ${MAKE} -C ${SRCTOP} buildenv
.endif
+.if ${MACHINE:Nhost*} == ""
+.-include <src.init.${.MAKE.OS:tl}.mk>
+
+.if ${.MAKE.OS} == "FreeBSD" && ${_HOST_OSREL:R} < ${OS_REVISION:R}
+.ifdef PROG
+LOCAL_LIBRARIES+= egacy
+LIBADD+= egacy
+.endif
+.endif
+
+.if ${MK_STAGING} == "yes"
+ISYSTEM= /usr/include
+CFLAGS+= -I${STAGE_INCLUDEDIR}
+.endif
+.endif
+
.endif # !target(__<src.init.mk>__)
diff --git a/share/mk/src.sys.env.mk b/share/mk/src.sys.env.mk
--- a/share/mk/src.sys.env.mk
+++ b/share/mk/src.sys.env.mk
@@ -24,7 +24,7 @@
RELSRCTOP?= ${RELTOP}
.if !defined(OS_REVISION)
-OS_REVISION!=eval `sh ${SRCTOP}/sys/conf/newvers.sh -V REVISION` && echo $$REVISION || echo
+OS_REVISION!=eval `sh ${SRCTOP}/sys/conf/newvers.sh -V REVISION 2> /dev/null` && echo $$REVISION || echo
.export OS_REVISION
.endif

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 8, 6:25 PM (1 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28483539
Default Alt Text
D39744.id120818.diff (3 KB)

Event Timeline