diff options
-rwxr-xr-x | build.sh | 18 | ||||
-rw-r--r-- | etc/build.usage | 30 | ||||
-rw-r--r-- | subr/build_args.subr | 45 | ||||
-rw-r--r-- | subr/build_init.subr | 2 | ||||
-rw-r--r-- | subr/pkg_clean.subr | 17 | ||||
-rw-r--r-- | subr/pkg_install.subr | 2 | ||||
-rw-r--r-- | subr/pkg_install_rpm.subr | 43 | ||||
-rw-r--r-- | vars/build.vars | 10 | ||||
-rw-r--r-- | vars/dist_minipix_dist.vars | 39 | ||||
-rw-r--r-- | vars/invariants_digest.vars | 27 | ||||
-rw-r--r-- | vars/invariants_minipix.vars | 67 | ||||
-rw-r--r-- | vars/invariants_tarballs.vars | 107 | ||||
-rw-r--r-- | vars/invariants_zipdist.vars | 4 | ||||
-rw-r--r-- | vars/midipix.vars | 2 |
14 files changed, 192 insertions, 221 deletions
@@ -4,21 +4,21 @@ buildp_dispatch() { local _msg="${1}" _pkg_name="${2}" _tgt_name="${3}" \ - _build_tgt_meta="" _build_tgt_lc="" _build_tgt_pkg_names="" _build_tgt_uc=""; + _build_tgt_meta="" _build_tgt_lc="" _build_tgt_pkg_names="" _build_tgt_uc="" _build_tgts_lc=""; case "${_msg}" in # Top-level start_build) shift; build_args "${@}"; build_init; build_checks; ex_rtl_log_set_vnfo_lvl "${ARG_VERBOSE:-0}"; ex_rtl_log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}."; ex_rtl_log_env_vars "build (global)" ${DEFAULT_LOG_ENV_VARS}; + _build_tgts_lc="${BUILD_TARGETS:-${TARGETS_DEFAULT}}"; + if ! ex_rtl_lmatch "${ARG_DIST}" , rpm; then + _build_tgts_lc="$(ex_rtl_lfilter_not "${_build_tgts_lc}" "host_tools_rpm")"; + fi; if [ -n "${ARG_RESTART}" ]\ && [ "${ARG_RESTART}" != ALL ]; then _build_tgt_pkg_names=""; - for _build_tgt_lc in ${BUILD_TARGETS:-${TARGETS_DEFAULT}}; do - if [ "${_build_tgt_lc}" = "host_tools_rpm" ] \ - && [ "${ARG_RPM:-0}" -eq 0 ]; then - continue; - fi; + for _build_tgt_lc in ${_build_tgts_lc}; do _build_tgt_uc="$(ex_rtl_toupper "${_build_tgt_lc}")"; _build_tgt_pkg_names="${_build_tgt_pkg_names:+${_build_tgt_pkg_names} }$(ex_rtl_get_var_unsafe ${_build_tgt_uc}_PACKAGES)"; done; @@ -27,11 +27,7 @@ buildp_dispatch() { ex_rtl_log_msg failexit "Error: package(s) \`${_build_tgt_pkg_names}' unknown."; fi; fi; - for _build_tgt_lc in ${BUILD_TARGETS:-${TARGETS_DEFAULT}}; do - if [ "${_build_tgt_lc}" = "host_tools_rpm" ] \ - && [ "${ARG_RPM:-0}" -eq 0 ]; then - continue; - fi; + for _build_tgt_lc in ${_build_tgts_lc}; do ex_pkg_dispatch "${_build_tgt_lc}" \ "${ARG_RESTART}" "${ARG_RESTART_AT}" \ buildp_dispatch; diff --git a/etc/build.usage b/etc/build.usage index 88c819c5..ceefcb3c 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -1,18 +1,19 @@ -usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] - [-c] [-C dir[,..]] [-h] [-N] [-P [jobs]] - [-r ALL[:step,..]] [-r name[,..][:step,..]] - [-R] [-t[.gz|.bz2|.xz] [-v[v[v]]] [-x] [-z] - [--as-needed] [--debug-minipix] [--rpm] [<target>[ ..]] +usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] [-c] [-C dir[,..]] + [-D kind[,..]] [-h] [-N] [-P [jobs]] [-r ALL[:step,..]] + [-r name[,..][:step,..]] [-R] [-v[v[v]]] [-x] + [--as-needed] [--debug-minipix] [<target>[ ..]] -4|-6 Force IPv[46] when downloading files. -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. -b debug|release Selects debug or release build; defaults to debug. -c Clean ${PREFIX} before processing build scripts. -C dir[,..] Clean build directory (build,) source directory (src,) and/or - destination directory (dest) after successful package builds; - excludes -t, but may be passed alongside -p. + destination directory (dest) after successful package builds. + -D kind[,..] Produce minimal midipix distribution directory (minipix,) package + tarballs (pkg,) RPM binary packages (rpm,) compressed and optionally + signed binary and source tarballs containing ${PREFIX} sans ${BUILD_WORKDIR} + (t{bz2,gz,xz},) and/or deployable distribution ZIP archive (zipdist.) -h Show this screen. -N Offline mode: no {wget,git-{clone,pull}}(1) calls. - -p Create package tarballs; excludes -t. -P [jobs] Enables parallelisation at target-level, whenever applicable. The maximum count of jobs defaults to the number of logical processors on the host system. @@ -29,23 +30,15 @@ usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] install_strip, install, and install_rpm. -R Ignore build failures, skip printing package logs, and continue building (relaxed mode.) - -t[.gz|.bz2|.xz] Produce binary distribution and source tarballs containing - ${PREFIX} sans ${BUILD_WORKDIR} and ${PREFIX}/src/midipix_build - and ${BUILD_WORKDIR} sans top-level regular files at the end of - a build with zero failures. The tarballs will be compressed - with either gzip, bzip2, or xz and signed with GPG; the - default compression is xz. -v[v[v]] Be verbose; -vv: always print package logs; -vvv: logs fileops. -x Set xtrace during package builds; implies -vv. - -z Produce deployable distribution ZIP archive. --as-needed Don't build unless the midipix_build repository has received new commits. --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix. - --rpm Build RPM packages for each package built; selects host_tools_rpm. <target>[ ..] One of: host or host_tools, host_tools_deps, host_tools_rpm, 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. + packages or native_packages. ${HOME}/midipix_build.vars, ${HOME}/.midipix_build.vars, and/or ../midipix_build.vars will be sourced if present. @@ -56,8 +49,5 @@ usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] ./build.sh -r coreutils:configure,build,install Restart the configure, build, and install steps of the coreutils build. - ./build.sh -r psxscl DEFAULT_GITROOT_HEAD=... PKG_PSXSCL_CFLAGS_CONFIGURE_EXTRA=-DPSX_EXTENDED_STRACE - Build psxscl from the internal repository with strace enabled. - ./build.sh -c -r ALL DEFAULT_GITROOT_HEAD=... Clean ${PREFIX} and forcibly rebuild everything. diff --git a/subr/build_args.subr b/subr/build_args.subr index 750aa535..5cdc63b9 100644 --- a/subr/build_args.subr +++ b/subr/build_args.subr @@ -3,29 +3,23 @@ # BUILD_ARGS_SPEC=" + ARCH:arg:-a: ARG_IPV4_ONLY:-4: ARG_IPV6_ONLY:-6: - ARCH:arg:-a: - BUILD:arg:-b: + ARG_AS_NEEDED:--as-needed: ARG_CLEAN:-c: ARG_CLEAN_BUILDS:arg:-C: - ARG_AS_NEEDED:--as-needed: ARG_DEBUG_MINIPIX:--debug-minipix: - ARG_RPM:--rpm: + ARG_DIST:arg:-D: ARG_OFFLINE:-N: - ARG_PACKAGE:-p: ARG_PARALLEL:optarg:-P:auto ARG_RELAXED:-R: ARG_RESTART:arg:-r: - ARG_TARBALL:selfarg:-t: - ARG_TARBALL:selfarg:-t.bz2; - ARG_TARBALL:selfarg:-t.gz: - ARG_TARBALL:selfarg:-t.xz: ARG_VERBOSE:selfarg:-v: ARG_VERBOSE:selfarg:-vv: ARG_VERBOSE:selfarg:-vvv: ARG_XTRACE:-x: - ARG_ZIPDIST:arg:-z:"; + BUILD:arg:-b:"; build_args() { local _spec="${BUILD_ARGS_SPEC}" _spec_arg="" _found=""; @@ -62,28 +56,6 @@ build_args() { shift; fi; done; - if [ -n "${ARG_CLEAN_BUILDS}" ]; then - ARG_CLEAN_BUILDS="$(echo "${ARG_CLEAN_BUILDS}" | sed "s/,/ /g")"; - fi; - if [ -n "${ARG_CLEAN_BUILDS}" ]\ - || [ "${ARG_PACKAGE:-0}" -eq 1 ]\ - && [ -n "${ARG_TARBALL}" ]; then - unset ARG_TARBALL; - elif [ -n "${ARG_TARBALL}" ]; then - if [ "${ARG_TARBALL#-t.}" != "${ARG_TARBALL}" ]; then - TARBALL_SUFFIX="${ARG_TARBALL#-t.}"; - else - TARBALL_SUFFIX=xz; - fi; - fi; - case "${ARG_VERBOSE}" in - -v) ARG_VERBOSE=1; ;; - -vv) ARG_VERBOSE=2; ;; - -vvv) ARG_VERBOSE=3; ;; - esac; - if [ "${ARG_XTRACE:-0}" -eq 1 ]; then - ARG_VERBOSE=2; - fi; if [ -n "${ARG_RESTART}" ]; then if [ "${ARG_RESTART%:*}" != "${ARG_RESTART}" ]; then ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}"; @@ -92,6 +64,15 @@ build_args() { fi; ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")"; fi; + if [ "${ARG_XTRACE:-0}" -eq 1 ]; then + ARG_VERBOSE=2; + else + case "${ARG_VERBOSE}" in + -v) ARG_VERBOSE=1; ;; + -vv) ARG_VERBOSE=2; ;; + -vvv) ARG_VERBOSE=3; ;; + esac; + fi; while [ ${#} -gt 0 ]; do case "${1}" in *=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;; diff --git a/subr/build_init.subr b/subr/build_init.subr index 7e52a280..34fa6b68 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -56,7 +56,7 @@ build_init() { ex_rtl_unset_vars $(ex_rtl_lfilter_not "${_env_vars}" "${_env_vars_except}"); export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${PREFIX}/lib"; ex_rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}"; - if [ "${ARG_RPM:-0}" -eq 1 ]; then + if ex_rtl_lmatch "${ARG_DIST}" , rpm; then ex_rtl_fileop mkdir "${PREFIX_RPM}"; fi; if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr index 8128dfd4..dfc83b76 100644 --- a/subr/pkg_clean.subr +++ b/subr/pkg_clean.subr @@ -7,14 +7,15 @@ pkg_clean() { if [ -n "${PKG_DEPS_BASE}" ]; then return 0; fi; - for _dir in ${ARG_CLEAN_BUILDS}; do - case "${_dir}" in - build) ex_rtl_fileop rm "${PKG_BUILD_DIR}"; ;; - src) ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; ;; - dest) ex_rtl_fileop rm "${PKG_DESTDIR}"; ;; - *) return 1; ;; - esac; - done; + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , build; then + ex_rtl_fileop rm "${PKG_BUILD_DIR}"; + fi; + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , dest; then + ex_rtl_fileop rm "${PKG_DESTDIR}"; + fi; + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , src; then + ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; + fi; }; # vim:filetype=sh diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index 14cd8a0b..b4f68754 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -14,7 +14,7 @@ pkg_install() { -perm /0111 -type f -exec chmod 0755 {} \;; tar -C "${PKG_DESTDIR}" -cpf - . |\ tar -C "${PKG_PREFIX}" --overwrite -xpf -; - if [ "${ARG_PACKAGE:-0}" -eq 1 ]; then + if ex_rtl_lmatch "${ARG_DIST}" , pkg; then tar -C "${PKG_DESTDIR}" -cpf - . |\ gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz" fi; diff --git a/subr/pkg_install_rpm.subr b/subr/pkg_install_rpm.subr index cd920eb6..691fe04c 100644 --- a/subr/pkg_install_rpm.subr +++ b/subr/pkg_install_rpm.subr @@ -4,25 +4,23 @@ pkg_install_rpm() { local _pkg_url="" _pkg_version_full="" _pkg_version_rpm=""; - if [ "${ARG_RPM:-0}" -eq 0 ]\ - || [ "${PKG_RPM_DISABLE:-0}" -eq 1 ]\ - || ! [ -x "$(which rpmbuild 2>/dev/null)" ]; then - return 0; - fi; - if [ -n "${PKG_URL}" ]; then - _pkg_version_rpm="${PKG_VERSION%%-*}"; - _pkg_version_full="${PKG_VERSION}"; - _pkg_url="${PKG_URL}"; - elif [ -n "${PKG_URLS_GIT}" ]; then - _pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)"; - _pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))"; - _pkg_url="${PKG_URLS_GIT%% *}"; - _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}"; - if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then - _pkg_url="Unknown"; + if ex_rtl_lmatch "${ARG_DIST}" , rpm \ + && [ "${PKG_RPM_DISABLE:-0}" -eq 0 ] \ + && [ -x "$(which rpmbuild 2>/dev/null)" ]; then + if [ -n "${PKG_URL}" ]; then + _pkg_version_rpm="${PKG_VERSION%%-*}"; + _pkg_version_full="${PKG_VERSION}"; + _pkg_url="${PKG_URL}"; + elif [ -n "${PKG_URLS_GIT}" ]; then + _pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)"; + _pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))"; + _pkg_url="${PKG_URLS_GIT%% *}"; + _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}"; + if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then + _pkg_url="Unknown"; + fi; fi; - fi; - cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <<EOF + cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <<EOF Name: ${PKG_NAME} Version: ${_pkg_version_rpm} Release: 1 @@ -49,10 +47,11 @@ cp -pPr "${PKG_DESTDIR}/." "\${RPM_BUILD_ROOT}" %changelog EOF - rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec"; - find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;; - ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}"; - ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/"; + rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec"; + find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;; + ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}"; + ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/"; + fi; }; # vim:filetype=sh diff --git a/vars/build.vars b/vars/build.vars index 6b0dcb8e..8f7ee306 100644 --- a/vars/build.vars +++ b/vars/build.vars @@ -1630,16 +1630,10 @@ MINIPIX_RPM_DISABLE=1; : ${PKG_PTYCON_MINIPIX_ENV_VARS_EXTRA:="CFLAGS_PATH=-I${PREFIX_NATIVE}/include:LDFLAGS_PATH=-L${PREFIX_NATIVE}/lib"}; # -# Build target dist -# -DIST_NO_LOG_VARS=1; -DIST_PACKAGES="dist_minipix_dist"; - -# # Build target invariants # INVARIANTS_NO_LOG_VARS=1; -INVARIANTS_PACKAGES="invariants_digest invariants_gitref invariants_tarballs invariants_zipdist"; +INVARIANTS_PACKAGES="invariants_digest invariants_gitref invariants_minipix invariants_tarballs invariants_zipdist"; # # Build targets @@ -1649,6 +1643,6 @@ host_tools host_tools_deps host_tools_rpm host_toolchain_deps host_toolchain hos native_tools native_toolchain_deps native_toolchain native_toolchain_mingw32 native_runtime host_packages_deps native_packages_deps native_packages_deps_x11 native_packages -minipix dist"; +minipix"; # vim:filetype=sh textwidth=0 diff --git a/vars/dist_minipix_dist.vars b/vars/dist_minipix_dist.vars deleted file mode 100644 index 1e043117..00000000 --- a/vars/dist_minipix_dist.vars +++ /dev/null @@ -1,39 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_dist_minipix_dist_all() { - local _dist_pfx="${PREFIX_MINIPIX}" _bin_pname="" _lib_name="" \ - _term="" _term_letter=""; - ex_rtl_fileop rm "${_dist_pfx}"; - ex_rtl_fileop mkdir "${_dist_pfx}" "${_dist_pfx}/bin" "${_dist_pfx}/share"; - for _bin_name in clear reset tset; do - ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/bin/${_bin_name}" "${_dist_pfx}/bin"; - done; - for _bin_pname in $(find "${PREFIX}/minipix_dist/bin" \ - -maxdepth 1 -perm /a=x -type f -and \( -not -name "lib*" \)); do - ex_rtl_fileop cp_follow "${_bin_pname}" "${_dist_pfx}/bin"; - done; - for _lib_name in libc.so libcrypto.so.43 liblzma.so.5 libmagic.so.1 \ - libncursesw.so.6 libpcre.so.1 libpsxscl.so libreadline.so.7 \ - libu16ports.so.0 libssl.so.45 libtinfo.so.6 libtinfow.so.6 \ - libunistring.so.2 libuuid.so.1 libz.so.1; do - ex_rtl_fileop cp_follow \ - "${PREFIX_NATIVE}/lib/${_lib_name}" "${_dist_pfx}/bin"; - done; - for _shared_pname in nano vim; do - ex_rtl_fileop cp_follow \ - "${PREFIX}/minipix_dist/share/${_shared_pname}" "${_dist_pfx}/share"; - done; - ex_rtl_fileop ln_symbolic "nano/nanorc.nanorc" "${_dist_pfx}/share/nanorc"; - ex_rtl_fileop ln_symbolic "vim/vim74/vimrc_example.vim" "${_dist_pfx}/share/vimrc"; - for _term in putty putty-256color screen screen-256color xterm xterm-256color; do - _term_letter="${_term%${_term#[a-zA-Z]}}"; - ex_rtl_fileop mkdir "${_dist_pfx}/share/terminfo/${_term_letter}"; - ex_rtl_fileop cp_follow \ - "${PREFIX_NATIVE}/share/terminfo/${_term_letter}/${_term}" \ - "${_dist_pfx}/share/terminfo/${_term_letter}"; - done; -}; - -# vim:filetype=sh diff --git a/vars/invariants_digest.vars b/vars/invariants_digest.vars index 51bc212b..38efb49f 100644 --- a/vars/invariants_digest.vars +++ b/vars/invariants_digest.vars @@ -3,21 +3,22 @@ # pkg_invariants_digest_all() { - local __=""; - if [ -z "${ARG_TARBALL}" ]; then - exit 0; - else + local _fname=""; + if ex_rtl_lmatch "${ARG_DIST}" , tbz2 \ + || ex_rtl_lmatch "${ARG_DIST}" , tgz \ + || ex_rtl_lmatch "${ARG_DIST}" , txz \ + || ex_rtl_lmatch "${ARG_DIST}" , zipdist; then 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 _fname in $(find "${PREFIX_NATIVE#${PREFIX}/}" -type f -perm /a=x \ + \( -path "${PREFIX_NATIVE#${PREFIX}/}/bin/*" -or \ + -path "${PREFIX_NATIVE#${PREFIX}/}/lib/*" \)); do + sha256sum "${_fname}"; + done > "${PREFIX}/SHA256SUMS"); 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_minipix.vars b/vars/invariants_minipix.vars new file mode 100644 index 00000000..29c75f5c --- /dev/null +++ b/vars/invariants_minipix.vars @@ -0,0 +1,67 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkgp_invariants_minipix_is_newer() { + local _new_fname="${1}" _new_ts="" _old_dname="${2}" _old_ts=""; + _old_ts="$(stat -c %Y "${_old_dname%%/}/${_new_fname##*/}")"; + _new_ts="$(stat -c %Y "${_new_fname}")"; + if [ "${_new_ts}" > "${_old_ts}" ]; then + return 0; + else + return 1; + fi; +}; + +pkg_invariants_minipix_all() { + local _dname="" _fname="" _pname=""; + if ex_rtl_lmatch "${ARG_DIST}" , minipix; then + for _dname in "${PREFIX_MINIPIX}/bin" "${PREFIX_MINIPIX}/share"; do + if [ ! -e "${_dname}" ]; then + ex_rtl_fileop mkdir "${_dname}"; + fi; + done; + for _fname in clear reset tset; do + if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; then + ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; + fi; + done; + for _pname in $(find "${PREFIX_MINIPIX}/bin" \ + -maxdepth 1 -perm /a=x -type f -and \( -not -name "lib*" \)); do + if pkgp_invariants_minipix_is_newer "${_pname}" "${PREFIX_MINIPIX}/bin"; then + ex_rtl_fileop cp_follow "${_pname}" "${PREFIX_MINIPIX}/bin"; + fi; + done; + for _fname in libc.so libcrypto.so.43 liblzma.so.5 libmagic.so.1 \ + libncursesw.so.6 libpcre.so.1 libpsxscl.so libreadline.so.7 \ + libu16ports.so.0 libssl.so.45 libtinfo.so.6 libtinfow.so.6 \ + libunistring.so.2 libuuid.so.1 libz.so.1; do + if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; then + ex_rtl_fileop cp_follow \ + "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; + fi; + done; + for _fname in nano vim; do + if pkgp_invariants_minipix_is_newer "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; then + ex_rtl_fileop cp_follow "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; + fi; + done; + if [ ! -L "${PREFIX_MINIPIX}/share/nanorc" ]; then + ex_rtl_fileop ln_symbolic "nano/nanorc.nanorc" "${PREFIX_MINIPIX}/share/nanorc"; + fi; + if [ ! -L "${PREFIX_MINIPIX}/share/vimrc" ]; then + ex_rtl_fileop ln_symbolic "vim/vim74/vimrc_example.vim" "${PREFIX_MINIPIX}/share/vimrc"; + fi; + for _fname in putty putty-256color screen screen-256color xterm xterm-256color; do + _dname="${PREFIX_MINIPIX}/share/terminfo/${_fname%${_fname#[a-zA-Z]}}"; + if [ ! -e "${_dname}" ]; then + ex_rtl_fileop mkdir "${_dname}"; + fi; + if pkgp_invariants_minipix_is_newer "${PREFIX_NATIVE}/share/terminfo/${_term_letter}/${_fname}" "${_dname}"; then + ex_rtl_fileop cp_follow "${PREFIX_NATIVE}/share/terminfo/${_term_letter}/${_fname}" "${_dname}"; + fi; + done; + fi; +}; + +# vim:filetype=sh diff --git a/vars/invariants_tarballs.vars b/vars/invariants_tarballs.vars index 1b89aeb0..998a1b54 100644 --- a/vars/invariants_tarballs.vars +++ b/vars/invariants_tarballs.vars @@ -2,103 +2,88 @@ # 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}"; +pkgp_invariants_tarball_dist() { + local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}"; + local _tarball_fname="${DEFAULT_TARBALL_FNAME_PREFIX}${BUILD_USER}@${BUILD_HNAME}-${BUILD_DATE_START}.tar.${_tarball_suffix}"; tar -cpf - $(find . -maxdepth 1 -mindepth 1 -type d \ -not -path ./minipix \ -not -path ./minipix_dist \ -not -path ./rpm \ -not -path ./tmp | sort) \ midipix_shortcut.vbs midipix.sh README SHA256SUMS |\ - "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_FNAME}"; + "${_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}"; + --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}"; +pkgp_invariants_tarball_toolchain() { + local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}"; + local _tarball_cross_fname="${DEFAULT_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}"; + "${_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}"; + --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}"; +pkgp_invariants_tarball_minipix() { + local _tarball_compress_cmd="${1}" _tarball_compress_args="${2}" _tarball_suffix="${3}"; + local _tarball_minipix_fname="${DEFAULT_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}"; + "${_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}"; + --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() { - local _build_tgt_lc="" _build_tgt_uc="" _find_filters="" _pkg_name_lc="" _pkg_name_uc=""; - 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..."; - for _build_tgt_lc in ${BUILD_TARGETS:-${TARGETS_DEFAULT}}; do - _build_tgt_uc="$(ex_rtl_toupper "${_build_tgt_lc}")"; - for _pkg_name_lc in $(ex_rtl_get_var_unsafe ${_build_tgt_uc}_PACKAGES); do - _pkg_name_uc="$(ex_rtl_toupper "${_pkg_name_lc}")"; - if [ "$(ex_rtl_get_var_unsafe ${_pkg_name_uc}_SRC_TARBALL_DISABLE)" = "1" ]; then - _find_filters="${_find_filters:+${_find_filters} }( -not -name ${_pkg_name}-\*-\* )"; - fi; - done; - done; - tar -C "${BUILD_WORKDIR}" -cpf - $(cd "${BUILD_WORKDIR}" && find \ - -maxdepth 1 -mindepth 1 -name \*-\*-\* \ - ${_find_filters}) |\ - "${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..."; + local _tarball_compress_args="" _tarball_compress_cmd="" _tarball_suffix="" _tarball_suffixes="" _tarball_type="" _tarball_types=""; + if ex_rtl_lmatch "${ARG_DIST}" , tbz2; then + _tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }bz2"; + fi; + if ex_rtl_lmatch "${ARG_DIST}" , tgz; then + _tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }gz"; 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; + if ex_rtl_lmatch "${ARG_DIST}" , txz; then + _tarball_suffixes="${_tarball_suffixes:+${_tarball_suffixes} }xz"; fi; + for _tarball_suffix in ${_tarball_suffixes}; do + ex_rtl_log_msg info "Building ${_tarball_suffix}-compressed 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"; ;; + *) ex_rtl_log_msg failexit "Unknown tarball suffix \`${_tarball_suffix}'."; + esac; + ex_rtl_fileop cd "${PREFIX}"; PREFIX_BASENAME="${PREFIX_NATIVE##*/}"; + _tarball_types="dist toolchain minipix"; + for _tarball_type in ${_tarball_types}; do + pkgp_invariants_tarball_${_tarball_type} "${_tarball_compress_cmd}" "${_tarball_compress_args}" "${_tarball_suffix}"; + done; + done; }; # vim:filetype=sh diff --git a/vars/invariants_zipdist.vars b/vars/invariants_zipdist.vars index 246e5562..9a90b1a5 100644 --- a/vars/invariants_zipdist.vars +++ b/vars/invariants_zipdist.vars @@ -4,9 +4,7 @@ pkg_invariants_zipdist_all() { local _dist_fname="" _pkg_name="" _pkglist_fname="${PREFIX}/pkglist.native"; - if [ -z "${ARG_ZIPDIST}" ]; then - exit 0; - else + if ex_rtl_lmatch "${ARG_DIST}" , zipdist; then ex_rtl_log_msg info "Building deployable distribution ZIP archive..."; for _pkg_name in $(cat "${_pkglist_fname}"); do if ! stat "${BUILD_WORKDIR}/${_pkg_name}-native-${DEFAULT_TARGET}" >/dev/null 2>&1; then diff --git a/vars/midipix.vars b/vars/midipix.vars index 596e9782..55df1d79 100644 --- a/vars/midipix.vars +++ b/vars/midipix.vars @@ -83,8 +83,6 @@ : ${DEFAULT_TARBALL_CROSS_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}_cross.}; : ${DEFAULT_TARBALL_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}.}; : ${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX:=minipix-${ARCH}-${BUILD}.}; -: ${DEFAULT_TARBALL_SRC_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}_src.}; -: ${DEFAULT_TARBALL_SUFFIX:=xz}; : ${DEFAULT_ZIPDIST_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}.}; # Check & clear predicates |