diff --git a/006.musl.build b/006.musl.build index 961746b..6713a1f 100644 --- a/006.musl.build +++ b/006.musl.build @@ -4,6 +4,7 @@ if is_build_script_done finished; then exit 212; elif [ "x${3}" = "xno-complex" ]; then # Musl: build (no-complex) + unset _destdir; _install=install_no_complex; set_build_dir musl-${PKG_MUSL_VERSION}-${3} cross; fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz \ @@ -21,11 +22,12 @@ elif [ "x${3}" = "xnative" ]; then set_build_dir musl-${PKG_MUSL_VERSION} ${3}; else # Musl: build (full) + unset _destdir; _install=install; set_build_dir musl-${PKG_MUSL_VERSION} cross; fi; if ! is_build_script_done configured; then - rm_if_exists -m -c ${_build_dir}; + rm_if_exists -m -c ${BUILD_DIR}; ../lazy/lazy \ -a ${ARCH} \ -c gcc \ @@ -36,7 +38,7 @@ if ! is_build_script_done configured; then -x config; set_build_script_done configured -built; else - cd ${_build_dir}; + cd ${BUILD_DIR}; fi; if ! is_build_script_done built; then ./lazy -e ${_install} \ diff --git a/007.gcc.full.build b/007.gcc.full.build index 999dd8b..8935644 100644 --- a/007.gcc.full.build +++ b/007.gcc.full.build @@ -4,9 +4,8 @@ if is_build_script_done finished; then exit 212; elif [ "x${3}" = "xruntime" ]\ || [ "x${3}" = "xfull" ]; then - export CFLAGS="${GCCFLAGS}" CXXFLAGS="${GCCFLAGS}"; set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; - cd ${_build_dir}; + cd ${BUILD_DIR}; if [ "x${3}" = "xruntime" ]; then # GCC, compiler runtime. if ! is_build_script_done built; then @@ -44,7 +43,7 @@ else cbb_sysroot_for_libgcc=${PREFIX_TARGET} \ cbb_target=${TARGET} \ cbb_neutral_libiberty=no \ - cbb_xgcc_for_specs=${WORKDIR}/${_build_dir}/gcc/xgcc; + cbb_xgcc_for_specs=${WORKDIR}/${BUILD_DIR}/gcc/xgcc; GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_TARGET}"; elif [ "x${3}" = "xnative" ]; then # GCC, native. @@ -80,7 +79,7 @@ else --with-mpfr=${PREFIX_NATIVE} \ --with-sysroot="; fi; - rm_if_exists -m -c ${_build_dir}; + rm_if_exists -m -c ${BUILD_DIR}; ../cbb-gcc-${PKG_GCC_VERSION}/configure \ --disable-bootstrap \ --disable-libmudflap \ @@ -107,7 +106,7 @@ else ${_configure_args}; set_build_script_done configured -built; else - cd ${_build_dir}; + cd ${BUILD_DIR}; fi; if ! is_build_script_done built; then if [ "x${3}" = "xstage1" ]; then diff --git a/100.perk.build b/100.perk.build index c58eddc..ed05e92 100644 --- a/100.perk.build +++ b/100.perk.build @@ -5,11 +5,11 @@ else set_build_dir ${2} native; fi; if ! is_build_script_done configured1; then - rm_if_exists -m -c ${_build_dir}; + rm_if_exists -m -c ${BUILD_DIR}; ../perk/configure; set_build_script_done configured1 -built1; else - cd ${_build_dir}; + cd ${BUILD_DIR}; fi; if ! is_build_script_done built1; then make; @@ -21,11 +21,11 @@ if ! is_build_script_done installed1; then fi; set_build_dir ${2} cross; if ! is_build_script_done configured2; then - rm_if_exists -m -c ../${_build_dir}; + rm_if_exists -m -c ../${BUILD_DIR}; ../perk/configure --target=${TARGET}; set_build_script_done configured2 -built2; else - cd ../${_build_dir}; + cd ../${BUILD_DIR}; fi; if ! is_build_script_done built2; then make; diff --git a/101.gmp.build b/101.gmp.build index 91559e9..c0d0fca 100644 --- a/101.gmp.build +++ b/101.gmp.build @@ -2,32 +2,32 @@ parse_with_pkg_name ${2} gmp mpfr mpc libelf binutils; if is_build_script_done finished; then exit 212; else - fetch ${_pkg_url} ${_pkg_sha256sum}; - set_build_dir ${_pkg_subdir} native; + fetch ${PKG_URL} ${PKG_SHA256SUM}; + set_build_dir ${PKG_SUBDIR} native; fi; if ! is_build_script_done extracted; then - rm_if_exists ${_pkg_subdir}; - tar -axf ${_pkg_fname}; + rm_if_exists ${PKG_SUBDIR}; + tar -axf ${PKG_FNAME}; set_build_script_done extracted -patched; fi; if ! is_build_script_done patched; then - patch -d ${_pkg_subdir} -p1 \ - < portage/${_pkg_subdir}.midipix.patch; - if [ ${_pkg_no_libtool_midipix:-0} -eq 0 ]; then - cp portage/libtool.midipix ${_pkg_subdir}/; + patch -d ${PKG_SUBDIR} -p1 \ + < portage/${PKG_SUBDIR}.midipix.patch; + if [ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ]; then + cp portage/libtool.midipix ${PKG_SUBDIR}/; fi; set_build_script_done patched -configured; fi; if ! is_build_script_done configured; then - rm_if_exists -m -c ${_build_dir}; - ../${_pkg_subdir}/configure \ - ${_pkg_configure_extra_args} \ + rm_if_exists -m -c ${BUILD_DIR}; + ../${PKG_SUBDIR}/configure \ + ${PKG_CONFIGURE_EXTRA_ARGS} \ --host=${HOST_NATIVE} \ - --prefix=${_pkg_prefix:-/} \ + --prefix=${PKG_PREFIX:-/} \ --target=${TARGET}; set_build_script_done configured -built; else - cd ${_build_dir}; + cd ${BUILD_DIR}; fi; if ! is_build_script_done built; then make; @@ -37,12 +37,12 @@ if ! is_build_script_done installed1; then make DESTDIR=${PREFIX_NATIVE} install; set_build_script_done configured installed1 -installed2 -finished; fi; -if [ -n "${_pkg_prefix_extra}" ]; then +if [ -n "${PKG_PREFIX_EXTRA}" ]; then if ! is_build_script_done installed2; then - make DESTDIR=${_pkg_prefix_extra} install; + make DESTDIR=${PKG_PREFIX_EXTRA} install; set_build_script_done configured installed2 -finished; fi; -elif [ "x${_pkg_name}" = "xlibelf" ]; then +elif [ "x${PKG_NAME}" = "xlibelf" ]; then if ! is_build_script_done installed2; then rm -f lib/libelf.def; echo EXPORTS > lib/libelf.def; diff --git a/200.coreutils.build b/200.coreutils.build index a0c72ef..844f90b 100644 --- a/200.coreutils.build +++ b/200.coreutils.build @@ -4,46 +4,47 @@ parse_with_pkg_name ${2} \ if is_build_script_done finished; then exit 212; else - fetch ${_pkg_url} ${_pkg_sha256sum}; - if [ "x${_pkg_name}" = "xbinutils" ]\ + fetch ${PKG_URL} ${PKG_SHA256SUM}; + if [ "x${PKG_NAME}" = "xbinutils" ]\ && [ "x${3}" = "xhost" ]; then - _no_config_cache=1; _no_destdir=1; + _no_config_cache=$(_no_destdir:=1); _configure_args="--disable-werror --prefix=${PREFIX} --with-sysroot=${PREFIX_TARGET}"; - set_build_dir ${_pkg_subdir} cross; + set_build_dir ${PKG_SUBDIR} cross; else + _no_config_cache=$(_no_destdir:=1); _configure_args="-C --host=${HOST_NATIVE} --prefix="; - set_build_dir ${_pkg_subdir} native; + set_build_dir ${PKG_SUBDIR} native; fi; - _configure_args="${_configure_args}${_pkg_configure_extra_args:+ ${_pkg_configure_extra_args}}"; + _configure_args="${_configure_args}${PKG_CONFIGURE_EXTRA_ARGS:+ ${PKG_CONFIGURE_EXTRA_ARGS}}"; fi; if ! is_build_script_done extracted; then - rm_if_exists ${_pkg_subdir}; - tar -axf ${_pkg_fname}; + rm_if_exists ${PKG_SUBDIR}; + tar -axf ${PKG_FNAME}; set_build_script_done extracted -patched; fi; if ! is_build_script_done patched; then - if [ -n "${_pkg_patches_extra}" ]; then - (rm_if_exists -m -c ${_pkg_subdir}-patches-extra; - wget -c -nd -np -r -R \*.htm\* ${_pkg_patches_extra} + if [ -n "${PKG_PATCHES_EXTRA}" ]; then + (rm_if_exists -m -c ${PKG_SUBDIR}-patches-extra; + wget -c -nd -np -r -R \*.htm\* ${PKG_PATCHES_EXTRA} for _patch_fname in \ $(find . -type f -not -iname \*.sig | sort); do - patch -d ../${_pkg_subdir} -p0 \ + patch -d ../${PKG_SUBDIR} -p0 \ < ${_patch_fname}; done); wait; fi; - patch -d ${_pkg_subdir} -p1 \ - < portage/${_pkg_subdir}.midipix.patch; + patch -d ${PKG_SUBDIR} -p1 \ + < portage/${PKG_SUBDIR}.midipix.patch; set_build_script_done patched -configured; fi; if ! is_build_script_done configured; then - rm_if_exists -m -c ${_build_dir}; + rm_if_exists -m -c ${BUILD_DIR}; [ ${_no_config_cache:-0} -eq 0 ] &&\ cp ../portage/config.cache .; - ../${_pkg_subdir}/configure \ + ../${PKG_SUBDIR}/configure \ ${_configure_args} --target=${TARGET}; set_build_script_done configured -built; else - cd ${_build_dir}; + cd ${BUILD_DIR}; fi; if ! is_build_script_done built; then make ${MAKEFLAGS}; diff --git a/207.libz.build b/207.libz.build index 507018d..a6f48d5 100644 --- a/207.libz.build +++ b/207.libz.build @@ -2,24 +2,24 @@ parse_with_pkg_name ${2} libz gzip; if is_build_script_done finished; then exit 212; else - fetch ${_pkg_url} ${_pkg_sha256sum}; + fetch ${PKG_URL} ${PKG_SHA256SUM}; fi; if ! is_build_script_done extracted; then - rm_if_exists ${_pkg_fname%%.tar*}; - tar -axf ${_pkg_fname}; + rm_if_exists ${PKG_FNAME%%.tar*}; + tar -axf ${PKG_FNAME}; set_build_script_done extracted -configured; fi; if ! is_build_script_done configured; then - set_build_dir ${_pkg_fname%%-*} native; - rm_if_exists -c -m ${_build_dir}; + set_build_dir ${PKG_FNAME%%-*} native; + rm_if_exists -c -m ${BUILD_DIR}; cp ../portage/config.cache .; - ../${_pkg_subdir}/configure \ + ../${PKG_SUBDIR}/configure \ --host=${HOST_NATIVE} \ --prefix= \ --target=${TARGET}; set_build_script_done configured -built; else - cd ${_build_dir}; + cd ${BUILD_DIR}; fi; if ! is_build_script_done built; then if [ "x${2}" = "xlibz" ]; then diff --git a/build.sh b/build.sh index f0c12a1..f027084 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ check_prereqs git make openssl sed sort tar tr wget; log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE:=$(date %Y-%m-%d-%H-%M-%S)}."; #trap (set -o errexit; mkdir -p ${PREFIX} ${WORKDIR}); -BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${_nbuild:=0}}}; +BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}}; for BUILD_LVL in 0 1 2; do for BUILD_SCRIPT_FNAME in ${BUILD_LVL}[0-9][0-9].*.build; do if [ -n "${DEBUG_SCRIPT}" ]\ @@ -17,7 +17,7 @@ for BUILD_LVL in 0 1 2; do elif [ ! -f ${BUILD_SCRIPT_FNAME} ]; then continue; else - unset BUILD_SCRIPT_RC; : $((_nbuild+=1)); + unset BUILD_SCRIPT_RC; : $((BUILD_NBUILT+=1)); log_msg info "Invoking build script \`${BUILD_SCRIPT_FNAME}'"; (set -o errexit -- $(split . ${BUILD_SCRIPT_FNAME%.build}); \ SCRIPT_FNAME=${BUILD_SCRIPT_FNAME}; _pwd=$(pwd); \ @@ -38,7 +38,7 @@ for BUILD_LVL in 0 1 2; do break; fi; done; -log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${_nbuild} build script(s)."; +log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s)."; if [ $(( ${BUILD_NFINI} + ${BUILD_NSKIP} )) -ge 0 ]\ && [ ${BUILD_NFAIL} -eq 0 ]; then log_msg info "Building distribution tarball."; @@ -59,7 +59,7 @@ if [ $(( ${BUILD_NFINI} + ${BUILD_NSKIP} )) -ge 0 ]\ -not -path ./${PREFIX_NATIVE##*/}/lib.bak |\ tar -T - -cpf - | bzip2 -9c - > ${DISTRIB_FNAME} rm -rf ${PREFIX_NATIVE##*/}/lib; - mv ${PREFIX_NATIVE##*/}/lib.bak ${PREFIX_NATIVE##*/}/lib); + mv ${PREFIX_NATIVE##*/}/lib.bak ${PREFIX_NATIVE##*/}/lib); wait; fi; exit ${BUILD_SCRIPT_RC}; } 2>&1 | tee build.log; diff --git a/build.subr b/build.subr index ab829f7..f07e297 100644 --- a/build.subr +++ b/build.subr @@ -104,15 +104,21 @@ parse_with_pkg_name() { CC CFLAGS LDFLAGS DESTDIR; do _vNAME=$(echo "${_vname}" | tr a-z A-Z); if [ -n "${_vval:=$(eval echo \${PKG_${_pkg_NAME}_${_vNAME}})}" ]; then - export _pkg_${_vname}="${_vval}"; + export PKG_${_vNAME}="${_vval}"; if [ "x${_vname#[A-Z]}" != "x${_vname}" ]; then export ${_vname}="${_vval}"; fi; + else + unset PKG_${_vNAME}; fi; unset _vval; done; unset _pkg_NAME _vname _vNAME; - _pkg_fname=${_pkg_url##*/}; - _pkg_subdir=${_pkg_fname%%.tar*}; - return 0; + if [ -z "${PKG_URL}" ]; then + return 1; + else + PKG_FNAME=${PKG_URL##*/}; + PKG_SUBDIR=${PKG_FNAME%%.tar*}; + return 0; + fi; fi; shift; done; return 1; }; @@ -133,7 +139,7 @@ rm_if_exists() { }; set_build_dir() { - _build_dir=${1}-${2}-${TARGET}; + BUILD_DIR=${1}-${2}-${TARGET}; }; set_env_vars() {