From 570129106f694bef52e07a5fc08f6c63f7f54073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Mon, 30 Jan 2017 18:50:20 +0000 Subject: build.sh: 2nd refactoring pt. I. build/{gcc,musl}.*.build: refactored into vars/{gcc,musl}.*.build. build/pkg.build: merged w/ build.sh (structurally) and refactored into subr/pkg_*.subr (implementations.) patches/gcc_native_x86_64_w64_mingw32.local.patch: fix wrong filename. subr/build.subr: merges source_scripts() into build.sh. subr/pkg.subr: accept either of ${PKG_..._{URL,VERSION}} when checking for missing entries in var/build.vars. vars/build.vars: adds vars for {gcc,musl}_*. vars/psxstub.vars: convert to pkg_..._all(); call pkg_fetch(). --- subr/pkg_extract.subr | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 subr/pkg_extract.subr (limited to 'subr/pkg_extract.subr') diff --git a/subr/pkg_extract.subr b/subr/pkg_extract.subr new file mode 100644 index 00000000..1bee8835 --- /dev/null +++ b/subr/pkg_extract.subr @@ -0,0 +1,34 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# See warning at the top of build.vars. +# + +pkg_extract() { + if [ "${PKG_URL_TYPE:-wget}" = wget ]; then + secure_rm ${PKG_SUBDIR}; + if [ ${PKG_SUBDIR_CREATE:-0} -eq 1 ]; then + insecure_mkdir ${PKG_SUBDIR}; + fi; + if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then + bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then + gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then + xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then + bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.t}" = "gz" ]; then + gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + elif [ "${PKG_FNAME##*.t}" = "xz" ]; then + xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + else + tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf ${DLCACHEDIR}/${PKG_FNAME}; + fi; + if test_cmd pkg_${PKG_NAME}_extract_post; then + pkg_${PKG_NAME}_extract_post; + fi; + fi; + set_build_script_done extract -build_dir; +}; + +# vim:filetype=sh -- cgit v1.2.3