Unify 'make prepare' between libports and ports

This commit is contained in:
Norman Feske 2014-05-07 15:59:56 +02:00
parent ca971bbfd8
commit b2f78cc475
27 changed files with 170 additions and 195 deletions

View File

@ -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 '<port>.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 '<port>.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 '<port>.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=<package-list> - 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

View File

@ -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 '<port>.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 '<port>.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 '<port>.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=<package-list> - 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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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.

84
tool/prepare.mk Normal file
View File

@ -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 '<port>.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 '<port>.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 '<port>.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=<package-list> - 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: