From 6c6c71b5a6f2b3bceaf15123bbe86cb3adad1633 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Apr 03 2018 22:01:22 +0000 Subject: build.sh:start_build: always build all `invariants' target packages. build.sh:exec_start, vars/invariants_{digest,tarballs}.vars: move ${ARG_TARBALL} checks into invariants_{digest,tarballs}. etc/build.usage: update targets list. vars/build.vars:dist_minipix: renamed to `minipix'. vars/build.vars:dist: split into {dist,invariants}. vars/dist_gitref.vars: renamed to vars/invariants_gitref.vars. --- diff --git a/build.sh b/build.sh index 87385c9..0a64eab 100755 --- a/build.sh +++ b/build.sh @@ -30,6 +30,9 @@ buildp_dispatch() { break; fi; done; + if ! ex_pkg_dispatch "invariants" "ALL" "ALL" buildp_dispatch; then + break; + fi; buildp_dispatch finish_build; ;; finish_build) build_fini; ex_rtl_log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s)."; @@ -86,14 +89,6 @@ buildp_dispatch() { PKG_BUILD_STEPS="$(ex_rtl_lfilter_not \ "${PKG_BUILD_STEPS}" "fetch_git fetch_wget")"; fi; - if [ -z "${ARG_TARBALL}" ]; then - case "${_pkg_name}" in - dist_digest) exit 0; ;; - dist_tarballs) exit 0; ;; - esac; - elif [ "${_pkg_name}" = "dist_tarballs" ]; then - ex_pkg_state_set "${_pkg_name}" -all -finish; - fi; if [ "${ARG_XTRACE:-0}" -eq 1 ]; then set -o xtrace; fi; ;; diff --git a/etc/build.usage b/etc/build.usage index be9df11..3522e9a 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -43,7 +43,7 @@ usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] host or host_tools, host_toolchain_deps, host_toolchain, host_toolchain_mingw32, native or native_tools, native_toolchain_deps, native_toolchain, native_toolchain_mingw32, native_runtime, packages_deps or host_packages_deps, native_packages_deps, native_packages_deps_x11, - packages or native_packages, or dist, dist_minipix, or dist_target. + packages or native_packages, or dist. ${HOME}/midipix_build.vars will be sourced if present. diff --git a/vars/build.vars b/vars/build.vars index 39ed6e7..4f4047c 100644 --- a/vars/build.vars +++ b/vars/build.vars @@ -1138,18 +1138,18 @@ NATIVE_PACKAGES_PREFIX="${PREFIX_NATIVE}"; NATIVE_PACKAGES_PYTHON="${PREFIX}/bin/python"; # -# Build target dist_minipix +# Build target minipix # -DIST_MINIPIX_CFLAGS_CONFIGURE="${DEFAULT_CFLAGS:+${DEFAULT_CFLAGS} }--sysroot=${PREFIX_NATIVE}"; -DIST_MINIPIX_CONFIGURE_ARGS="-C --disable-nls --host=${DEFAULT_TARGET} --prefix= --program-prefix= --target=${DEFAULT_TARGET}"; -DIST_MINIPIX_LDFLAGS_CONFIGURE="--sysroot=${PREFIX_NATIVE}"; -DIST_MINIPIX_MAKEFLAGS_INSTALL="PREFIX= prefix="; -DIST_MINIPIX_PACKAGES=" +MINIPIX_CFLAGS_CONFIGURE="${DEFAULT_CFLAGS:+${DEFAULT_CFLAGS} }--sysroot=${PREFIX_NATIVE}"; +MINIPIX_CONFIGURE_ARGS="-C --disable-nls --host=${DEFAULT_TARGET} --prefix= --program-prefix= --target=${DEFAULT_TARGET}"; +MINIPIX_LDFLAGS_CONFIGURE="--sysroot=${PREFIX_NATIVE}"; +MINIPIX_MAKEFLAGS_INSTALL="PREFIX= prefix="; +MINIPIX_PACKAGES=" bzip2_minipix gzip_minipix xz_minipix bash_minipix coreutils_minipix dash_minipix nano_minipix tar_minipix mintty_minipix ntctty_minipix ptycon_minipix"; -DIST_MINIPIX_PARALLELISE=1; -DIST_MINIPIX_PREFIX="${PREFIX}/minipix_dist"; +MINIPIX_PARALLELISE=1; +MINIPIX_PREFIX="${PREFIX}/minipix_dist"; : ${PKG_BZIP2_MINIPIX_INHERIT_FROM:=bzip2}; : ${PKG_BZIP2_MINIPIX_BASE_DIR:=${BUILD_WORKDIR}/bzip2-build-minipix}; : ${PKG_BZIP2_MINIPIX_BUILD_STEPS_DISABLE:="install_make"}; @@ -1201,10 +1201,16 @@ DIST_MINIPIX_PREFIX="${PREFIX}/minipix_dist"; : ${PKG_PTYCON_MINIPIX_LDFLAGS_CONFIGURE_EXTRA:="-mvrfs"}; # -# Build target dist_target +# Build target dist # -DIST_TARGET_NO_LOG_VARS=1; -DIST_TARGET_PACKAGES="dist_minipix_dist dist_etc dist_digest dist_gitref dist_tarballs"; +DIST_NO_LOG_VARS=1; +DIST_PACKAGES="dist_minipix_dist dist_etc"; + +# +# Build target invariants +# +INVARIANTS_NO_LOG_VARS=1; +INVARIANTS_PACKAGES="invariants_digest invariants_gitref invariants_tarballs"; # # Build targets @@ -1214,6 +1220,6 @@ host_tools host_toolchain_deps host_toolchain host_toolchain_mingw32 native_tools native_toolchain_deps native_toolchain native_toolchain_mingw32 native_runtime host_packages_deps native_packages_deps native_packages_deps_x11 native_packages -dist_minipix dist_target"; +minipix dist"; # vim:filetype=sh textwidth=0 diff --git a/vars/dist_digest.vars b/vars/dist_digest.vars deleted file mode 100644 index d831beb..0000000 --- a/vars/dist_digest.vars +++ /dev/null @@ -1,19 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_dist_digest_all() { - local __; - ex_rtl_log_msg info "Compiling SHA256 sums..."; - if [ -e "${PREFIX}/SHA256SUMS" ]; then - ex_rtl_fileop mv "${PREFIX}/SHA256SUMS" "${PREFIX}/SHA256SUMS.last"; - fi; - (cd "${PREFIX}"; - for __ in $(find "${PREFIX_NATIVE#${PREFIX}/}" -type f -perm /a=x \ - \( -path "${PREFIX_NATIVE#${PREFIX}/}/bin/*" -or \ - -path "${PREFIX_NATIVE#${PREFIX}/}/lib/*" \)); do - sha256sum "${__}"; - done > "${PREFIX}/SHA256SUMS"); -}; - -# vim:filetype=sh diff --git a/vars/dist_gitref.vars b/vars/dist_gitref.vars deleted file mode 100644 index 4ebab3d..0000000 --- a/vars/dist_gitref.vars +++ /dev/null @@ -1,9 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_dist_gitref_all() { - (ex_rtl_fileop cd "${MIDIPIX_BUILD_PWD}" && git rev-parse HEAD > "${PREFIX}/build.gitref"); -}; - -# vim:filetype=sh diff --git a/vars/dist_tarballs.vars b/vars/dist_tarballs.vars deleted file mode 100644 index a63bc0f..0000000 --- a/vars/dist_tarballs.vars +++ /dev/null @@ -1,91 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkgp_dist_tarball_dist() { - TARBALL_FNAME="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; - tar -cpf - $(find . -maxdepth 1 -mindepth 1 -type d \ - -not -path ./minipix \ - -not -path ./minipix_dist \ - -not -path ./tmp | sort) \ - midipix_shortcut.vbs midipix.sh README SHA256SUMS |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_FNAME}"; - ex_rtl_log_msg info "Finished building binary distribution tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_FNAME}"; - ex_rtl_log_msg info "Signed binary distribution tarball."; - fi; -}; - -pkgp_dist_tarball_toolchain() { - TARBALL_CROSS_FNAME="${DEFAULT_TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; - tar -cpf - bin include lib lib64 libexec share "${PKG_TARGET}" |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_CROSS_FNAME}"; - ex_rtl_log_msg info "Finished building toolchain tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}"; - ex_rtl_log_msg info "Signed toolchain tarball."; - fi; -}; - -pkgp_dist_tarball_minipix() { - TARBALL_MINIPIX_FNAME="${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; - tar -cpf - minipix \ - midipix_shortcut.vbs midipix.sh README |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_MINIPIX_FNAME}"; - ex_rtl_log_msg info "Finished building binary Minipix distribution tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}"; - ex_rtl_log_msg info "Signed binary Minipix distribution tarball."; - fi; -}; - -pkgp_dist_tarball_src() { - TARBALL_SRC_FNAME="${DEFAULT_TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; - ex_rtl_log_msg info "Building source tarball..."; - tar -cpf - $(find tmp -mindepth 2 -maxdepth 2 \ - -not -path tmp/.\* \ - -not -path tmp/ntctty\* \ - -not -path tmp/psxscl\* \ - -not -path tmp/ptycon\*) |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}"; - ex_rtl_log_msg info "Finished building source tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}"; - ex_rtl_log_msg info "Signed source tarball."; - fi; -}; - -pkg_dist_tarballs_all() { - ex_rtl_log_msg info "Building distribution tarballs..."; - case "${DEFAULT_TARBALL_SUFFIX}" in - bz2) if [ -n "$(which pbzip2 2>/dev/null)" ]; then - TARBALL_COMPRESS_CMD="pbzip2"; - else - TARBALL_COMPRESS_CMD="bzip2"; - fi; ;; - gz) if [ -n "$(which pigz 2>/dev/null)" ]; then - TARBALL_COMPRESS_CMD="pigz"; - else - TARBALL_COMPRESS_CMD="gzip"; - fi; ;; - xz) TARBALL_COMPRESS_CMD="xz"; - TARBALL_COMPRESS_ARGS="-T0"; ;; - *) ex_rtl_log_msg failexit "Unknown tarball suffix \`.${DEFAULT_TARBALL_SUFFIX}'."; - esac; - ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}"; - pkgp_dist_tarball_dist; pkgp_dist_tarball_toolchain; pkgp_dist_tarball_minipix; - if [ "${BUILD}" = "debug" ]; then - pkgp_dist_tarball_src; - fi; -}; - -# vim:filetype=sh diff --git a/vars/invariants_digest.vars b/vars/invariants_digest.vars new file mode 100644 index 0000000..9d29d59 --- /dev/null +++ b/vars/invariants_digest.vars @@ -0,0 +1,23 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_invariants_digest_all() { + local __; + if [ -z "${ARG_TARBALL}" ]; then + exit 0; + else + ex_rtl_log_msg info "Compiling SHA256 sums..."; + fi; + if [ -e "${PREFIX}/SHA256SUMS" ]; then + ex_rtl_fileop mv "${PREFIX}/SHA256SUMS" "${PREFIX}/SHA256SUMS.last"; + fi; + (cd "${PREFIX}"; + for __ in $(find "${PREFIX_NATIVE#${PREFIX}/}" -type f -perm /a=x \ + \( -path "${PREFIX_NATIVE#${PREFIX}/}/bin/*" -or \ + -path "${PREFIX_NATIVE#${PREFIX}/}/lib/*" \)); do + sha256sum "${__}"; + done > "${PREFIX}/SHA256SUMS"); +}; + +# vim:filetype=sh diff --git a/vars/invariants_gitref.vars b/vars/invariants_gitref.vars new file mode 100644 index 0000000..7af5c4a --- /dev/null +++ b/vars/invariants_gitref.vars @@ -0,0 +1,9 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_invariants_gitref_all() { + (ex_rtl_fileop cd "${MIDIPIX_BUILD_PWD}" && git rev-parse HEAD > "${PREFIX}/build.gitref"); +}; + +# vim:filetype=sh diff --git a/vars/invariants_tarballs.vars b/vars/invariants_tarballs.vars new file mode 100644 index 0000000..3516b79 --- /dev/null +++ b/vars/invariants_tarballs.vars @@ -0,0 +1,95 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkgp_dist_tarball_dist() { + TARBALL_FNAME="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; + tar -cpf - $(find . -maxdepth 1 -mindepth 1 -type d \ + -not -path ./minipix \ + -not -path ./minipix_dist \ + -not -path ./tmp | sort) \ + midipix_shortcut.vbs midipix.sh README SHA256SUMS |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_FNAME}"; + ex_rtl_log_msg info "Finished building binary distribution tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_FNAME}"; + ex_rtl_log_msg info "Signed binary distribution tarball."; + fi; +}; + +pkgp_dist_tarball_toolchain() { + TARBALL_CROSS_FNAME="${DEFAULT_TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; + tar -cpf - bin include lib lib64 libexec share "${PKG_TARGET}" |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_CROSS_FNAME}"; + ex_rtl_log_msg info "Finished building toolchain tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}"; + ex_rtl_log_msg info "Signed toolchain tarball."; + fi; +}; + +pkgp_dist_tarball_minipix() { + TARBALL_MINIPIX_FNAME="${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; + tar -cpf - minipix \ + midipix_shortcut.vbs midipix.sh README |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_MINIPIX_FNAME}"; + ex_rtl_log_msg info "Finished building binary Minipix distribution tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}"; + ex_rtl_log_msg info "Signed binary Minipix distribution tarball."; + fi; +}; + +pkgp_dist_tarball_src() { + TARBALL_SRC_FNAME="${DEFAULT_TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${DEFAULT_TARBALL_SUFFIX}"; + ex_rtl_log_msg info "Building source tarball..."; + tar -cpf - $(find tmp -mindepth 2 -maxdepth 2 \ + -not -path tmp/.\* \ + -not -path tmp/ntctty\* \ + -not -path tmp/psxscl\* \ + -not -path tmp/ptycon\*) |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}"; + ex_rtl_log_msg info "Finished building source tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${DEFAULT_TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${DEFAULT_TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${DEFAULT_TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}"; + ex_rtl_log_msg info "Signed source tarball."; + fi; +}; + +pkg_invariants_tarballs_all() { + if [ -z "${ARG_TARBALL}" ]; then + exit 0; + else + ex_rtl_log_msg info "Building distribution tarballs..."; + fi; + case "${DEFAULT_TARBALL_SUFFIX}" in + bz2) if [ -n "$(which pbzip2 2>/dev/null)" ]; then + TARBALL_COMPRESS_CMD="pbzip2"; + else + TARBALL_COMPRESS_CMD="bzip2"; + fi; ;; + gz) if [ -n "$(which pigz 2>/dev/null)" ]; then + TARBALL_COMPRESS_CMD="pigz"; + else + TARBALL_COMPRESS_CMD="gzip"; + fi; ;; + xz) TARBALL_COMPRESS_CMD="xz"; + TARBALL_COMPRESS_ARGS="-T0"; ;; + *) ex_rtl_log_msg failexit "Unknown tarball suffix \`.${DEFAULT_TARBALL_SUFFIX}'."; + esac; + ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}"; + pkgp_dist_tarball_dist; pkgp_dist_tarball_toolchain; pkgp_dist_tarball_minipix; + if [ "${BUILD}" = "debug" ]; then + pkgp_dist_tarball_src; + fi; +}; + +# vim:filetype=sh