From c2d695ebf0fa170a27042458b2a3b5ec0ad864e6 Mon Sep 17 00:00:00 2001 From: Mark Ferrell Date: Mon, 21 Apr 2014 10:10:09 -0700 Subject: Change how build-makedeps handles depdancies * Instead of generating huge lists of dependancies and then jumping through eval hoops to write them into the Makefile, we now use basic (portable) Makefile syntax to just append dependancies by declaring the comman portion as a separate entry. This should reduce the time spent building the makefile (less shell hoops) and allow us to automatically perform uninstalls for reverse deps. --- libexec/build-make-compile | 2 + libexec/build-make-prep | 2 + libexec/build-make-test | 3 +- libexec/build-makedeps | 274 +++++++++++++++++++-------------------------- 4 files changed, 124 insertions(+), 157 deletions(-) diff --git a/libexec/build-make-compile b/libexec/build-make-compile index d3eb176..3a5de16 100755 --- a/libexec/build-make-compile +++ b/libexec/build-make-compile @@ -92,6 +92,8 @@ build_make_compile() wait find * -depth \( ! -type d \) -print0 > "${binpkg_list}" mv "${binpkg_list}" "${D}/var/db/binpkgs/${CATEGORY}/${NAME}" + + date >> "${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/.compile" )} if test "${BUILDER_CALL_STACK}" = '__main__'; then diff --git a/libexec/build-make-prep b/libexec/build-make-prep index f9f74db..732c7cf 100755 --- a/libexec/build-make-prep +++ b/libexec/build-make-prep @@ -86,6 +86,8 @@ build_make_prep() fi >> "${PKG_LOGFILE}" 2>&1 done fi + + date > "${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/.prep" )} if test "${BUILDER_CALL_STACK}" = '__main__'; then diff --git a/libexec/build-make-test b/libexec/build-make-test index e72dfd9..bd9f5d6 100755 --- a/libexec/build-make-test +++ b/libexec/build-make-test @@ -24,7 +24,8 @@ build_make_test() cd "${W}" pkg_test >> "${PKG_LOGFILE}" 2>&1 - )} + date >> "${BUILDER_TMPDIR}/${CATEGORY}/${NAME}/.test" +)} if test "${BUILDER_CALL_STACK}" = '__main__'; then simple_usage 'test' '[all|[/]]' "$@" diff --git a/libexec/build-makedeps b/libexec/build-makedeps index 9cf62fb..1156626 100755 --- a/libexec/build-makedeps +++ b/libexec/build-makedeps @@ -1,45 +1,43 @@ #!/usr/bin/env build + +build_makedeps_name() { echo "${1}"|tr '/-' '__'; } + 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 + ## + # Produce the various build commands + printf "${makedep_prep}:\n\t@build-make-prep '${package}'\n" + printf "${makedep_compile}: ${makedep_prep}\n\t@build-make-compile '${package}'\n" + printf "${makedep_package}: ${makedep_compile}\n\t@build-make-package '${package}'\n" + printf "${makedep_install}: ${makedep_package}\n\t@build-make-install '${package}'\n" + printf "${makedep_test}: ${makedep_install}\n\t@build-make-test '${package}'\n" + printf "${makedep_export}: ${makedep_install}\n\t@build-make-export '${package}'\n" + printf "${makedep_target}_clean:\n\t@build-make-clean '${package}'\n" + printf "${makedep_target}_distclean:\n\t@build-make-distclean '${package}'\n" ## # This is a bit of a fun late-injection of the source archive for a @@ -188,7 +196,6 @@ EOF # 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 @@ -206,52 +213,7 @@ EOF 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" + printf '# End of %s\n\n' "${CATEGORY}/${NAME}" 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 -- cgit v1.2.3-18-g5258