#!/usr/bin/env build cat >"${BUILDER_MAKEFILE}" <> "${package_prep}" ${package_make}_compile: ${package_compile} ${package_compile}: ${package_prep} @build-make-compile "${CATEGORY}/${NAME}" @date >> "${package_compile}" ${package_make}_package: ${package_archive} ${package_archive}: ${package_compile} @build-make-package "${CATEGORY}/${NAME}" ${package_make}_install: ${package_install} ${package_install}: ${package_archive} ${package_rdeps} @build-make-install "${CATEGORY}/${NAME}" ${package_make}_source: ${package_source} ${package_source}: ${package_sources} @build-make-source "${CATEGORY}/${NAME}" ${package_make}_test: ${package_test} ${package_test}: ${package_tdeps} ${package_install} @build-make-test "${CATEGORY}/${NAME}" ${package_make}_export: ${package_export} ${package_export}: ${package_install} @build-make-export "${CATEGORY}/${NAME}" EOF ## # This is a bit of a fun late-injection of the source archive for a # package. The core problem is that multiple packages may depend on # the same sources, so we set up a separate rule for the source # archive when processing the package, but only if an existing entry # for that source does not exist. We use the source name (as opposed # to the package name) to track if the package already has a rule. The # whole thing really translates into something like # foo_1_1_3_tar_bz2="http://some/path/to/foo-1.1.3.tar.bz2" # All forms of URL translation and variable translation are done for us # by fetch so that makedeps doesn't have any specific expectations on # what the variable name should be. for url in ${SOURCE_URI}; do case "${url}" in # Do not translate local paths into archives in BUILDER_SRCDIR (file://*|/*) echo "${url##file://}:";; # Assume anything else with :// in the name is remote (*://*) var="fetch_$(build-url --archive "${url}"|sed 's/[+.-]/_/g')" if test -z "$(eval echo -n "\$${var}")"; then eval "${var}='${url}'" echo "${BUILDER_SRCDIR}/$(build-url --archive "${url}"):" echo " @build-make-fetch \"${url}\"" fi ;; esac done category="$(echo "${CATEGORY}"|tr '/-' '__')" CATEGORIES="${CATEGORIES} ${category}" eval "${category}_SOURCES=\"\${${category}_SOURCES} ${package_sources}\"" eval "${category}_PACKAGES=\"\${${category}_PACKAGES} ${package_archive}\"" eval "${category}_INSTALL=\"\${${category}_INSTALL} ${package_install}\"" eval "${category}_TEST=\"\${${category}_TEST} ${package_test}\"" eval "${category}_EXPORT=\"\${${category}_EXPORT} ${package_export}\"" eval "${category}_SOURCE=\"\${${category}_SOURCE} ${package_source}\"" eval "${category}_CLEAN=\"\${${category}_CLEAN} ${package_make}_clean\"" eval "${category}_DISTCLEAN=\"\${${category}_DISTCLEAN} ${package_make}_distclean\"" PACKAGES_CLEAN="${PACKAGES_CLEAN} ${package_make}_clean" done >> "${BUILDER_MAKEFILE}" # FIXME It would have been nice to have not inserted the category if it was # already in the list. CATEGORIES="$(for CATEGORY in ${CATEGORIES};do echo "${CATEGORY}";done|sort|uniq)" for CATEGORY in ${CATEGORIES}; do cat<> "${BUILDER_MAKEFILE}" ${CATEGORY}_all: ${CATEGORY}_archive ${CATEGORY}_all_fetch: $(eval echo "\${${CATEGORY}_SOURCES}") ${CATEGORY}_all_archive: $(eval echo "\${${CATEGORY}_PACKAGES}") ${CATEGORY}_all_install: $(eval echo "\${${CATEGORY}_INSTALL}") ${CATEGORY}_all_test: $(eval echo "\${${CATEGORY}_TEST}") ${CATEGORY}_all_export: $(eval echo "\${${CATEGORY}_EXPORT}") ${CATEGORY}_all_source: $(eval echo "\${${CATEGORY}_SOURCE}") ${CATEGORY}_all_clean: $(eval echo "\${${CATEGORY}_CLEAN}") ${CATEGORY}_all_distclean: $(eval echo "\${${CATEGORY}_DISTCLEAN}") all_all: ${CATEGORY}_all all_all_fetch: ${CATEGORY}_all_fetch all_all_archive: ${CATEGORY}_all_archive all_all_install: ${CATEGORY}_all_install all_all_test: ${CATEGORY}_all_test all_all_export: ${CATEGORY}_all_export all_all_source: ${CATEGORY}_all_source EOF done cat<> "${BUILDER_MAKEFILE}" all_clean: ${PACKAGES_CLEAN} exports_clean all_distclean: sysroot_clean artifacts_clean tmpdir_clean exports_clean all_all_distclean: all_distclean all_all_clean: all_clean EOF # vim: filetype=sh