This commit is contained in:
Antoine Leca 2016-09-01 18:12:42 +00:00 committed by GitHub
commit c990fe5a87
9 changed files with 126 additions and 49 deletions

View File

@ -27,6 +27,12 @@ DEFS_MK=${.CURDIR}/arch/${BFD_MACHINE_ARCH}/defs.mk
DIST= ${NETBSDSRCDIR}/external/gpl3/binutils/dist DIST= ${NETBSDSRCDIR}/external/gpl3/binutils/dist
.if defined(__MINIX)
# MINIX: make sure sources are fetched, even when tools not built earlier
GNUHOSTDIST= ${DIST}
.include "${.CURDIR}/../../../../../minix/Makefile.fetchgnu"
.endif
SHLIB_MAJOR= 13 SHLIB_MAJOR= 13
SHLIB_MINOR= 0 SHLIB_MINOR= 0
@ -105,3 +111,8 @@ pepigen.c: peXXigen.c
pex64igen.c: peXXigen.c pex64igen.c: peXXigen.c
${_MKTARGET_CREATE} ${_MKTARGET_CREATE}
${TOOL_SED} -e s/XX/pex64/g < $> > $@ ${TOOL_SED} -e s/XX/pex64/g < $> > $@
.if defined(__MINIX) && ${USETOOLS} != "yes"
# Trigger the fetch phase, even when not building tools
${SRCS} realdepend realall realinstall: ${fetch_done}
.endif

View File

@ -21,6 +21,12 @@ COPTS.regex.c = -Wno-stack-protector
DIST= ${NETBSDSRCDIR}/external/gpl3/binutils/dist DIST= ${NETBSDSRCDIR}/external/gpl3/binutils/dist
.if defined(__MINIX)
# MINIX: make sure sources are fetched, even when tools not built earlier
GNUHOSTDIST= ${DIST}
.include "${.CURDIR}/../../../../../minix/Makefile.fetchgnu"
.endif
SRCS= ${G_REQUIRED_OFILES:.o=.c} ${G_EXTRA_OFILES:.o=.c} \ SRCS= ${G_REQUIRED_OFILES:.o=.c} ${G_EXTRA_OFILES:.o=.c} \
${G_LIBOBJS:.o=.c} ${G_ALLOCA:.o=.c} ${G_LIBOBJS:.o=.c} ${G_ALLOCA:.o=.c}
@ -30,3 +36,8 @@ CPPFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/arch/${BINUTILS_MACHINE_ARCH} \
.PATH: ${DIST}/libiberty .PATH: ${DIST}/libiberty
.include <bsd.lib.mk> .include <bsd.lib.mk>
.if defined(__MINIX) && ${USETOOLS} != "yes"
# Trigger the fetch phase, even when not building tools
${SRCS} realdepend realall realinstall: ${fetch_done}
.endif

View File

@ -17,6 +17,12 @@ BFD_MACHINE_ARCH?= ${MACHINE_ARCH:C/armv[4-7]/arm/}
DIST= ${NETBSDSRCDIR}/external/gpl3/binutils/dist DIST= ${NETBSDSRCDIR}/external/gpl3/binutils/dist
.if defined(__MINIX)
# MINIX: make sure sources are fetched, even when tools not built earlier
GNUHOSTDIST= ${DIST}
.include "${.CURDIR}/../../../../../minix/Makefile.fetchgnu"
.endif
SHLIB_MAJOR= 6 SHLIB_MAJOR= 6
SHLIB_MINOR= 0 SHLIB_MINOR= 0
@ -34,6 +40,11 @@ SRCS= ${GSRCS:.lo=.c} ${G_libopcodes_la_SOURCES}
.include <bsd.lib.mk> .include <bsd.lib.mk>
.if defined(__MINIX) #&& ${USETOOLS} != "yes"
# Trigger the fetch phase, even when not building tools
${SRCS} realdepend realall realinstall: ${fetch_done}
.endif
.else .else
.include <bsd.prog.mk> # do nothing .include <bsd.prog.mk> # do nothing
.endif .endif

View File

@ -1,9 +1,5 @@
# $NetBSD: Makefile,v 1.17 2010/12/03 21:38:47 plunky Exp $ # $NetBSD: Makefile,v 1.17 2010/12/03 21:38:47 plunky Exp $
.if defined(__MINIX)
#LSC: Trigger fetch.sh script
SUBDIR+= dist .WAIT
.endif # defined(__MINIX)
SUBDIR+= usr.bin SUBDIR+= usr.bin
# Speedup stubs for some subtrees that don't need to run these rules # Speedup stubs for some subtrees that don't need to run these rules

18
gnu/dist/Makefile vendored
View File

@ -1,18 +0,0 @@
# LSC FIXME: Hackish way to trigger the fetch phase from here
# in the same way as from tools.
.include <bsd.own.mk>
MODULE= texinfo
.include "${.CURDIR}/../../tools/Makefile.gnuhost"
# Force the mapping to standard targets even when not building tools
# We considere work to be done as soon as the fetch step is done,
# as everything else has to be triggered from /tools or ../usr.bin
.if ${USETOOLS} != "yes"
realall realinstall: ${GNUHOSTDIST:H}/.gitignore
.endif

View File

@ -5,6 +5,13 @@ MAKEDOC=
.include "../Makefile.inc" .include "../Makefile.inc"
.if defined(__MINIX)
#LSC: First program within texinfo: trigger fetch.sh script
MODULE= texinfo
GNUHOSTDIST= ${DIST}/${MODULE}
.include "${.CURDIR}/../../../../minix/Makefile.fetchgnu"
.endif # defined(__MINIX)
HOSTPROG= makedoc HOSTPROG= makedoc
SRCS= makedoc.c xexit.c xmalloc.c xstrdup.c SRCS= makedoc.c xexit.c xmalloc.c xstrdup.c
@ -13,3 +20,8 @@ HOST_CPPFLAGS+= -I${IDIST}/info -I${IDIST}/lib -I${.CURDIR}/../common
HOST_CPPFLAGS+= -DHOSTTOOL HOST_CPPFLAGS+= -DHOSTTOOL
.include <bsd.hostprog.mk> .include <bsd.hostprog.mk>
.if defined(__MINIX) && ${USETOOLS} != "yes"
# MINIX: make sure sources are fetched, even when tools not built earlier
${SRCS} realdepend realall realinstall: ${fetch_done}
.endif

71
minix/Makefile.fetchgnu Normal file
View File

@ -0,0 +1,71 @@
# NOT NetBSD
#
# Rules used to fetch a GNU package. Expects GNUHOSTDIST to be set
# and <bsd.own.mk> to be previously .include'd.
#
# New interface:
#
# * When using the `cleandir' target, defining CLEANFETCHED=yes will
# additionally remove all the fetched files.
# This is particularly useful when a GNU package is updated.
#
# The rest should be operations hidden to the normal programmers.
#
# How to use: (maintainers manual)
#
# * put a fetch.sh script one directory below the GNUHOSTDIST;
#
# * .include "path/to/minix/Makefile.fetchgnu", after having
# defined GNUHOSTDIST and before any use of the variable below;
#
# * insert ${fetch_done} as source before performing any operation
# on the files under GPL license which are usually found
# within NetBSD src/ tree;
#
# * rinse and repeat for every target which assumes the presence of
# these files, and for every Makefile operating upon them.
#
#
# TODO: does not handle correctly the cases where there are more than
# one package downloaded by fetch.sh (e.g.gnu/dist with texinfo+gmake):
# .gitignore only "protects" the first package which triggers.
.if !defined(__MINIX) || !defined(GNUHOSTDIST)
.error Bad logic in Makefiles.
.endif
.if !defined(_MINIX_FETCHGNU_MK_)
_MINIX_FETCHGNU_MK_=1
# MINIX /usr/src does not have the sources for the GNU utilities
# in-tree, for licensing reasons. So to successfully use them while
# cross-compiling, we have to fetch them. The success of that operation
# is indicated by the presence of a .gitignore file in the corresponding
# source parent directory, which also conveniently hides from git.
.if exists(${GNUHOSTDIST:H}/fetch.sh)
${GNUHOSTDIST:H}/.gitignore: ${GNUHOSTDIST:H}/fetch.sh
SED=${TOOL_SED} ${HOST_SH} ${GNUHOSTDIST:H}/fetch.sh
@test -e ${GNUHOSTDIST}/configure
@echo "${MODULE:U${.CURDIR:T}:C,gcc[0-9]*,gcc,:C,gmake*,make,}-*.tar.*z*" >> $@
@echo ${GNUHOSTDIST:T} >> $@
# Do the fetching as an extra step, to force serialization
.fetch_done: ${GNUHOSTDIST:H}/.gitignore
@touch $@
fetch_done=.fetch_done
# Special target for MINIX, reset the source tree as pristine
# Note it does NOT remove the downloaded tarball
.if ${CLEANFETCHED:Uno} == "yes"
cleandir: clean_gnu_src
clean_gnu_src:
-rm -r -f ${GNUHOSTDIST} ${GNUHOSTDIST:H}/.gitignore
.endif # CLEANFETCHED == yes
clean: clean.fetchgnu
clean.fetchgnu:
-@rm -f .fetch_done
.endif # exists(GNUHOSTDIST:H/fetch.sh) on MINIX
.endif # !defined(_MINIX_FETCHGNU_MK_)

View File

@ -27,27 +27,7 @@ MAKE_PROGRAM?= ${MAKE}
GNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE} GNUHOSTDIST?= ${.CURDIR}/../../gnu/dist/${MODULE}
.if defined(__MINIX) .if defined(__MINIX)
# AL - MINIX /usr/src does not have the sources for the GNU utilities .include "../minix/Makefile.fetchgnu"
# in-tree (they are much bigger than Minix itself!) So to successfully
# use them while cross-compiling, we have to fetch them. The success of
# that operation is indicated by the presence of a .gitignore file in
# the corresponding ${.CURDIR}, which also conveniently hides from git.
.if exists(${GNUHOSTDIST:H}/fetch.sh)
${GNUHOSTDIST:H}/.gitignore: ${GNUHOSTDIST:H}/fetch.sh
SED=${TOOL_SED} ${HOST_SH} ${GNUHOSTDIST:H}/fetch.sh
@test -e ${GNUHOSTDIST}/configure
@echo "${MODULE:U${.CURDIR:T}:C,gcc[0-9]*,gcc,:C,gmake*,make,}-*.tar.*z*" >> $@
@echo ${GNUHOSTDIST:T} >> $@
_gnu_get_src=${GNUHOSTDIST:H}/.gitignore
.endif # exists(GNUHOSTDIST:H/fetch.sh) on MINIX
# AL - Special target for MINIX, reset the source tree as pristine
.if ${CLEANFETCHED:Uno} == "yes" && exists(${GNUHOSTDIST:H}/fetch.sh)
cleandir: clean_gnu_src
clean_gnu_src:
-rm -r -f ${GNUHOSTDIST} ${GNUHOSTDIST:H}/.gitignore
# XXX CHECKME: could have used the content of .gitignore as well?
.endif # CLEANFETCHED == yes
.endif # defined(__MINIX) .endif # defined(__MINIX)
FIND_ARGS+= \! \( -type d \( \ FIND_ARGS+= \! \( -type d \( \
@ -134,7 +114,7 @@ configure_cleanup=configure_cleanup
.endif .endif
# AL For MINIX, fetch the source if not there # AL For MINIX, fetch the source if not there
.configure_done: ${_gnu_get_src} .WAIT ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup} .configure_done: ${fetch_done} ${_GNU_CFGSRC} ${.CURDIR}/Makefile ${configure_cleanup}
@mkdir build 2>/dev/null || true @mkdir build 2>/dev/null || true
@(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS}) @(cd build && ${CONFIGURE_ENV} ${HOST_SH} ${GNUHOSTDIST}/configure ${CONFIGURE_ARGS})
@echo ${BUILD_PLATFORM} > $@ @echo ${BUILD_PLATFORM} > $@

View File

@ -16,12 +16,15 @@ CONFIGURE_ARGS= --target=${MACHINE_GNU_PLATFORM} --disable-nls \
--disable-werror \ --disable-werror \
${BRANDING} ${BRANDING}
.if !defined(__MINIX) .if defined(__MINIX) && ! exists(${GNUHOSTDIST}/gas/m68k-parse.c)
build/gas/m68k-parse.c: ${GNUHOSTDIST}/gas/m68k-parse.c
.else
# MINIX: LSC: Make sure we trigger the fetch rule # MINIX: LSC: Make sure we trigger the fetch rule
build/gas/m68k-parse.c: ${GNUHOSTDIST:H}/.gitignore .WAIT ${GNUHOSTDIST}/gas/m68k-parse.c .include "${.CURDIR}/../../minix/Makefile.fetchgnu"
.endif # !defined(__MINIX)
${GNUHOSTDIST}/gas/m68k-parse.c: ${fetch_done}
@true
.endif # defined(__MINIX)
build/gas/m68k-parse.c: ${GNUHOSTDIST}/gas/m68k-parse.c
@mkdir build 2>/dev/null || true @mkdir build 2>/dev/null || true
@mkdir build/gas 2>/dev/null || true @mkdir build/gas 2>/dev/null || true
cat ${GNUHOSTDIST}/gas/m68k-parse.c > ${.TARGET} cat ${GNUHOSTDIST}/gas/m68k-parse.c > ${.TARGET}