From b2f78cc475d11717578b27cfcd2920f0f559770d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 7 May 2014 15:59:56 +0200 Subject: [PATCH] Unify 'make prepare' between libports and ports --- repos/libports/Makefile | 85 +------------------------------ repos/ports/Makefile | 89 +-------------------------------- repos/ports/ports/arora.mk | 5 +- repos/ports/ports/bash.mk | 4 +- repos/ports/ports/binutils.mk | 5 +- repos/ports/ports/coreutils.mk | 4 +- repos/ports/ports/dash.mk | 5 +- repos/ports/ports/dosbox.mk | 5 +- repos/ports/ports/e2fsprogs.mk | 5 +- repos/ports/ports/etc.mk | 2 +- repos/ports/ports/findutils.mk | 5 +- repos/ports/ports/gcc.mk | 5 +- repos/ports/ports/gdb.mk | 2 +- repos/ports/ports/grep.mk | 4 +- repos/ports/ports/lighttpd.mk | 5 +- repos/ports/ports/lynx.mk | 5 +- repos/ports/ports/make.mk | 4 +- repos/ports/ports/netcat.mk | 4 +- repos/ports/ports/netperf.mk | 2 +- repos/ports/ports/openssh.mk | 5 +- repos/ports/ports/sed.mk | 5 +- repos/ports/ports/seoul.mk | 5 +- repos/ports/ports/vim.mk | 5 +- repos/ports/ports/virtualbox.mk | 5 +- repos/ports/ports/which.mk | 5 +- tool/README | 6 +++ tool/prepare.mk | 84 +++++++++++++++++++++++++++++++ 27 files changed, 170 insertions(+), 195 deletions(-) create mode 100644 tool/prepare.mk diff --git a/repos/libports/Makefile b/repos/libports/Makefile index f1222b8444..ba10c4fabf 100644 --- a/repos/libports/Makefile +++ b/repos/libports/Makefile @@ -1,84 +1 @@ -# -# \brief Download and unpack upstream library source codes -# \author Norman Feske -# \date 2009-10-16 -# - -# -# Print help information by default -# -help:: - -VERBOSE ?= @ -ECHO = @echo -DOWNLOAD_DIR = download -CONTRIB_DIR = contrib -GNU_FIND = find -SHELL = bash -SIGVERIFIER = $(CURDIR)/../../tool/download_sigver -HASHVERIFIER = $(CURDIR)/../../tool/download_hashver - -# -# Create download and contrib directory so that '.mk' files -# do not need to care for them. -# -prepare: $(DOWNLOAD_DIR) $(CONTRIB_DIR) - -# -# Utility to check if a tool is installed -# -check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) - -$(call check_tool,wget) -$(call check_tool,patch) -$(call check_tool,gpg) -$(call check_tool,md5sum) -$(call check_tool,sha1sum) -$(call check_tool,sha256sum) - -# -# Include information about available ports -# -# Each '.mk' file in the 'ports/' directory extends the following -# variables: -# -# PORTS - list names of the available ports, e.g., 'freetype-2.3.9' -# GEN_DIRS - list of automatically generated directories -# GEN_FILES - list of automatically generated files -# -# Furthermore, each '.mk' file extends the 'prepare' rule for -# downloading and unpacking the corresponding upstream sources. -# -PKG ?= $(patsubst ports/%.mk,%,$(wildcard ports/*.mk)) -include $(addprefix ports/,$(addsuffix .mk,$(PKG))) - -help:: - $(ECHO) - $(ECHO) "Download and unpack upstream source codes:" - @for i in $(PORTS); do echo " $$i"; done - $(ECHO) - $(ECHO) "Downloads will be placed into the '$(DOWNLOAD_DIR)/' directory." - $(ECHO) "Source codes will be unpacked in the '$(CONTRIB_DIR)/' directory." - $(ECHO) - $(ECHO) "--- available commands ---" - $(ECHO) "prepare - download and unpack upstream source codes" - $(ECHO) "clean - remove upstream source codes" - $(ECHO) "cleanall - remove upstream source codes and downloads" - $(ECHO) - $(ECHO) "--- available arguments ---" - $(ECHO) "PKG= - prepare only the specified packages," - $(ECHO) " each package specified w/o version number" - -prepare: $(addprefix prepare-,$(PKG)) - -$(DOWNLOAD_DIR) $(CONTRIB_DIR): - $(VERBOSE)mkdir -p $@ - -clean: $(addprefix clean-,$(PKG)) - $(VERBOSE)if [ -d $(CONTRIB_DIR) ]; then \ - $(GNU_FIND) $(CONTRIB_DIR) -depth -type d -empty -delete; fi - -cleanall: clean - $(VERBOSE)rm -rf $(DOWNLOAD_DIR) - -.NOTPARALLEL: +include ../../tool/prepare.mk diff --git a/repos/ports/Makefile b/repos/ports/Makefile index 0f36cf2d56..ba10c4fabf 100644 --- a/repos/ports/Makefile +++ b/repos/ports/Makefile @@ -1,88 +1 @@ -# -# \brief Download and unpack upstream library source codes -# \author Norman Feske -# \date 2009-10-16 -# - -# -# Print help information by default -# -help:: - -VERBOSE ?= @ -ECHO = @echo -DOWNLOAD_DIR = download -CONTRIB_DIR = contrib -GNU_FIND = find -SHELL = bash -SIGVERIFIER = $(CURDIR)/../../tool/download_sigver -HASHVERIFIER = $(CURDIR)/../../tool/download_hashver - -# -# Create download and contrib directory so that '.mk' files -# do not need to care for them. -# -prepare:: $(DOWNLOAD_DIR) $(CONTRIB_DIR) - -# -# Utility to check if a tool is installed -# -check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) - -$(call check_tool,wget) -$(call check_tool,patch) -$(call check_tool,gpg) -$(call check_tool,md5sum) -$(call check_tool,sha1sum) -$(call check_tool,sha256sum) - -# -# Include information about available ports -# -# Each '.mk' file in the 'ports/' directory extends the following -# variables: -# -# PORTS - list names of the available ports, e.g., 'freetype-2.3.9' -# GEN_DIRS - list of automatically generated directories -# GEN_FILES - list of automatically generated files -# -# Furthermore, each '.mk' file extends the 'prepare' rule for -# downloading and unpacking the corresponding upstream sources. -# -PKG ?= * -include $(addprefix ports/,$(addsuffix .mk,$(PKG))) - -help:: - $(ECHO) "" - $(ECHO) "Download and unpack upstream source codes:" - @for i in $(PORTS); do echo " $$i"; done - $(ECHO) "" - $(ECHO) "Downloads will be placed into the '$(DOWNLOAD_DIR)/' directory." - $(ECHO) "Source codes will be unpacked in the '$(CONTRIB_DIR)/' directory." - $(ECHO) "" - $(ECHO) "--- available commands ---" - $(ECHO) "prepare - download and unpack upstream source codes" - $(ECHO) "clean - remove upstream source codes" - $(ECHO) "cleanall - remove upstream source codes and downloads" - $(ECHO) "" - $(ECHO) "--- available arguments ---" - $(ECHO) "PKG= - prepare only the specified packages," - $(ECHO) " each package specified w/o version number" - -# -# Remove download and contrib directories if empty -# -prepare:: - $(VERBOSE)$(GNU_FIND) $(DOWNLOAD_DIR) -depth -type d -empty -delete - $(VERBOSE)$(GNU_FIND) $(CONTRIB_DIR) -depth -type d -empty -delete - -$(DOWNLOAD_DIR) $(CONTRIB_DIR): - $(VERBOSE)mkdir -p $@ - -clean:: - $(VERBOSE)rm -rf $(CONTRIB_DIR) - -cleanall: clean - $(VERBOSE)rm -rf $(DOWNLOAD_DIR) - -.NOTPARALLEL: +include ../../tool/prepare.mk diff --git a/repos/ports/ports/arora.mk b/repos/ports/ports/arora.mk index f117d4ee14..c65d3e7c1d 100644 --- a/repos/ports/ports/arora.mk +++ b/repos/ports/ports/arora.mk @@ -7,7 +7,7 @@ ARORA_URL = http://arora.googlecode.com/files/$(ARORA_TGZ) # PORTS += $(ARORA) -prepare:: $(CONTRIB_DIR)/$(ARORA) +prepare-arora: $(CONTRIB_DIR)/$(ARORA) PATCHES_DIR = src/app/arora/patches @@ -21,3 +21,6 @@ $(CONTRIB_DIR)/$(ARORA): $(DOWNLOAD_DIR)/$(ARORA_TGZ) $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ $(VERBOSE)for p in $(shell cat $(PATCHES_DIR)/series); do \ patch -d $@ -p1 -i ../../$(PATCHES_DIR)/$$p; done; + +clean-arora: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(ARORA) diff --git a/repos/ports/ports/bash.mk b/repos/ports/ports/bash.mk index 6cf8fa830c..4e886bdfb5 100644 --- a/repos/ports/ports/bash.mk +++ b/repos/ports/ports/bash.mk @@ -11,7 +11,7 @@ BASH_KEY = GNU # PORTS += $(BASH) -prepare:: $(CONTRIB_DIR)/$(BASH) +prepare-bash: $(CONTRIB_DIR)/$(BASH) # # Port-specific local rules @@ -32,3 +32,5 @@ $(CONTRIB_DIR)/$(BASH): $(DOWNLOAD_DIR)/$(BASH_TGZ).verified $(VERBOSE)patch -d $(CONTRIB_DIR)/$(BASH) -N -p1 < src/noux-pkg/bash/build.patch $(VERBOSE)patch -d $(CONTRIB_DIR)/$(BASH) -N -p1 < src/noux-pkg/bash/check_dev_tty.patch +clean-bash: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(BASH) diff --git a/repos/ports/ports/binutils.mk b/repos/ports/ports/binutils.mk index 1448333dc7..ffc89fb254 100644 --- a/repos/ports/ports/binutils.mk +++ b/repos/ports/ports/binutils.mk @@ -11,7 +11,7 @@ BINUTILS_KEY = GNU # PORTS += $(BINUTILS) -prepare:: $(CONTRIB_DIR)/$(BINUTILS) +prepare-binutils: $(CONTRIB_DIR)/$(BINUTILS) # # Port-specific local rules @@ -30,3 +30,6 @@ $(DOWNLOAD_DIR)/$(BINUTILS_TBZ2).verified: $(DOWNLOAD_DIR)/$(BINUTILS_TBZ2) \ $(CONTRIB_DIR)/$(BINUTILS): $(DOWNLOAD_DIR)/$(BINUTILS_TBZ2).verified $(VERBOSE)tar xfj $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ $(VERBOSE)patch -d $(CONTRIB_DIR)/$(BINUTILS) -N -p1 < src/noux-pkg/binutils/build.patch + +clean-binutils: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(BINUTILS) diff --git a/repos/ports/ports/coreutils.mk b/repos/ports/ports/coreutils.mk index 74d694273d..f57af88a99 100644 --- a/repos/ports/ports/coreutils.mk +++ b/repos/ports/ports/coreutils.mk @@ -11,7 +11,7 @@ COREUTILS_KEY = GNU # PORTS += $(COREUTILS) -prepare:: $(CONTRIB_DIR)/$(COREUTILS) +prepare-coreutils: $(CONTRIB_DIR)/$(COREUTILS) # # Port-specific local rules @@ -30,3 +30,5 @@ $(DOWNLOAD_DIR)/$(COREUTILS_TGZ).verified: $(DOWNLOAD_DIR)/$(COREUTILS_TGZ) \ $(CONTRIB_DIR)/$(COREUTILS): $(DOWNLOAD_DIR)/$(COREUTILS_TGZ) $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ +clean-coreutils: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(COREUTILS) diff --git a/repos/ports/ports/dash.mk b/repos/ports/ports/dash.mk index 285bd26bbb..55f1e8281a 100644 --- a/repos/ports/ports/dash.mk +++ b/repos/ports/ports/dash.mk @@ -7,7 +7,7 @@ DASH_URL = http://gondor.apana.org.au/~herbert/dash/files/$(DASH_TGZ) # PORTS += $(DASH) -prepare:: $(CONTRIB_DIR)/$(DASH) +prepare-dash: $(CONTRIB_DIR)/$(DASH) # # Port-specific local rules @@ -19,3 +19,6 @@ $(CONTRIB_DIR)/$(DASH): $(DOWNLOAD_DIR)/$(DASH_TGZ) $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ $(VERBOSE)patch -N -p0 < src/noux-pkg/dash/build.patch +clean-dash: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(DASH) + diff --git a/repos/ports/ports/dosbox.mk b/repos/ports/ports/dosbox.mk index 98ce5c611a..38b40edb7e 100644 --- a/repos/ports/ports/dosbox.mk +++ b/repos/ports/ports/dosbox.mk @@ -7,7 +7,7 @@ DOSBOX_SVN_URL = http://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk # PORTS += $(DOSBOX) -prepare:: $(CONTRIB_DIR)/$(DOSBOX) +prepare-dosbox: $(CONTRIB_DIR)/$(DOSBOX) # # Port-specific local rules @@ -17,3 +17,6 @@ $(CONTRIB_DIR)/$(DOSBOX): $(VERBOSE)svn export $(DOSBOX_SVN_URL)@$(DOSBOX_REV) $@ $(VERBOSE)for i in src/app/dosbox/patches/*.patch; do \ patch -N -p0 < $$i; done || true + +clean-dosbox: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(DOSBOX) diff --git a/repos/ports/ports/e2fsprogs.mk b/repos/ports/ports/e2fsprogs.mk index db637e4659..db11a02227 100644 --- a/repos/ports/ports/e2fsprogs.mk +++ b/repos/ports/ports/e2fsprogs.mk @@ -10,7 +10,7 @@ $(call check_tool,git) # PORTS += $(E2FSPROGS) -prepare:: $(CONTRIB_DIR)/$(E2FSPROGS) +prepare-e2fsprogs: $(CONTRIB_DIR)/$(E2FSPROGS) # # Port-specific local rules @@ -21,3 +21,6 @@ $(CONTRIB_DIR)/$(E2FSPROGS): git checkout -b $(E2FSPROGS_BRANCH) $(E2FSPROGS_BRANCH) $(VERBOSE)for i in src/noux-pkg/e2fsprogs/patches/*.patch; do \ patch -d $(CONTRIB_DIR)/$(E2FSPROGS) -N -p1 < $$i; done || true + +clean-e2fsprogs: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(E2FSPROGS) diff --git a/repos/ports/ports/etc.mk b/repos/ports/ports/etc.mk index 0fa08fbc9d..bb7e778659 100644 --- a/repos/ports/ports/etc.mk +++ b/repos/ports/ports/etc.mk @@ -19,7 +19,7 @@ $(CONTRIB_DIR)/$(ETC): $(ECHO) "checking out 'etc' to '$@'" $(VERBOSE)svn export $(ETC_SVN_BASE)/etc $@ -prepare:: $(CONTRIB_DIR)/$(ETC) +prepare-etc: $(CONTRIB_DIR)/$(ETC) clean-etc: $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(ETC) diff --git a/repos/ports/ports/findutils.mk b/repos/ports/ports/findutils.mk index c156661e65..fb7c6d8c9b 100644 --- a/repos/ports/ports/findutils.mk +++ b/repos/ports/ports/findutils.mk @@ -11,7 +11,7 @@ FINDUTILS_KEY = GNU # PORTS += $(FINDUTILS) -prepare:: $(CONTRIB_DIR)/$(FINDUTILS) +prepare-findutils: $(CONTRIB_DIR)/$(FINDUTILS) # # Port-specific local rules @@ -30,3 +30,6 @@ $(DOWNLOAD_DIR)/$(FINDUTILS_TGZ).verified: $(DOWNLOAD_DIR)/$(FINDUTILS_TGZ) \ $(CONTRIB_DIR)/$(FINDUTILS): $(DOWNLOAD_DIR)/$(FINDUTILS_TGZ).verified $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ $(VERBOSE)patch -d $(CONTRIB_DIR)/$(FINDUTILS) -N -p1 < src/noux-pkg/findutils/build.patch + +clean-findutils: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(FINDUTILS) diff --git a/repos/ports/ports/gcc.mk b/repos/ports/ports/gcc.mk index 015cdf79b9..8a82a88e62 100644 --- a/repos/ports/ports/gcc.mk +++ b/repos/ports/ports/gcc.mk @@ -10,7 +10,7 @@ GCC_KEY = GNU # PORTS += $(GCC) -prepare:: $(CONTRIB_DIR)/$(GCC)/configure +prepare-gcc: $(CONTRIB_DIR)/$(GCC)/configure # # Port-specific local rules @@ -57,3 +57,6 @@ $(CONTRIB_DIR)/$(GCC)/configure:: $(CONTRIB_DIR)/$(GCC) @# $(VERBOSE)patch -d $(CONTRIB_DIR)/$(GCC) -N -p1 < src/noux-pkg/gcc/build.patch $(VERBOSE)patch -d $(CONTRIB_DIR)/$(GCC) -N -p1 < src/noux-pkg/gcc/build_with_makeinfo_5.patch + +clean-gcc: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(GCC) diff --git a/repos/ports/ports/gdb.mk b/repos/ports/ports/gdb.mk index e9fcc71ba6..02a1f65197 100644 --- a/repos/ports/ports/gdb.mk +++ b/repos/ports/ports/gdb.mk @@ -45,7 +45,7 @@ GDB_CONTENT := gdb/regformats/regdat.sh \ # PORTS += $(GDB) -prepare:: clean-gdb $(CONTRIB_DIR)/$(GDB)/configure generated_files +prepare-gdb: clean-gdb $(CONTRIB_DIR)/$(GDB)/configure generated_files clean-gdb: $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(GDB) diff --git a/repos/ports/ports/grep.mk b/repos/ports/ports/grep.mk index 26132ace0d..183e43b485 100644 --- a/repos/ports/ports/grep.mk +++ b/repos/ports/ports/grep.mk @@ -9,7 +9,7 @@ GNUGREP_KEY = GNU # PORTS += $(GNUGREP) -prepare:: $(CONTRIB_DIR)/$(GNUGREP) +prepare-grep: $(CONTRIB_DIR)/$(GNUGREP) # # Port-specific local rules @@ -28,3 +28,5 @@ $(DOWNLOAD_DIR)/$(GNUGREP_TXZ).verified: $(DOWNLOAD_DIR)/$(GNUGREP_TXZ) \ $(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/$(GNUGREP_TXZ) $(DOWNLOAD_DIR)/$(GNUGREP_SIG) $(GNUGREP_KEY) $(VERBOSE)touch $@ +clean-grep: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(GNUGREP) diff --git a/repos/ports/ports/lighttpd.mk b/repos/ports/ports/lighttpd.mk index 5709e8c03c..71ed4daf88 100644 --- a/repos/ports/ports/lighttpd.mk +++ b/repos/ports/ports/lighttpd.mk @@ -12,7 +12,7 @@ LIGHTTPD_KEY = stbuehler@lighttpd.net # PORTS += $(LIGHTTPD) -prepare:: $(CONTRIB_DIR)/$(LIGHTTPD) +prepare-lighttpd: $(CONTRIB_DIR)/$(LIGHTTPD) # # Port-specific local rules @@ -31,3 +31,6 @@ $(DOWNLOAD_DIR)/$(LIGHTTPD_TGZ).verified: $(DOWNLOAD_DIR)/$(LIGHTTPD_TGZ) \ $(CONTRIB_DIR)/$(LIGHTTPD): $(DOWNLOAD_DIR)/$(LIGHTTPD_TGZ).verified $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ $(VERBOSE)patch -N -p1 < src/app/lighttpd/disable_gethostbyaddr_fcntl.patch + +clean-lighttpd: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(LIGHTTPD) diff --git a/repos/ports/ports/lynx.mk b/repos/ports/ports/lynx.mk index 31669c4a2f..2bb5e9a686 100644 --- a/repos/ports/ports/lynx.mk +++ b/repos/ports/ports/lynx.mk @@ -10,7 +10,7 @@ LYNX_KEY = dickey@sf1.isc.org # PORTS += $(LYNX) -prepare:: $(CONTRIB_DIR)/$(LYNX) +prepare-lynx: $(CONTRIB_DIR)/$(LYNX) # # Port-specific local rules @@ -34,3 +34,6 @@ $(DOWNLOAD_DIR)/$(LYNX_TGZ).verified: $(DOWNLOAD_DIR)/$(LYNX_TGZ) $(CONTRIB_DIR)/$(LYNX): $(DOWNLOAD_DIR)/$(LYNX_TGZ).verified $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/lynx/build.patch + +clean-lynx: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(LYNX) diff --git a/repos/ports/ports/make.mk b/repos/ports/ports/make.mk index 3fe403c909..81682b7a7b 100644 --- a/repos/ports/ports/make.mk +++ b/repos/ports/ports/make.mk @@ -11,7 +11,7 @@ GNUMAKE_KEY = GNU # PORTS += $(GNUMAKE) -prepare:: $(CONTRIB_DIR)/$(GNUMAKE) +prepare-make: $(CONTRIB_DIR)/$(GNUMAKE) # # Port-specific local rules @@ -30,3 +30,5 @@ $(DOWNLOAD_DIR)/$(GNUMAKE_TGZ).verified: $(DOWNLOAD_DIR)/$(GNUMAKE_TGZ) \ $(CONTRIB_DIR)/$(GNUMAKE): $(DOWNLOAD_DIR)/$(GNUMAKE_TGZ).verified $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ +clean-make: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(GNUMAKE) diff --git a/repos/ports/ports/netcat.mk b/repos/ports/ports/netcat.mk index 58a6d67a22..00704a756f 100644 --- a/repos/ports/ports/netcat.mk +++ b/repos/ports/ports/netcat.mk @@ -8,7 +8,7 @@ GNUNETCAT_URL = http://downloads.sourceforge.net/sourceforge/netcat/netcat-$(GNU # PORTS += $(GNUNETCAT) -prepare:: $(CONTRIB_DIR)/$(GNUNETCAT) +prepare-netcat: $(CONTRIB_DIR)/$(GNUNETCAT) # # Port-specific local rules @@ -19,3 +19,5 @@ $(DOWNLOAD_DIR)/$(GNUNETCAT_TBZ): $(CONTRIB_DIR)/$(GNUNETCAT): $(DOWNLOAD_DIR)/$(GNUNETCAT_TBZ) $(VERBOSE)tar xfj $< -C $(CONTRIB_DIR) && touch $@ +clean-netcat: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(GNUNETCAT) diff --git a/repos/ports/ports/netperf.mk b/repos/ports/ports/netperf.mk index 27f4b20a47..01008ddb23 100644 --- a/repos/ports/ports/netperf.mk +++ b/repos/ports/ports/netperf.mk @@ -27,7 +27,7 @@ apply_patches-netperf: checkout-netperf xargs -ixxx sh -c "patch -p0 -r - -N -d $(CONTRIB_DIR)/$(NETPERF) < xxx" || true $(VERBOSE)echo '#define NETPERF_VERSION "$(NETPERF_VERSION)"' >$(CONTRIB_DIR)/$(NETPERF)/src/netperf_version.h -prepare:: apply_patches-netperf +prepare-netperf: apply_patches-netperf clean-netperf: $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(NETPERF) diff --git a/repos/ports/ports/openssh.mk b/repos/ports/ports/openssh.mk index b918c9bc1b..c601af54b8 100644 --- a/repos/ports/ports/openssh.mk +++ b/repos/ports/ports/openssh.mk @@ -11,7 +11,7 @@ OPENSSH_KEY = 3981992A1523ABA079DBFC66CE8ECB0386FF9C48 # PORTS += $(OPENSSH) -prepare:: $(CONTRIB_DIR)/$(OPENSSH) +prepare-openssh: $(CONTRIB_DIR)/$(OPENSSH) # # Port-specific local rules @@ -32,3 +32,6 @@ $(CONTRIB_DIR)/$(OPENSSH): $(DOWNLOAD_DIR)/$(OPENSSH_TGZ).verified $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/openssh/monitor_fdpass.c.patch $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/openssh/sshconnect.h.patch $(VERBOSE)patch -d contrib/ -N -p0 < src/noux-pkg/openssh/includes_h.patch + +clean-openssh: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(OPENSSH) diff --git a/repos/ports/ports/sed.mk b/repos/ports/ports/sed.mk index a72e0b35cf..d9e171fcef 100644 --- a/repos/ports/ports/sed.mk +++ b/repos/ports/ports/sed.mk @@ -9,7 +9,7 @@ GNUSED_KEY = GNU # PORTS += $(GNUSED) -prepare:: $(CONTRIB_DIR)/$(GNUSED) +prepare-sed: $(CONTRIB_DIR)/$(GNUSED) # # Port-specific local rules @@ -28,3 +28,6 @@ $(DOWNLOAD_DIR)/$(GNUSED_TGZ).verified: $(DOWNLOAD_DIR)/$(GNUSED_TGZ) \ $(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/$(GNUSED_TGZ) $(DOWNLOAD_DIR)/$(GNUSED_SIG) $(GNUSED_KEY) $(VERBOSE)touch $@ +clean-sed: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(SED) + diff --git a/repos/ports/ports/seoul.mk b/repos/ports/ports/seoul.mk index 88f5fbd3f7..8d7b5b0a99 100644 --- a/repos/ports/ports/seoul.mk +++ b/repos/ports/ports/seoul.mk @@ -24,7 +24,7 @@ python_not_installed: @false; endif -prepare:: fetch-new-version $(CONTRIB_DIR)/$(SEOUL)/genode_prepared +prepare-seoul: fetch-new-version $(CONTRIB_DIR)/$(SEOUL)/genode_prepared # # Port-specific local rules @@ -63,3 +63,6 @@ $(CONTRIB_DIR)/$(SEOUL)/genode_prepared: $(CONTRIB_DIR)/$(SEOUL) touch $(CURDIR)/$@ .PHONY: fetch-new-version + +clean-seoul: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(SEOUL) diff --git a/repos/ports/ports/vim.mk b/repos/ports/ports/vim.mk index efd4ea3d54..a88b81062c 100644 --- a/repos/ports/ports/vim.mk +++ b/repos/ports/ports/vim.mk @@ -13,7 +13,7 @@ PORTS += $(VIM) # $(call check_tool,sed) -prepare:: $(CONTRIB_DIR)/$(VIM) +prepare-vim: $(CONTRIB_DIR)/$(VIM) # # Port-specific local rules @@ -40,3 +40,6 @@ $(CONTRIB_DIR)/$(VIM): $(DOWNLOAD_DIR)/$(VIM_TBZ2).verified @# $(VERBOSE)sed -i "/default_vim_dir/s/.(VIMRCLOC)/\/share\/vim/" $@/src/Makefile $(VERBOSE)patch -d $(CONTRIB_DIR)/$(VIM) -N -p1 < src/noux-pkg/vim/build.patch + +clean-vim: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(VIM) diff --git a/repos/ports/ports/virtualbox.mk b/repos/ports/ports/virtualbox.mk index b7fa31c3b9..863045f6bc 100644 --- a/repos/ports/ports/virtualbox.mk +++ b/repos/ports/ports/virtualbox.mk @@ -57,7 +57,7 @@ apply_patches: patch -p0 -N -d $(CONTRIB_DIR)/$(VIRTUALBOX) -i $$p; \ done -prepare:: $(CONTRIB_DIR)/$(VIRTUALBOX) apply_patches +prepare-virtualbox: $(CONTRIB_DIR)/$(VIRTUALBOX) apply_patches # # Port-specific local rules @@ -80,3 +80,6 @@ $(CONTRIB_DIR)/$(VIRTUALBOX): $(DOWNLOAD_DIR)/$(VIRTUALBOX_TBZ2).verified rm $(CONTRIB_DIR)/$(VIRTUALBOX)/src/VBox/Frontends/VBoxBFE/SDLConsole.h && \ rm $(CONTRIB_DIR)/$(VIRTUALBOX)/src/VBox/Frontends/VBoxBFE/SDLFramebuffer.h; \ if [ $$? -ne 0 ]; then rm -r $(CONTRIB_DIR)/$(VIRTUALBOX); exit 1; fi + +clean-virtualbox: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(VIRTUALBOx) diff --git a/repos/ports/ports/which.mk b/repos/ports/ports/which.mk index 10b4f63251..a310f51624 100644 --- a/repos/ports/ports/which.mk +++ b/repos/ports/ports/which.mk @@ -11,7 +11,7 @@ WHICH_KEY = GNU # PORTS += $(WHICH) -prepare:: $(CONTRIB_DIR)/$(WHICH) +prepare-which: $(CONTRIB_DIR)/$(WHICH) # # Port-specific local rules @@ -29,3 +29,6 @@ $(DOWNLOAD_DIR)/$(WHICH_TGZ).verified: $(DOWNLOAD_DIR)/$(WHICH_TGZ) \ $(CONTRIB_DIR)/$(WHICH): $(DOWNLOAD_DIR)/$(WHICH_TGZ).verified $(VERBOSE)tar xfz $(<:.verified=) -C $(CONTRIB_DIR) && touch $@ + +clean-which: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(WHICH) diff --git a/tool/README b/tool/README index d354cd7f96..3cb7e7b011 100644 --- a/tool/README +++ b/tool/README @@ -54,3 +54,9 @@ of Genode. Autopilot is a tool for the automatic execution of run scripts among multiple base platforms. +:'prepare.mk': + + Tool for downloading and integrating 3rd-party source codes with Genode. + This file is included by the makefiles in the root of source-code + repositories that interface with 3rd-party code, e.g., libports and ports. + diff --git a/tool/prepare.mk b/tool/prepare.mk new file mode 100644 index 0000000000..f1222b8444 --- /dev/null +++ b/tool/prepare.mk @@ -0,0 +1,84 @@ +# +# \brief Download and unpack upstream library source codes +# \author Norman Feske +# \date 2009-10-16 +# + +# +# Print help information by default +# +help:: + +VERBOSE ?= @ +ECHO = @echo +DOWNLOAD_DIR = download +CONTRIB_DIR = contrib +GNU_FIND = find +SHELL = bash +SIGVERIFIER = $(CURDIR)/../../tool/download_sigver +HASHVERIFIER = $(CURDIR)/../../tool/download_hashver + +# +# Create download and contrib directory so that '.mk' files +# do not need to care for them. +# +prepare: $(DOWNLOAD_DIR) $(CONTRIB_DIR) + +# +# Utility to check if a tool is installed +# +check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) + +$(call check_tool,wget) +$(call check_tool,patch) +$(call check_tool,gpg) +$(call check_tool,md5sum) +$(call check_tool,sha1sum) +$(call check_tool,sha256sum) + +# +# Include information about available ports +# +# Each '.mk' file in the 'ports/' directory extends the following +# variables: +# +# PORTS - list names of the available ports, e.g., 'freetype-2.3.9' +# GEN_DIRS - list of automatically generated directories +# GEN_FILES - list of automatically generated files +# +# Furthermore, each '.mk' file extends the 'prepare' rule for +# downloading and unpacking the corresponding upstream sources. +# +PKG ?= $(patsubst ports/%.mk,%,$(wildcard ports/*.mk)) +include $(addprefix ports/,$(addsuffix .mk,$(PKG))) + +help:: + $(ECHO) + $(ECHO) "Download and unpack upstream source codes:" + @for i in $(PORTS); do echo " $$i"; done + $(ECHO) + $(ECHO) "Downloads will be placed into the '$(DOWNLOAD_DIR)/' directory." + $(ECHO) "Source codes will be unpacked in the '$(CONTRIB_DIR)/' directory." + $(ECHO) + $(ECHO) "--- available commands ---" + $(ECHO) "prepare - download and unpack upstream source codes" + $(ECHO) "clean - remove upstream source codes" + $(ECHO) "cleanall - remove upstream source codes and downloads" + $(ECHO) + $(ECHO) "--- available arguments ---" + $(ECHO) "PKG= - prepare only the specified packages," + $(ECHO) " each package specified w/o version number" + +prepare: $(addprefix prepare-,$(PKG)) + +$(DOWNLOAD_DIR) $(CONTRIB_DIR): + $(VERBOSE)mkdir -p $@ + +clean: $(addprefix clean-,$(PKG)) + $(VERBOSE)if [ -d $(CONTRIB_DIR) ]; then \ + $(GNU_FIND) $(CONTRIB_DIR) -depth -type d -empty -delete; fi + +cleanall: clean + $(VERBOSE)rm -rf $(DOWNLOAD_DIR) + +.NOTPARALLEL: