From 1548659e9cc2eeffbbd300791f228ae61524c280 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Feb 01 2017 02:09:53 +0000 Subject: build.sh, subr/*: reorganised as subr/{check,mode,pkg,post}_*.subr. --- diff --git a/build.sh b/build.sh index 0f3411c..e9b96b8 100755 --- a/build.sh +++ b/build.sh @@ -76,12 +76,12 @@ for BUILD_TARGET_LC in $(subst_tgts ${BUILD_TARGETS_META}); do if [ ${ARG_CHECK_UPDATES:-0} -eq 1 ]\ && [ "${BUILD_PACKAGE#*.*}" = "${BUILD_PACKAGE}" ]; then if [ ${ARG_DRYRUN:-0} -eq 1 ]; then - echo check_pkg_updates "${BUILD_PACKAGE_LC}" \ + echo mode_check_pkg_updates "${BUILD_PACKAGE_LC}" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_VERSION)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL_TYPE)"; else - check_pkg_updates "${BUILD_PACKAGE_LC}" \ + mode_check_pkg_updates "${BUILD_PACKAGE_LC}" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_VERSION)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL)" \ "$(get_var_unsafe PKG_${BUILD_PACKAGE}_URL_TYPE)"; @@ -147,7 +147,10 @@ for BUILD_TARGET_LC in $(subst_tgts ${BUILD_TARGETS_META}); do break; fi; done; -copy_etc; do_strip; do_tarballs; fini_build_vars; +for __ in copy_etc strip tarballs; do + post_${__}; +done; +fini_build_vars; log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s)."; log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s)."; fini_build_progress_file; diff --git a/subr/build.subr b/subr/build.subr index afcad3a..41cb4d8 100644 --- a/subr/build.subr +++ b/subr/build.subr @@ -63,12 +63,6 @@ clean_prefix() { fi; }; -copy_etc() { - tar -C etc -cpf - midipix.sh README midipix_shortcut.vbs |\ - tar -C ${PREFIX} -xpf -; - chmod +x ${PREFIX}/midipix.sh; -}; - create_dirs() { insecure_mkdir ${PREFIX} ${PREFIX}/x86_64-w64-mingw32 ${PREFIX_NATIVE} ${PREFIX_CROSS} ${PREFIX_TARGET}/lib ${DLCACHEDIR} ${WORKDIR}; for __ in ${PREFIX}/usr ${PREFIX_NATIVE}/usr; do diff --git a/subr/check_updates.subr b/subr/check_updates.subr deleted file mode 100644 index e925f89..0000000 --- a/subr/check_updates.subr +++ /dev/null @@ -1,100 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. -# - -cpu_get_fnames() { - if test_cmd pkg_${cu_name}_check_updates; then - pkg_${cu_name}_check_updates get_fnames; - fi; - if [ -z "${cu_fnames}" ]; then - if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then - _cpugf_uname="${cu_url#*/github.com/}"; - _cpugf_uname="${_cpugf_uname%%/*}"; - _cpugf_pname="${cu_url#*/github.com/${_cpugf_uname}/}"; - _cpugf_pname="${_cpugf_pname%%/*}"; - cu_url_index="https://github.com/${_cpugf_uname%%/*}/${_cpugf_pname%%/*}/releases/"; - unset _cpu_uname _cpu_pname; - cu_fnames="$(wget ${WGET_ARGS} -qO- ${cu_url_index} |\ - sed -n '//s/^.*\([a-zA-Z]\+-\|v\|\)\(.\+\)<\/span>.*$/\3/p')"; - cu_fname_base="${cu_name}"; - cu_fname_ext="${cu_fname#v${cu_version}.}"; - else - cu_url_index="${cu_url%/*}/"; - cu_fnames="$(wget ${WGET_ARGS} -qO- "${cu_url_index}" |\ - sed -n '/[hH][rR][eE][fF]="[^"]\+"/s/^.*[hH][rR][eE][fF]="\([^"]\+\)".*$/\1/p')"; - fi; - fi; - : ${cu_fname:="${cu_url##*/}"}; - : ${cu_fname_base:="${cu_fname%%-*}"}; - : ${cu_fname_ext:="${cu_fname#${cu_fname_base}-${cu_version}.}"}; -}; - -cpu_get_version() { - unset cu_fname_version; - if test_cmd pkg_${cu_name}_check_updates; then - pkg_${cu_name}_check_updates get_version; - fi; - if [ -z "${cu_fname_version}" ]; then - if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then - if [ "${cu_fname#${cu_fname_base}-}" = "${cu_fname}" ]\ - && [ "${cu_fname%.${cu_fname_ext}}" = "${cu_fname}" ]; then - cu_fname_version="${cu_fname}"; - fi; - elif [ "${cu_fname#${cu_fname_base}-}" != "${cu_fname}" ]\ - && [ "${cu_fname%.${cu_fname_ext}}" != "${cu_fname}" ]; then - cu_fname_version="${cu_fname#${cu_fname_base}-}"; - cu_fname_version="${cu_fname_version%.${cu_fname_ext}}"; - fi; - fi; -}; - -check_pkg_updates() { - cu_name="${1}"; cu_version="${2}"; cu_url="${3}"; cu_url_type="${4}"; - . vars/check_updates.vars; - if match_list "${CHECK_UPDATES_SKIP}" " " "${cu_name}"; then - log_msg vnfo "Skipping \`${cu_name}' (set in \${CHECK_UPDATES_SKIP}.)"; - return 0; - elif [ "${cu_url_type}" = "git" ]; then - log_msg vnfo "Skipping \`${cu_name}' (URL_TYPE is Git.)"; - return 0; - elif [ -z "${cu_version}" -o -z "${cu_url}" ]; then - log_msg fail "Zero-length \${cu_version} and/or \${cu_url} for \`${cu_name}' (ignored.)"; - return 0; - else - log_msg vnfo "Checking ${cu_name} v${cu_version} for updates."; - cpu_get_fnames; _cpu_versions=""; - fi; - for cu_fname in ${cu_fnames}; do - cu_fname="${cu_fname##*/}"; cpu_get_version; - if [ -z "${cu_fname_version}" ]; then - continue; - elif ! echo "${cu_fname_version}" | grep -Eq '^[-_.0-9a-zA-Z]+$' \ - || echo "${cu_fname_version}" | grep -Eq '^[_.a-zA-Z]+'; then - log_msg varn "Skipping \`${cu_fname_version}' (invalid version.)"; - else - _cpu_versions="${_cpu_versions:+${_cpu_versions} }${cu_fname_version}"; - fi; - done; - if [ -z "${_cpu_versions}" ]; then - log_msg warn "No versions available for \`${cu_name}' (Filename URL: ${cu_url}, index URL: ${cu_url_index})."; - else - _cpu_versions="$(echo "${_cpu_versions}" |\ - sed 's/ /\n/g' | sort -rV | uniq |\ - head -n${CHECK_UPDATES_SHOW_NEW:-6} |\ - paste -d" " -s)"; - if test_cmd pkg_${cu_name}_check_updates; then - pkg_${cu_name}_check_updates version_fixup; - fi; - if [ "${_cpu_versions%% *}" != "${cu_version}" ]; then - log_msg info "New release(s) available for ${cu_name} v${cu_version}: ${_cpu_versions}."; - else - log_msg vnfo "${cu_name} v${cu_version} is up to date."; - fi; - fi; - unset cu_fname cu_fname_base cu_fname_ext cu_fnames cu_fname_version \ - cu_name cu_url cu_url_fname cu_url_fname_base cu_url_fname_ext \ - cu_url_index cu_url_type cu_version _cpu_versions; -}; - -# vim:filetype=sh diff --git a/subr/mode_check_updates.subr b/subr/mode_check_updates.subr new file mode 100644 index 0000000..cc07b67 --- /dev/null +++ b/subr/mode_check_updates.subr @@ -0,0 +1,100 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +modep_cpu_get_fnames() { + if test_cmd pkg_${cu_name}_check_updates; then + pkg_${cu_name}_check_updates get_fnames; + fi; + if [ -z "${cu_fnames}" ]; then + if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then + _cpugf_uname="${cu_url#*/github.com/}"; + _cpugf_uname="${_cpugf_uname%%/*}"; + _cpugf_pname="${cu_url#*/github.com/${_cpugf_uname}/}"; + _cpugf_pname="${_cpugf_pname%%/*}"; + cu_url_index="https://github.com/${_cpugf_uname%%/*}/${_cpugf_pname%%/*}/releases/"; + unset _cpu_uname _cpu_pname; + cu_fnames="$(wget ${WGET_ARGS} -qO- ${cu_url_index} |\ + sed -n '//s/^.*\([a-zA-Z]\+-\|v\|\)\(.\+\)<\/span>.*$/\3/p')"; + cu_fname_base="${cu_name}"; + cu_fname_ext="${cu_fname#v${cu_version}.}"; + else + cu_url_index="${cu_url%/*}/"; + cu_fnames="$(wget ${WGET_ARGS} -qO- "${cu_url_index}" |\ + sed -n '/[hH][rR][eE][fF]="[^"]\+"/s/^.*[hH][rR][eE][fF]="\([^"]\+\)".*$/\1/p')"; + fi; + fi; + : ${cu_fname:="${cu_url##*/}"}; + : ${cu_fname_base:="${cu_fname%%-*}"}; + : ${cu_fname_ext:="${cu_fname#${cu_fname_base}-${cu_version}.}"}; +}; + +modep_check_cpu_get_version() { + unset cu_fname_version; + if test_cmd pkg_${cu_name}_check_updates; then + pkg_${cu_name}_check_updates get_version; + fi; + if [ -z "${cu_fname_version}" ]; then + if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then + if [ "${cu_fname#${cu_fname_base}-}" = "${cu_fname}" ]\ + && [ "${cu_fname%.${cu_fname_ext}}" = "${cu_fname}" ]; then + cu_fname_version="${cu_fname}"; + fi; + elif [ "${cu_fname#${cu_fname_base}-}" != "${cu_fname}" ]\ + && [ "${cu_fname%.${cu_fname_ext}}" != "${cu_fname}" ]; then + cu_fname_version="${cu_fname#${cu_fname_base}-}"; + cu_fname_version="${cu_fname_version%.${cu_fname_ext}}"; + fi; + fi; +}; + +mode_check_pkg_updates() { + cu_name="${1}"; cu_version="${2}"; cu_url="${3}"; cu_url_type="${4}"; + . vars/check_updates.vars; + if match_list "${CHECK_UPDATES_SKIP}" " " "${cu_name}"; then + log_msg vnfo "Skipping \`${cu_name}' (set in \${CHECK_UPDATES_SKIP}.)"; + return 0; + elif [ "${cu_url_type}" = "git" ]; then + log_msg vnfo "Skipping \`${cu_name}' (URL_TYPE is Git.)"; + return 0; + elif [ -z "${cu_version}" -o -z "${cu_url}" ]; then + log_msg fail "Zero-length \${cu_version} and/or \${cu_url} for \`${cu_name}' (ignored.)"; + return 0; + else + log_msg vnfo "Checking ${cu_name} v${cu_version} for updates."; + modep_cpu_get_fnames; _cpu_versions=""; + fi; + for cu_fname in ${cu_fnames}; do + cu_fname="${cu_fname##*/}"; modep_check_cpu_get_version; + if [ -z "${cu_fname_version}" ]; then + continue; + elif ! echo "${cu_fname_version}" | grep -Eq '^[-_.0-9a-zA-Z]+$' \ + || echo "${cu_fname_version}" | grep -Eq '^[_.a-zA-Z]+'; then + log_msg varn "Skipping \`${cu_fname_version}' (invalid version.)"; + else + _cpu_versions="${_cpu_versions:+${_cpu_versions} }${cu_fname_version}"; + fi; + done; + if [ -z "${_cpu_versions}" ]; then + log_msg warn "No versions available for \`${cu_name}' (Filename URL: ${cu_url}, index URL: ${cu_url_index})."; + else + _cpu_versions="$(echo "${_cpu_versions}" |\ + sed 's/ /\n/g' | sort -rV | uniq |\ + head -n${CHECK_UPDATES_SHOW_NEW:-6} |\ + paste -d" " -s)"; + if test_cmd pkg_${cu_name}_check_updates; then + pkg_${cu_name}_check_updates version_fixup; + fi; + if [ "${_cpu_versions%% *}" != "${cu_version}" ]; then + log_msg info "New release(s) available for ${cu_name} v${cu_version}: ${_cpu_versions}."; + else + log_msg vnfo "${cu_name} v${cu_version} is up to date."; + fi; + fi; + unset cu_fname cu_fname_base cu_fname_ext cu_fnames cu_fname_version \ + cu_name cu_url cu_url_fname cu_url_fname_base cu_url_fname_ext \ + cu_url_index cu_url_type cu_version _cpu_versions; +}; + +# vim:filetype=sh diff --git a/subr/post_copy_etc.subr b/subr/post_copy_etc.subr new file mode 100644 index 0000000..fe48521 --- /dev/null +++ b/subr/post_copy_etc.subr @@ -0,0 +1,11 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# + +post_copy_etc() { + 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/subr/post_strip.subr b/subr/post_strip.subr new file mode 100644 index 0000000..68b8e2e --- /dev/null +++ b/subr/post_strip.subr @@ -0,0 +1,17 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# + +post_strip() { + if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]\ + && [ "${BUILD}" = release ]; then + for __ in $(find ${PREFIX_NATIVE}/bin -perm -0100 \( -type f -or -type l \)); do + if objdump -sj .debug_info >/dev/null 2>&1; then + log_msg vnfo "${PKG_TARGET}-strip ${__}"; + set +o errexit; ${PKG_TARGET}-strip ${__}; set -o errexit; + fi; + done; + fi; +}; + +# vim:filetype=sh diff --git a/subr/post_tarballs.subr b/subr/post_tarballs.subr new file mode 100644 index 0000000..12e3940 --- /dev/null +++ b/subr/post_tarballs.subr @@ -0,0 +1,95 @@ +# +# . ./build.vars and 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 |\ + ${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 ${PKG_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_CROSS_SIGN_GPG_KEY}" ] &&\ + gpg --list-keys "${TARBALL_CROSS_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_CROSS_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_MINIPIX_SIGN_GPG_KEY}" ] &&\ + gpg --list-keys "${TARBALL_MINIPIX_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_MINIPIX_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_SRC_SIGN_GPG_KEY}" ] &&\ + gpg --list-keys "${TARBALL_SRC_SIGN_GPG_KEY}" >/dev/null 2>&1; then + gpg --armor --passphrase-file /dev/null \ + --local-user "${TARBALL_SRC_SIGN_GPG_KEY}" --sign ${TARBALL_SRC_FNAME}; + log_msg info "Signed source tarball."; + fi; +}; + +post_tarballs() { + if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]\ + && [ ${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; + cd ${PREFIX}; PREFIX_BASENAME=${PREFIX_NATIVE##*/}; + post_tarball_dist; post_tarball_toolchain; post_tarball_minipix; + if [ "${BUILD}" = "debug" ]; then + post_tarball_src; + fi; + fi; +}; + +# vim:filetype=sh diff --git a/subr/strip.subr b/subr/strip.subr deleted file mode 100644 index 6406022..0000000 --- a/subr/strip.subr +++ /dev/null @@ -1,17 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# - -do_strip() { - if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]\ - && [ "${BUILD}" = release ]; then - for __ in $(find ${PREFIX_NATIVE}/bin -perm -0100 \( -type f -or -type l \)); do - if objdump -sj .debug_info >/dev/null 2>&1; then - log_msg vnfo "${PKG_TARGET}-strip ${__}"; - set +o errexit; ${PKG_TARGET}-strip ${__}; set -o errexit; - fi; - done; - fi; -}; - -# vim:filetype=sh diff --git a/subr/tarballs.subr b/subr/tarballs.subr deleted file mode 100644 index f0e6e52..0000000 --- a/subr/tarballs.subr +++ /dev/null @@ -1,95 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# - -do_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 |\ - ${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; -}; - -do_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 ${PKG_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_CROSS_SIGN_GPG_KEY}" ] &&\ - gpg --list-keys "${TARBALL_CROSS_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_CROSS_SIGN_GPG_KEY}" --sign ${TARBALL_CROSS_FNAME}; - log_msg info "Signed toolchain tarball."; - fi; -}; - -do_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_MINIPIX_SIGN_GPG_KEY}" ] &&\ - gpg --list-keys "${TARBALL_MINIPIX_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_MINIPIX_SIGN_GPG_KEY}" --sign ${TARBALL_MINIPIX_FNAME}; - log_msg info "Signed binary Minipix distribution tarball."; - fi; -}; - -do_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_SRC_SIGN_GPG_KEY}" ] &&\ - gpg --list-keys "${TARBALL_SRC_SIGN_GPG_KEY}" >/dev/null 2>&1; then - gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_SRC_SIGN_GPG_KEY}" --sign ${TARBALL_SRC_FNAME}; - log_msg info "Signed source tarball."; - fi; -}; - -do_tarballs() { - if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]\ - && [ ${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; - cd ${PREFIX}; PREFIX_BASENAME=${PREFIX_NATIVE##*/}; - do_tarball_dist; do_tarball_toolchain; do_tarball_minipix; - if [ "${BUILD}" = "debug" ]; then - do_tarball_src; - fi; - fi; -}; - -# vim:filetype=sh