From eb7c32add8c0c00876e629e273e1298dddbc4a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Sun, 24 Mar 2024 21:42:53 +0100 Subject: vars/gcc.vars: manually honour -r ALL,... vars/gcc.vars: always mkdir prerequisite directories. etc/README.md: updated. --- etc/README.md | 5 +- vars/gcc.vars | 171 +++++++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 144 insertions(+), 32 deletions(-) diff --git a/etc/README.md b/etc/README.md index 794d2fbf..908675bf 100644 --- a/etc/README.md +++ b/etc/README.md @@ -303,8 +303,11 @@ Rebuild entire build groups including or excluding group dependencies, respectiv Forcibly (re)download all archive files and/or Git repositories associated with all packages: ```shell -./build.sh [ ... ] -r ALL:@fetch +./build.sh [ ... ] -r ALL:@fetch,finish ``` +> N.B. the "finish" (pseudo-)build step must be included here and in similar use cases so that all +affected packages are marked as having finished building in order to correctly satisfy package-package +dependencies. [Back to top](#table-of-contents) diff --git a/vars/gcc.vars b/vars/gcc.vars index 49dbaf07..d40cd7ba 100644 --- a/vars/gcc.vars +++ b/vars/gcc.vars @@ -188,8 +188,10 @@ pkgp_gcc_stage1_all() { ;; gcc_stage1_cross) - if ! rtl_fileop ln_symbolic . "${PREFIX_LOCAL_CROSS}/usr"\ + if ! rtl_fileop mkdir . "${PREFIX_LOCAL_CROSS}"\ + || ! rtl_fileop ln_symbolic . "${PREFIX_LOCAL_CROSS}/usr"\ || ! rtl_fileop mkdir "${PREFIX_LOCAL_CROSS}/usr/include"\ + || ! rtl_fileop mkdir "${PREFIX_CROSS}"\ || ! rtl_fileop ln_symbolic . "${PREFIX_CROSS}/usr"\ || ! rtl_fileop mkdir "${PREFIX_CROSS}/usr/include"\ || ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross; then @@ -198,8 +200,10 @@ pkgp_gcc_stage1_all() { ;; gcc_stage1_host) - if ! rtl_fileop ln_symbolic . "${PREFIX_CROSS}/usr"\ + if ! rtl_fileop mkdir . "${PREFIX_CROSS}"\ + || ! rtl_fileop ln_symbolic . "${PREFIX_CROSS}/usr"\ || ! rtl_fileop mkdir "${PREFIX_CROSS}/usr/include"\ + || ! rtl_fileop mkdir . "${PREFIX_NATIVE}"\ || ! rtl_fileop ln_symbolic . "${PREFIX_NATIVE}/usr"\ || ! rtl_fileop mkdir "${PREFIX_NATIVE}/usr/include"\ || ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" host; then @@ -217,7 +221,10 @@ pkgp_gcc_stage1_all() { return 1; fi; - if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,fetch_clean,fetch_download,fetch_extract" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}" ); + then if ! rtl_fetch_dlcache_subdir \ "${BUILD_DLCACHEDIR}" "${PKG_NAME}" \ "${PKG_INHERIT_FROM:-}"; @@ -233,7 +240,10 @@ pkgp_gcc_stage1_all() { fi; fi; - if ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,configure_patch" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}" ); + then if [ -e "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" ]; then patch -b -d "${PKG_BASE_DIR}" -p0 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" || return 1; fi; @@ -243,7 +253,10 @@ pkgp_gcc_stage1_all() { pkgp_gcc_setup_vars; pkgp_gcc_setup_env; - if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,configure" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}" ); + then case "${PKG_NAME}" in gcc_stage1_host_mingw32) @@ -307,21 +320,31 @@ pkgp_gcc_stage1_all() { if [ "${?}" -ne 0 ]; then return 1; fi; - else + elif [ "${_restart_at:+1}" != 1 ]\ + || rtl_lmatch \$_restart_at "ALL,build,install_subdirs,install_make,install" ","; then rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}" || return 1; fi; - if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,build" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "all-gcc" || return 1; pkgp_gcc_state_set "build" "install_subdirs"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_subdirs" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}" ); + then pkg_install_subdirs "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install_subdirs" "install_make"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_make" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}" ); + then case "${PKG_NAME}" in gcc_stage1_cross_mingw32) @@ -352,7 +375,10 @@ pkgp_gcc_stage1_all() { fi; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}" ); + then pkg_install "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install"; fi; @@ -370,7 +396,10 @@ pkg_gcc_full_all() { pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" native; - if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,fetch_clean,fetch_download,fetch_extract" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}" ); + then if ! rtl_fetch_dlcache_subdir \ "${BUILD_DLCACHEDIR}" "${PKG_NAME}" \ "${PKG_INHERIT_FROM:-}"; @@ -387,7 +416,10 @@ pkg_gcc_full_all() { fi; fi; - if ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,configure_patch" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}" ); + then if [ -e "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" ]; then patch -b -d "${PKG_BASE_DIR}" -p0 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" || return 1; fi; @@ -397,7 +429,10 @@ pkg_gcc_full_all() { pkgp_gcc_setup_vars; pkgp_gcc_setup_env; - if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,configure" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}" ); + then rtl_fileop mkdir "${PKG_PREFIX}/${PKG_TARGET}" || return 1; if [ \! -d "${PKG_PREFIX}/${PKG_TARGET}/usr" ]; then rtl_fileop ln_symbolic . "${PKG_PREFIX}/${PKG_TARGET}/usr" || return 1; @@ -421,7 +456,10 @@ pkg_gcc_full_all() { rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}" || return 1; fi; - if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,build" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}" ); + then if ! make ${PKG_MAKEFLAGS_BUILD:-} "all-gcc"\ || ! make ${PKG_MAKEFLAGS_BUILD:-} "all-target-libgcc" ${_vis_hide}\ || ! make ${PKG_MAKEFLAGS_BUILD:-} "all-target-libstdc++-v3"\ @@ -432,17 +470,26 @@ pkg_gcc_full_all() { fi; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_subdirs" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}" ); + then pkg_install_subdirs "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install_subdirs" "install_make"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_make" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "prefix=${PKG_DESTDIR}" "install" || return 1; pkgp_gcc_state_set "install_make" "install"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}" ); + then pkg_install "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install"; fi; @@ -457,26 +504,46 @@ pkg_gcc_full_host_all() { _toolchain_type="${4:-host}" export MAKE="make LIBTOOL=slibtool"; + if [ "${_restart_at:+1}" = 1 ]\ + && ! rtl_lmatch \$_restart_at "ALL,build,install_subdirs,install_make,install" ","; then + if rtl_lmatch \$_restart_at "finish" ","; then + pkgp_gcc_state_set "finish"; + fi; + return 0; + fi; + if ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" ${_toolchain_type} \ || ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; then return 1; else - if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,build" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} || return 1; pkgp_gcc_state_set "build" "install_subdirs"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_subdirs" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}" ); + then pkg_install_subdirs "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install_subdirs" "install_make"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_make" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "prefix=${PKG_DESTDIR}" "install" || return 1; pkgp_gcc_state_set "install_make" "install"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}" ); + then pkg_install "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install"; fi; @@ -496,26 +563,46 @@ pkg_gcc_libstdcpp_v3_host_all() { _toolchain_type="${4:-host}" export MAKE="make LIBTOOL=slibtool"; + if [ "${_restart_at:+1}" = 1 ]\ + && ! rtl_lmatch \$_restart_at "ALL,build,install_subdirs,install_make,install" ","; then + if rtl_lmatch \$_restart_at "finish" ","; then + pkgp_gcc_state_set "finish"; + fi; + return 0; + fi; + if ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" ${_toolchain_type} \ || ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; then return 1; else - if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,build" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "all-target-libstdc++-v3" || return 1; pkgp_gcc_state_set "build" "install_subdirs"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_subdirs" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}" ); + then pkg_install_subdirs "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install_subdirs" "install_make"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_make" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "prefix=${PKG_DESTDIR}" "install-target-libstdc++-v3" || return 1; pkgp_gcc_state_set "install_make" "install"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}" ); + then pkg_install "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install"; fi; @@ -536,26 +623,46 @@ pkg_gcc_runtime_host_all() { _vis_hide="vis_hide=-fvisibility=hidden"; export MAKE="make LIBTOOL=slibtool ${_vis_hide}"; + if [ "${_restart_at:+1}" = 1 ]\ + && ! rtl_lmatch \$_restart_at "ALL,build,install_subdirs,install_make,install" ","; then + if rtl_lmatch \$_restart_at "finish" ","; then + pkgp_gcc_state_set "finish"; + fi; + return 0; + fi; + if ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" ${_toolchain_type} \ || ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; then return 1; else - if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,build" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "all-target-libgcc" ${_vis_hide} || return 1; pkgp_gcc_state_set "build" "install_subdirs"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_subdirs" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}" ); + then pkg_install_subdirs "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install_subdirs" "install_make"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install_make" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}" ); + then make ${PKG_MAKEFLAGS_BUILD:-} "prefix=${PKG_DESTDIR}" "install-target-libgcc" || return 1; pkgp_gcc_state_set "install_make" "install"; fi; - if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then + if rtl_lmatch \$_restart_at "ALL,install" ","\ + || ( [ "${_restart_at:+1}" != 1 ]\ + && ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}" ); + then pkg_install "${_group_name}" "${_pkg_name}" "${_restart_at}" || return 1; pkgp_gcc_state_set "install"; fi; @@ -575,7 +682,8 @@ pkg_gcc_stage1_all() { }; pkg_gcc_stage1_host_mingw32_all() { - if ! rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw"\ + if ! rtl_fileop mkdir . "${PKG_PREFIX}/x86_64-w64-mingw32"\ + || ! rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw"\ || ! rtl_fileop mkdir "${PKG_DESTDIR}/x86_64-w64-mingw32"\ || ! rtl_fileop ln_symbolic . "${PKG_DESTDIR}/x86_64-w64-mingw32/mingw"\ || ! rtl_fileop mkdir "${PKG_PREFIX}/x86_64-w64-mingw32/include"\ @@ -598,7 +706,8 @@ pkg_gcc_stage1_cross_all() { }; pkg_gcc_stage1_native_mingw32_all() { - if ! rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw"\ + if ! rtl_fileop mkdir . "${PKG_PREFIX}/x86_64-w64-mingw32"\ + || ! rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw"\ || ! rtl_fileop mkdir "${PKG_DESTDIR}/x86_64-w64-mingw32"\ || ! rtl_fileop ln_symbolic . "${PKG_DESTDIR}/x86_64-w64-mingw32/mingw"\ || ! rtl_fileop mkdir "${PKG_PREFIX}/x86_64-w64-mingw32/include"\ -- cgit v1.2.3