|
| 1 | +# NOT NetBSD |
| 2 | +# |
| 3 | +# Rules used to fetch a GNU package. Expects GNUHOSTDIST to be set |
| 4 | +# and <bsd.own.mk> to be previously .include'd. |
| 5 | +# |
| 6 | +# New interface: |
| 7 | +# |
| 8 | +# * When using the `cleandir' target, defining CLEANFETCHED=yes will |
| 9 | +# additionally remove all the fetched files. |
| 10 | +# This is particularly useful when a GNU package is updated. |
| 11 | +# |
| 12 | +# The rest should be operations hidden to the normal programmers. |
| 13 | +# |
| 14 | +# How to use: (maintainers manual) |
| 15 | +# |
| 16 | +# * put a fetch.sh script one directory below the GNUHOSTDIST; |
| 17 | +# |
| 18 | +# * .include "path/to/minix/Makefile.fetchgnu", after having |
| 19 | +# defined GNUHOSTDIST and before any use of the variable below; |
| 20 | +# |
| 21 | +# * insert ${fetch_done} as source before performing any operation |
| 22 | +# on the files under GPL license which are usually found |
| 23 | +# within NetBSD src/ tree; |
| 24 | +# |
| 25 | +# * rinse and repeat for every target which assumes the presence of |
| 26 | +# these files, and for every Makefile operating upon them. |
| 27 | +# |
| 28 | +# |
| 29 | +# TODO: does not handle correctly the cases where there are more than |
| 30 | +# one package downloaded by fetch.sh (e.g.gnu/dist with texinfo+gmake): |
| 31 | +# .gitignore only "protects" the first package which triggers. |
| 32 | + |
| 33 | +.if !defined(__MINIX) || !defined(GNUHOSTDIST) |
| 34 | +.error Bad logic in Makefiles. |
| 35 | +.endif |
| 36 | + |
| 37 | +.if !defined(_MINIX_FETCHGNU_MK_) |
| 38 | +_MINIX_FETCHGNU_MK_=1 |
| 39 | + |
| 40 | +# MINIX /usr/src does not have the sources for the GNU utilities |
| 41 | +# in-tree, for licensing reasons. So to successfully use them while |
| 42 | +# cross-compiling, we have to fetch them. The success of that operation |
| 43 | +# is indicated by the presence of a .gitignore file in the corresponding |
| 44 | +# source parent directory, which also conveniently hides from git. |
| 45 | +.if exists(${GNUHOSTDIST:H}/fetch.sh) |
| 46 | +${GNUHOSTDIST:H}/.gitignore: ${GNUHOSTDIST:H}/fetch.sh |
| 47 | + SED=${TOOL_SED} ${HOST_SH} ${GNUHOSTDIST:H}/fetch.sh |
| 48 | + @test -e ${GNUHOSTDIST}/configure |
| 49 | + @echo "${MODULE:U${.CURDIR:T}:C,gcc[0-9]*,gcc,:C,gmake*,make,}-*.tar.*z*" >> $@ |
| 50 | + @echo ${GNUHOSTDIST:T} >> $@ |
| 51 | + |
| 52 | +# Do the fetching as an extra step, to force serialization |
| 53 | +.fetch_done: ${GNUHOSTDIST:H}/.gitignore |
| 54 | + @touch $@ |
| 55 | +fetch_done=.fetch_done |
| 56 | + |
| 57 | +# Special target for MINIX, reset the source tree as pristine |
| 58 | +# Note it does NOT remove the downloaded tarball |
| 59 | +.if ${CLEANFETCHED:Uno} == "yes" |
| 60 | +cleandir: clean_gnu_src |
| 61 | +clean_gnu_src: |
| 62 | + -rm -r -f ${GNUHOSTDIST} ${GNUHOSTDIST:H}/.gitignore |
| 63 | +.endif # CLEANFETCHED == yes |
| 64 | + |
| 65 | +clean: clean.fetchgnu |
| 66 | +clean.fetchgnu: |
| 67 | + -@rm -f .fetch_done |
| 68 | + |
| 69 | +.endif # exists(GNUHOSTDIST:H/fetch.sh) on MINIX |
| 70 | + |
| 71 | +.endif # !defined(_MINIX_FETCHGNU_MK_) |
0 commit comments