From d5afb4ad3d60f078e64e402e403f0e55fc711714 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Feb 06 2017 04:23:24 +0000 Subject: build.sh, {subr,vars}/*: general cleanup. --- diff --git a/build.sh b/build.sh index 8991b60..1bd3768 100755 --- a/build.sh +++ b/build.sh @@ -71,7 +71,7 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do _pkg_step_cmds=""; _pkg_step_cmd_args=""; case "${1#*:}" in abstract) _pkg_step_cmds="pkg_${PKG_NAME}_${1%:*}"; - _pkg_step_cmd_args="${ARG_RESTART_AT}"; ;; + _pkg_step_cmd_args="${ARG_RESTART_AT:-ALL}"; ;; always) _pkg_step_cmds="pkg_${1%:*}"; ;; main) if [ -n "${BUILD_PACKAGES_RESTART}" ]; then if [ -z "${ARG_RESTART_AT}" ]\ @@ -88,11 +88,17 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do esac; for __ in ${_pkg_step_cmds}; do if test_cmd "${__}"; then - test_cmd "${__}_pre" && "${__}_pre"; + test_cmd "pkg_${PKG_NAME}_${1%:*}_pre" \ + && "pkg_${PKG_NAME}_${1%:*}_pre" "${__}" ${_pkg_step_cmd_args}; - test_cmd "${__}_post" && "${__}_post"; - set_build_script_done "${PKG_NAME}" "${1%:*}" \ - ${2:+-${2%:*}}; break; + test_cmd "pkg_${PKG_NAME}_${1%:*}_post" \ + && "pkg_${PKG_NAME}_${1%:*}_post" + if [ "${1#*:}" != "always" ]\ + && [ ${#} -ge 2 ]; then + set_build_script_done "${PKG_NAME}" "${1%:*}" "-${2#*:}"; + else + set_build_script_done "${PKG_NAME}" "${1%:*}"; + fi; break; fi; done; shift; done; diff --git a/subr/build.subr b/subr/build.subr index 5b67079..075575c 100644 --- a/subr/build.subr +++ b/subr/build.subr @@ -85,6 +85,8 @@ is_build_script_done() { else return 1; # Build fi; + elif [ "${_restart_at}" = "ALL" ]; then + return 1; # Build elif lmatch "${_restart_at}" , "${2}"; then return 1; # Build else diff --git a/subr/pkg_autoconf.subr b/subr/pkg_autoconf.subr index 65f7c2d..981dae7 100644 --- a/subr/pkg_autoconf.subr +++ b/subr/pkg_autoconf.subr @@ -4,19 +4,19 @@ pkg_autoconf() { local __; - if [ -e "../${PKG_SUBDIR}/configure" -o \ - -e "../${PKG_SUBDIR}/configure.ac" -o \ - -e "../${PKG_SUBDIR}/configure.in" -o \ - -e "../${PKG_SUBDIR}/config.guess" ]; then - find "../${PKG_SUBDIR}" -name config.sub \ + if [ -e "${WORKDIR}/${PKG_SUBDIR}/configure" -o \ + -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" -o \ + -e "${WORKDIR}/${PKG_SUBDIR}/configure.in" -o \ + -e "${WORKDIR}/${PKG_SUBDIR}/config.guess" ]; then + find "${WORKDIR}/${PKG_SUBDIR}" -name config.sub \ -exec echo mv -- {} {}.orig \; \ -exec mv -- {} {}.orig \; \ -exec echo install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \; \ -exec install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \;; - if [ -e "../${PKG_SUBDIR}/configure.ac" ]\ - && [ ! -e "../${PKG_SUBDIR}/configure" ]; then - if [ -e "../${PKG_SUBDIR}/autogen.sh" ]; then - for __ in "../${PKG_SUBDIR}/build-aux" "../${PKG_SUBDIR}"; do + if [ -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" ]\ + && [ ! -e "${WORKDIR}/${PKG_SUBDIR}/configure" ]; then + if [ -e "${WORKDIR}/${PKG_SUBDIR}/autogen.sh" ]; then + for __ in "${WORKDIR}/${PKG_SUBDIR}/build-aux" "${WORKDIR}/${PKG_SUBDIR}"; do if [ -e "${__}" ]; then echo install -m 0700 \ "${MIDIPIX_BUILD_PWD}/etc/config.sub" \ @@ -27,13 +27,13 @@ pkg_autoconf() { break; fi; done; - (build_fileop cd "../${PKG_SUBDIR}" && "${SHELL}" ./autogen.sh) || exit 1; + (build_fileop cd "${WORKDIR}/${PKG_SUBDIR}" && "${SHELL}" ./autogen.sh) || exit 1; else - (build_fileop cd "../${PKG_SUBDIR}" && autoconf) || exit 1; + (build_fileop cd "${WORKDIR}/${PKG_SUBDIR}" && autoconf) || exit 1; fi; fi; - for __ in . ${PKG_CONFIG_CACHE_EXTRA}; do - build_fileop cp "${MIDIPIX_BUILD_PWD}/etc/config.cache" "${__}/"; + for __ in ${PKG_BUILD_DIR} ${PKG_CONFIG_CACHE_EXTRA}; do + build_fileop cp "${MIDIPIX_BUILD_PWD}/etc/config.cache" "${WORKDIR}/${__}/"; done; fi; }; diff --git a/subr/pkg_build.subr b/subr/pkg_build.subr index 9ef158a..16ac133 100644 --- a/subr/pkg_build.subr +++ b/subr/pkg_build.subr @@ -3,6 +3,10 @@ # pkg_build() { + local _no_autoconf; + if [ ! -x "${PKG_CONFIGURE}" ]; then + _no_autoconf=1; + fi; if [ -n "${PKG_BUILD_CMDLINE}" ]; then ${PKG_BUILD_CMDLINE}; elif [ ${PKG_NO_MAKE_BUILD:-0} -eq 0 ]; then @@ -12,13 +16,12 @@ pkg_build() { run_cmd_unsplit make \ ${PKG_MAKEFLAGS_BUILD} \ ${PKG_MAKEFLAGS_BUILD_EXTRA} \ - AR=${AR} ${__no_autoconf:+CC=${CC}} RANLIB=${RANLIB} \ + AR=${AR} ${_no_autoconf:+CC=${CC}} RANLIB=${RANLIB} \ "${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}" \ "${CFLAGS_FOR_BUILD:+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD}}" \ "${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \ "${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \ "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}"; - unset __no_autoconf; fi; }; diff --git a/subr/pkg_build_dir.subr b/subr/pkg_build_dir.subr index 13e96ab..7d8a95f 100644 --- a/subr/pkg_build_dir.subr +++ b/subr/pkg_build_dir.subr @@ -3,13 +3,10 @@ # pkg_build_dir() { - if [ -z "${PKG_BUILD_DIR}" ]; then - set_build_dir "${PKG_SUBDIR}" "${PKG_BUILD_TYPE:-native}"; + if [ ! -d "${WORKDIR}/${PKG_BUILD_DIR}" ]; then + build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}"; fi; - if [ ! -d "${PKG_BUILD_DIR}" ]; then - build_fileop mkdir "${PKG_BUILD_DIR}"; - fi; - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; }; # vim:filetype=sh diff --git a/subr/pkg_configure.subr b/subr/pkg_configure.subr index fc70f39..1d53d8b 100644 --- a/subr/pkg_configure.subr +++ b/subr/pkg_configure.subr @@ -4,9 +4,9 @@ pkg_configure() { if [ -n "${PKG_CONFIGURE}" ]; then - PKG_CONFIGURE="../${PKG_CONFIGURE}"; + PKG_CONFIGURE="${WORKDIR}/${PKG_CONFIGURE}"; else - PKG_CONFIGURE="../${PKG_SUBDIR}/configure"; + PKG_CONFIGURE="${WORKDIR}/${PKG_SUBDIR}/configure"; fi; if [ -x "${PKG_CONFIGURE}" ]; then export CFLAGS_FOR_BUILD="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}"; diff --git a/subr/pkg_disabled.subr b/subr/pkg_disabled.subr index 43cef71..3b5a308 100644 --- a/subr/pkg_disabled.subr +++ b/subr/pkg_disabled.subr @@ -3,7 +3,7 @@ # pkg_disabled() { - if [ ${PKG_DISABLED:-0} -eq 1 ]; then + if [ "${PKG_DISABLED:-0}" -eq 1 ]; then exit 0; fi; }; diff --git a/subr/pkg_distclean.subr b/subr/pkg_distclean.subr index f721a9f..68c09dd 100644 --- a/subr/pkg_distclean.subr +++ b/subr/pkg_distclean.subr @@ -4,8 +4,8 @@ pkg_distclean() { if [ "${PKG_SUBDIR}" != "${PKG_BUILD_DIR}" ]; then - build_fileop rm ${PKG_BUILD_DIR}; - build_fileop mkdir ${PKG_BUILD_DIR}; + build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}"; + build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}"; fi; }; diff --git a/subr/pkg_extract.subr b/subr/pkg_extract.subr index d476647..f698293 100644 --- a/subr/pkg_extract.subr +++ b/subr/pkg_extract.subr @@ -5,24 +5,24 @@ pkg_extract() { if [ -n "${PKG_URL}" ]\ && [ "${PKG_URL_TYPE:-wget}" = wget ]; then - build_fileop rm ${PKG_SUBDIR}; - if [ ${PKG_SUBDIR_CREATE:-0} -eq 1 ]; then - build_fileop mkdir ${PKG_SUBDIR}; + build_fileop rm "${WORKDIR}/${PKG_SUBDIR}"; + if [ "${PKG_SUBDIR_CREATE:-0}" -eq 1 ]; then + build_fileop mkdir "${WORKDIR}/${PKG_SUBDIR}"; fi; if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then - bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then - gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then - xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then - bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; elif [ "${PKG_FNAME##*.t}" = "gz" ]; then - gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; elif [ "${PKG_FNAME##*.t}" = "xz" ]; then - xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -; + xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; else - tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf ${DLCACHEDIR}/${PKG_FNAME}; + tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf "${DLCACHEDIR}/${PKG_FNAME}"; fi; fi; }; diff --git a/subr/pkg_fetch.subr b/subr/pkg_fetch.subr index fd78a3c..37c2439 100644 --- a/subr/pkg_fetch.subr +++ b/subr/pkg_fetch.subr @@ -10,53 +10,51 @@ pkgp_fetch() { else _url_dst="${DLCACHEDIR}/${3}"; fi; - if [ ${ARG_OFFLINE:-0} -eq 1 ]\ - || [ -e ${_url_dst}.fetched ]; then + if [ "${ARG_OFFLINE:-0}" -eq 1 ]\ + || [ -e "${_url_dst}.fetched" ]; then return 0; else - wget ${WGET_ARGS} -c -O ${_url_dst} "${_url}"; + wget ${WGET_ARGS} -c -O "${_url_dst}" "${_url}"; fi; if [ -n "${_sha256sum_src}" ]; then - set -- $(openssl dgst -sha256 ${_url_dst}); shift $((${#}-1)); + set -- $(openssl dgst -sha256 "${_url_dst}"); shift $((${#}-1)); if [ "${_sha256sum_dst:=${1}}" != "${_sha256sum_src}" ]; then - if [ ${ARG_IGNORE_SHA256SUMS:-0} -eq 0 ]; then + if [ "${ARG_IGNORE_SHA256SUMS:-0}" -eq 0 ]; then log_msg failexit "Error: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; else log_msg warn "Warning: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; fi; fi; fi; - touch ${_url_dst}.fetched; + touch "${_url_dst}.fetched"; }; pkgp_fetch_git() { local _subdir="${1}" _url="${2}" _branch="${3}"; - if [ ${ARG_OFFLINE:-0} -eq 0 ]; then + if [ "${ARG_OFFLINE:-0}" -eq 0 ]; then if [ -e "${DLCACHEDIR}/${_subdir}" ]; then - build_fileop cd ${DLCACHEDIR}/${_subdir} &&\ - git pull origin ${_branch:-main} &&\ - build_fileop cd ${OLDPWD}; + (build_fileop cd "${DLCACHEDIR}/${_subdir}" &&\ + git pull origin "${_branch:-main}"); else - git clone ${_url} ${DLCACHEDIR}/${_subdir}; + git clone "${_url}" "${DLCACHEDIR}/${_subdir}"; if [ -n "${_branch}" -a \ \( -z "${_branch#main}" \) -a \ \( -z "${_branch#master}" \) ]; then - build_fileop cd ${DLCACHEDIR}/${_subdir} &&\ - git checkout -b ${_branch} &&\ - build_fileop cd ${OLDPWD}; + (build_fileop cd "${DLCACHEDIR}/${_subdir}" &&\ + git checkout -b "${_branch}"); fi; fi; fi; - build_fileop rm ${_subdir}; - build_fileop cp ${DLCACHEDIR}/${_subdir} .; + build_fileop rm "${WORKDIR}/${_subdir}"; + build_fileop cp "${DLCACHEDIR}/${_subdir}" "${WORKDIR}"; }; pkgp_fetch_urls_git() { local _url_spec _subdir _url _git_branch; - for _url_spec in "${@}"; do - _subdir=${_url_spec%=*}; - _url=${_url_spec#*=}; - _url=${_url%@*}; + for _url_spec in ${@}; do + _subdir="${_url_spec%=*}"; + _url="${_url_spec#*=}"; + _url="${_url%@*}"; if [ "${_url_spec#*@}" != "${_url_spec}" ]; then _git_branch=${_url_spec#*@}; fi; @@ -67,16 +65,16 @@ pkgp_fetch_urls_git() { pkg_fetch() { if [ -n "${1}" ]; then if [ "${1}" = "-git" ]; then - shift; pkgp_fetch_urls_git ${1}; + shift; pkgp_fetch_urls_git "${1}"; else - pkgp_fetch ${1} ${2}; + pkgp_fetch "${1}" "${2}"; fi; else if [ -n "${PKG_URL}" ]; then - pkgp_fetch ${PKG_URL} ${PKG_SHA256SUM} ${PKG_FNAME}; + pkgp_fetch "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}"; fi; if [ -n "${PKG_URLS_GIT}" ]; then - pkgp_fetch_urls_git ${PKG_URLS_GIT}; + pkgp_fetch_urls_git "${PKG_URLS_GIT}"; fi; fi; }; diff --git a/subr/pkg_patch.subr b/subr/pkg_patch.subr index 8cb173f..3730395 100644 --- a/subr/pkg_patch.subr +++ b/subr/pkg_patch.subr @@ -6,19 +6,19 @@ pkg_patch() { local _patch_fname; if [ -d "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}" ]; then set +o noglob; - for _patch_fname in "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch"; do - patch -b -d "../${PKG_SUBDIR}" -p1 < "${_patch_fname}"; + for _patch_fname in ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch; do + patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}"; done; set -o noglob; fi; - for _patch_fname in \ - "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local.patch" \ - "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local@${BUILD_HNAME}.patch" \ - "${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch" \ - "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch" \ - "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch"; do + for _patch_fname in \ + ${MIDIPIX_BUILD_PWD}/${WORKDIR}/${PKG_SUBDIR}.local.patch \ + ${MIDIPIX_BUILD_PWD}/${WORKDIR}/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch \ + ${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch; do if [ -r "${_patch_fname}" ]; then - patch -b -d "../${PKG_SUBDIR}" -p1 < "${_patch_fname}"; + patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}"; fi; done; }; diff --git a/subr/pkg_patch_pre.subr b/subr/pkg_patch_pre.subr index 298acd7..f3402fc 100644 --- a/subr/pkg_patch_pre.subr +++ b/subr/pkg_patch_pre.subr @@ -5,13 +5,13 @@ pkg_patch_pre() { local __; for __ in \ - "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch" \ - "${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch" \ - "${WORKDIR}/chainport/${PKG_SUBDIR}_pre.midipix.patch" \ - "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local.patch" \ - "${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch"; do + ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch \ + ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch \ + ${WORKDIR}/chainport/${PKG_SUBDIR}_pre.midipix.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local.patch \ + ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch; do if [ -r "${__}" ]; then - patch -b -d "${PKG_SUBDIR}" -p1 < "${__}"; + patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${__}"; fi; done; }; diff --git a/subr/pkg_setup_env.subr b/subr/pkg_setup_env.subr index 60d5aec..83c2411 100644 --- a/subr/pkg_setup_env.subr +++ b/subr/pkg_setup_env.subr @@ -25,6 +25,23 @@ pkg_setup_env() { [ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR="${PKG_FNAME%%.tar*}"; [ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}"; [ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)"; + if [ -z "${PKG_BUILD_DIR}" ]; then + set_build_dir "${PKG_SUBDIR}" "${PKG_BUILD_TYPE:-native}"; + fi; + if [ "${PKG_BUILD_TYPE}" = "host" ]; then + export AR="ar"; + export CC="gcc"; + export CXX="g++"; + export RANLIB="ranlib"; + else + export AR="${PKG_TARGET}-ar"; + export CC="${PKG_TARGET}-gcc"; + export CXX="${PKG_TARGET}-g++"; + export RANLIB="${PKG_TARGET}-ranlib"; + fi; + if [ "${PKG_SLIBTOOL}" != "default" ]; then + export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; + fi; fi; for __ in $(set); do if [ "${__#PKG_${_pkg_name_uc}}" != "${__}" ]; then @@ -34,21 +51,6 @@ pkg_setup_env() { if [ -n "${_log_env_vars}" ]; then log_env_vars "build" ${_log_env_vars}; fi; - build_fileop cd "${WORKDIR}"; - if [ "${PKG_BUILD_TYPE}" = "host" ]; then - export AR="ar"; - export CC="gcc"; - export CXX="g++"; - export RANLIB="ranlib"; - else - export AR="${PKG_TARGET}-ar"; - export CC="${PKG_TARGET}-gcc"; - export CXX="${PKG_TARGET}-g++"; - export RANLIB="${PKG_TARGET}-ranlib"; - fi; - if [ "${PKG_SLIBTOOL}" != "default" ]; then - export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; - fi; }; # vim:filetype=sh diff --git a/vars/gcc.vars b/vars/gcc.vars index b1f6aba..1660334 100644 --- a/vars/gcc.vars +++ b/vars/gcc.vars @@ -39,9 +39,9 @@ pkgp_gcc_setup_env() { }; pkgp_gcc_configure() { - build_fileop rm "${PKG_BUILD_DIR}"; - build_fileop mkdir "${PKG_BUILD_DIR}"; - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}"; + build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; "../cbb-gcc-${PKG_GCC_VERSION}/configure" "${@}"\ --disable-bootstrap \ --disable-libmudflap \ @@ -72,6 +72,10 @@ pkg_gcc_stage1_cross_x86_64_w64_mingw32_all() { }; pkg_gcc_stage1_native_x86_64_w64_mingw32_all() { + export AR="${TARGET}-ar"; + export CC="${TARGET}-gcc"; + export CXX="${TARGET}-g++"; + export RANLIB="${TARGET}-ranlib"; pkg_gcc_stage1_all "${@}"; }; @@ -114,7 +118,7 @@ pkg_gcc_stage1_all() { --with-sysroot="${PREFIX}/${PKG_TARGET}"\ --without-headers; ;; gcc_stage1_native_x86_64_w64_mingw32) - patch -b -d cbb-gcc-4.6.4 -p1 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch"; + patch -b -d "${WORKDIR}/cbb-gcc-4.6.4" -p1 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch"; pkgp_gcc_configure \ --build=x86_64-unknown-linux-gnu \ --enable-sjlj-exceptions \ @@ -128,7 +132,7 @@ pkg_gcc_stage1_all() { --without-headers; ;; esac; else - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; fi; if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then make ${MAKEFLAGS} all-gcc; @@ -157,7 +161,7 @@ pkg_gcc_runtime_all() { local _restart_at="${1}"; export MAKE="make LIBTOOL=slibtool"; set_build_dir "cbb-gcc-${PKG_GCC_RUNTIME_VERSION}" cross; - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; # GCC, compiler runtime. if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then make ${MAKEFLAGS} all-target-libgcc; @@ -174,7 +178,7 @@ pkg_gcc_libstdcpp_v3_all() { local _restart_at="${1}"; export MAKE="make LIBTOOL=slibtool"; set_build_dir "cbb-gcc-${PKG_GCC_LIBSTDCPP_V3_VERSION}" cross; - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; # GCC, libstdc++-v3. if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then make ${MAKEFLAGS} all-target-libstdc++-v3; @@ -191,7 +195,7 @@ pkg_gcc_full_all() { local _restart_at="${1}"; export MAKE="make LIBTOOL=slibtool"; set_build_dir "cbb-gcc-${PKG_GCC_FULL_VERSION}" cross; - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; # GCC, everything else. if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then make ${MAKEFLAGS}; @@ -231,7 +235,7 @@ pkg_gcc_native_all() { --with-mpfr="${PKG_PREFIX}" \ --with-sysroot=; else - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; fi; if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then make ${MAKEFLAGS} all-gcc; diff --git a/vars/musl.vars b/vars/musl.vars index 5ba6e79..d5c88aa 100644 --- a/vars/musl.vars +++ b/vars/musl.vars @@ -4,9 +4,9 @@ # pkgp_musl_configure() { - build_fileop rm "${PKG_BUILD_DIR}"; - build_fileop mkdir "${PKG_BUILD_DIR}"; - build_fileop cd "${PKG_BUILD_DIR}"; + build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}"; + build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}"; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; env lz_cflags_cmdline="" \ lz_debug="yes" \ ../lazy/lazy \ @@ -31,15 +31,15 @@ pkg_musl_no_complex_all() { if ! is_build_script_done "${PKG_NAME}" fetch "${_restart_at}"; then pkg_fetch "http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz" \ "${PKG_MUSL_NO_COMPLEX_SHA256SUM}"; - build_fileop rm mmglue; + build_fileop rm "${WORKDIR}/mmglue"; pkg_fetch -git "mmglue=${GITROOT}/mmglue"; set_build_script_done "${PKG_NAME}" fetch -extract; fi; if ! is_build_script_done "${PKG_NAME}" extract "${_restart_at}"; then build_fileop rm "musl-${PKG_MUSL_VERSION}"; - tar -xf "${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz"; + tar -C "${WORKDIR}" -xf "${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz"; set +o noglob; - build_fileop cp mmglue/* "musl-${PKG_MUSL_VERSION}/"; + build_fileop cp ${WORKDIR}/mmglue/* "${WORKDIR}/musl-${PKG_MUSL_VERSION}/"; set -o noglob; set_build_script_done "${PKG_NAME}" extract -configure; fi; diff --git a/vars/perl.vars b/vars/perl.vars index f7ce19e..edfd111 100644 --- a/vars/perl.vars +++ b/vars/perl.vars @@ -4,6 +4,7 @@ pkg_perl_extract_post() { local _fname_src _fname_dst _cflag; + (build_fileop cd "${WORKDIR}"; for _fname_src in $(find perl-cross -type f \ -not -path perl-cross/.git/\* -not -name .gitignore); do _fname_dst="perl-${PKG_VERSION}${_fname_src#perl-cross}"; @@ -11,10 +12,10 @@ pkg_perl_extract_post() { build_fileop mv "${_fname_dst}" "${_fname_dst}.orig"; fi; if [ ! -d "$(dirname "${_fname_dst}")" ]; then - mkdir -p -- "$(dirname "${_fname_dst}")"; + build_fileop mkdir "$(dirname "${_fname_dst}")"; fi; build_fileop cp "${_fname_src}" "${_fname_dst}"; - done; + done); for _cflag in ${PKG_CFLAGS_CONFIGURE}; do PKG_CONFIGURE_ARGS="${PKG_CONFIGURE_ARGS:+${PKG_CONFIGURE_ARGS} }-A ccflags=${_cflag}"; done; diff --git a/vars/psxstub.vars b/vars/psxstub.vars index e0ba9c5..3539966 100644 --- a/vars/psxstub.vars +++ b/vars/psxstub.vars @@ -5,7 +5,7 @@ pkg_psxstub_install() { if [ "${TARGET}" = i686-nt32-midipix ] \ || [ "${TARGET}" = x86_64-nt64-midipix ]; then - build_fileop cd psxstub; + build_fileop cd "${WORKDIR}/psxstub"; make ${MAKEFLAGS} "DESTDIR=${PKG_PREFIX}" "TARGET=${TARGET}" install; if [ -e "${PKG_PREFIX}/lib/libpsxscl.a" ]; then build_fileop rm "${PKG_PREFIX}/lib/libpsxscl.a";