From 94614637a44be04d7609309fd17b6a4b035dffdf Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Nov 21 2017 13:31:47 +0000 Subject: subr/pkg_setup_env.subr:pkg_setup_env(): correctly check for presence of package build subroutine. vars/dist_{etc,digest,tarballs}.vars: renamed from vars/*.subr & fixed. --- diff --git a/subr/pkg_setup_env.subr b/subr/pkg_setup_env.subr index c8058e8..6f2ef2c 100644 --- a/subr/pkg_setup_env.subr +++ b/subr/pkg_setup_env.subr @@ -6,7 +6,7 @@ pkg_setup_env() { if [ -z "${PKG_URL}" ]\ && [ -z "${PKG_URLS_GIT}" ]\ && [ -z "${PKG_VERSION}" ]\ - && ! test_cmd "${PKG_NAME}_all"; then + && ! test_cmd "pkg_${PKG_NAME}_all"; then log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars."; elif [ "${PKG_DISABLED:-0}" -eq 1 ]; then log_msg vnfo "Skipping disabled package \`${PKG_NAME}.'"; diff --git a/vars/dist_digest.subr b/vars/dist_digest.subr deleted file mode 100644 index 1b98fb6..0000000 --- a/vars/dist_digest.subr +++ /dev/null @@ -1,21 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -dist_digest_all() { - local __; - if [ "${ARG_TARBALL:-0}" -eq 1 ]; then - log_msg info "Compiling SHA256 sums..."; - if [ -e "${PREFIX}/SHA256SUMS" ]; then - build_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"); - fi; -}; - -# vim:filetype=sh diff --git a/vars/dist_digest.vars b/vars/dist_digest.vars new file mode 100644 index 0000000..10377e0 --- /dev/null +++ b/vars/dist_digest.vars @@ -0,0 +1,21 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_dist_digest_all() { + local __; + if [ "${ARG_TARBALL:-0}" -eq 1 ]; then + log_msg info "Compiling SHA256 sums..."; + if [ -e "${PREFIX}/SHA256SUMS" ]; then + build_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"); + fi; +}; + +# vim:filetype=sh diff --git a/vars/dist_etc.subr b/vars/dist_etc.subr deleted file mode 100644 index e7e0a92..0000000 --- a/vars/dist_etc.subr +++ /dev/null @@ -1,11 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -dist_etc_all() { - tar -C etc -cpf - midipix.sh README midipix_shortcut.vbs |\ - tar -C ${PREFIX} -xpf -; - chmod +x ${PREFIX}/midipix.sh; -}; - -# vim:filetype=sh diff --git a/vars/dist_etc.vars b/vars/dist_etc.vars new file mode 100644 index 0000000..6ed6f80 --- /dev/null +++ b/vars/dist_etc.vars @@ -0,0 +1,12 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_dist_etc_all() { + tar -C "${MIDIPIX_BUILD_PWD}/etc" -cpf - \ + midipix.sh README midipix_shortcut.vbs |\ + tar -C "${PREFIX}" -xpf -; + chmod +x "${PREFIX}/midipix.sh"; +}; + +# vim:filetype=sh diff --git a/vars/dist_tarballs.subr b/vars/dist_tarballs.subr deleted file mode 100644 index 7cf075a..0000000 --- a/vars/dist_tarballs.subr +++ /dev/null @@ -1,94 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -postp_tarball_dist() { - TARBALL_FNAME="${TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; - tar -cpf - $(find . -maxdepth 2 -mindepth 1 -type d \ - -not -path ./${PREFIX_BASENAME} \ - -not -path ./${PREFIX_BASENAME}.bak \ - -not -path ./${PREFIX_BASENAME}.bak/\* \ - -not -path ./tmp -not -path ./tmp/\*) \ - midipix_shortcut.vbs midipix.sh README SHA256SUMS |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_FNAME}"; - log_msg info "Finished building binary distribution tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_FNAME}"; - log_msg info "Signed binary distribution tarball."; - fi; -}; - -postp_tarball_toolchain() { - TARBALL_CROSS_FNAME="${TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; - tar -cpf - bin include lib lib64 libexec share "${TARGET}" |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_CROSS_FNAME}"; - log_msg info "Finished building toolchain tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}"; - log_msg info "Signed toolchain tarball."; - fi; -}; - -postp_tarball_minipix() { - TARBALL_MINIPIX_FNAME="${TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; - tar -cpf - minipix \ - midipix_shortcut.vbs midipix.sh README |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_MINIPIX_FNAME}"; - log_msg info "Finished building binary Minipix distribution tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}"; - log_msg info "Signed binary Minipix distribution tarball."; - fi; -}; - -postp_tarball_src() { - TARBALL_SRC_FNAME="${TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; - log_msg info "Building source tarball..."; - tar -cpf - $(find tmp -mindepth 2 -maxdepth 2 \ - -not -path tmp/.\* \ - -not -path tmp/ntctty/.git \ - -not -path tmp/psxscl/.git \ - -not -path tmp/ptycon/.git) |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}"; - log_msg info "Finished building source tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ - gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}"; - log_msg info "Signed source tarball."; - fi; -}; - -dist_tarballs_all() { - if [ "${ARG_TARBALL:-0}" -eq 1 ]; then - log_msg info "Building distribution tarballs..."; - case "${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"; ;; - *) log_msg failexit "Unknown tarball suffix \`.${TARBALL_SUFFIX}'."; - esac; - build_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}"; - postp_tarball_dist; postp_tarball_toolchain; postp_tarball_minipix; - if [ "${BUILD}" = "debug" ]; then - postp_tarball_src; - fi; - fi; -}; - -# vim:filetype=sh diff --git a/vars/dist_tarballs.vars b/vars/dist_tarballs.vars new file mode 100644 index 0000000..5c91865 --- /dev/null +++ b/vars/dist_tarballs.vars @@ -0,0 +1,94 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkgp_dist_tarball_dist() { + TARBALL_FNAME="${TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; + tar -cpf - $(find . -maxdepth 2 -mindepth 1 -type d \ + -not -path ./${PREFIX_BASENAME} \ + -not -path ./${PREFIX_BASENAME}.bak \ + -not -path ./${PREFIX_BASENAME}.bak/\* \ + -not -path ./tmp -not -path ./tmp/\*) \ + midipix_shortcut.vbs midipix.sh README SHA256SUMS |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_FNAME}"; + log_msg info "Finished building binary distribution tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_FNAME}"; + log_msg info "Signed binary distribution tarball."; + fi; +}; + +pkgp_dist_tarball_toolchain() { + TARBALL_CROSS_FNAME="${TARBALL_CROSS_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; + tar -cpf - bin include lib lib64 libexec share "${TARGET}" |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_CROSS_FNAME}"; + log_msg info "Finished building toolchain tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}"; + log_msg info "Signed toolchain tarball."; + fi; +}; + +pkgp_dist_tarball_minipix() { + TARBALL_MINIPIX_FNAME="${TARBALL_MINIPIX_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; + tar -cpf - minipix \ + midipix_shortcut.vbs midipix.sh README |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_MINIPIX_FNAME}"; + log_msg info "Finished building binary Minipix distribution tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}"; + log_msg info "Signed binary Minipix distribution tarball."; + fi; +}; + +pkgp_dist_tarball_src() { + TARBALL_SRC_FNAME="${TARBALL_SRC_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${TARBALL_SUFFIX}"; + log_msg info "Building source tarball..."; + tar -cpf - $(find tmp -mindepth 2 -maxdepth 2 \ + -not -path tmp/.\* \ + -not -path tmp/ntctty/.git \ + -not -path tmp/psxscl/.git \ + -not -path tmp/ptycon/.git) |\ + "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}"; + log_msg info "Finished building source tarball."; + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}"; + log_msg info "Signed source tarball."; + fi; +}; + +pkg_dist_tarballs_all() { + if [ "${ARG_TARBALL:-0}" -eq 1 ]; then + log_msg info "Building distribution tarballs..."; + case "${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"; ;; + *) log_msg failexit "Unknown tarball suffix \`.${TARBALL_SUFFIX}'."; + esac; + build_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; + fi; +}; + +# vim:filetype=sh