From f9c3864711d0de4e7305e3509d339f0713efa859 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Feb 08 2016 14:23:11 +0000 Subject: - Explicitly pass {C,LD}FLAGS_PATH to the runtime (ntapi, psxscl, etc.) build scripts; everything now goes into $PREFIX_NATIVE except for the cross compiler and its dependencies, which go into $PREFIX_TARGET. - Replaced specific PREFIX variables w/ generic per-build level CFLAGS. - Merged 204.psxscl.build into pkg.build. - Generalised patching procedure into build.subr. --- diff --git a/003.psxstub.build b/003.psxstub.build index 81eb8ed..535c008 100644 --- a/003.psxstub.build +++ b/003.psxstub.build @@ -3,7 +3,7 @@ if is_build_script_done finished; then elif [ "x${TARGET}" = "xi686-nt32-midipix" ]\ || [ "x${TARGET}" = "xx86_64-nt64-midipix" ]; then cd psxstub; - make ${MAKEFLAGS} DESTDIR=${PREFIX_TARGET} TARGET=${TARGET} install; + make ${MAKEFLAGS} DESTDIR=${PREFIX_LVL} TARGET=${TARGET} install; set_build_script_done finished; fi; diff --git a/006.musl.build b/006.musl.build index 6713a1f..d34f5b0 100644 --- a/006.musl.build +++ b/006.musl.build @@ -4,7 +4,6 @@ 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 \ @@ -17,31 +16,29 @@ elif [ "x${3}" = "xno-complex" ]; then fi; elif [ "x${3}" = "xnative" ]; then # Musl: build (full) - _destdir=${PREFIX_NATIVE}; _install=install; 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}; - ../lazy/lazy \ - -a ${ARCH} \ - -c gcc \ - -f ${_destdir:-${PREFIX_TARGET}} \ - -n musl \ - -p ../musl-${PKG_MUSL_VERSION} \ - -t ${lz_target} \ + ../lazy/lazy \ + -a ${ARCH} \ + -c gcc \ + -f ${PREFIX_LVL} \ + -n musl \ + -p ../musl-${PKG_MUSL_VERSION} \ + -t ${lz_target} \ -x config; set_build_script_done configured -built; else cd ${BUILD_DIR}; fi; if ! is_build_script_done built; then - ./lazy -e ${_install} \ + ./lazy -e ${_install} \ -x build; set_build_script_done built finished; fi; diff --git a/007.gcc.full.build b/007.gcc.full.build index 8935644..73eccbb 100644 --- a/007.gcc.full.build +++ b/007.gcc.full.build @@ -39,20 +39,20 @@ else if [ "x${3}" = "xstage1" ]; then # GCC, stage1. set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross; - export cbb_ldflags_for_target=--sysroot=${PREFIX_TARGET} \ - cbb_sysroot_for_libgcc=${PREFIX_TARGET} \ - cbb_target=${TARGET} \ - cbb_neutral_libiberty=no \ + export cbb_ldflags_for_target=--sysroot=${PREFIX_LVL} \ + cbb_sysroot_for_libgcc=${PREFIX_LVL} \ + cbb_target=${TARGET} \ + cbb_neutral_libiberty=no \ cbb_xgcc_for_specs=${WORKDIR}/${BUILD_DIR}/gcc/xgcc; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_TARGET}"; + GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_LVL}"; elif [ "x${3}" = "xnative" ]; then # GCC, native. set_build_dir cbb-gcc-${PKG_GCC_VERSION} native; - export cbb_ldflags_for_target=--sysroot=${PREFIX_NATIVE} \ - cbb_sysroot_for_libgcc=${PREFIX_NATIVE} \ - cbb_target=${TARGET} \ + export cbb_ldflags_for_target=--sysroot=${PREFIX_LVL} \ + cbb_sysroot_for_libgcc=${PREFIX_LVL} \ + cbb_target=${TARGET} \ cbb_xgcc_for_specs=${TARGET}-gcc; - GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_NATIVE}"; + GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_LVL}"; fi; GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)"; set_env_vars "${GCCFLAGS}" CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; @@ -61,22 +61,22 @@ else export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET; if ! is_build_script_done configured; then if [ "x${3}" = "xstage1" ]; then - mkdir -p ${PREFIX_TARGET}/include; - [ \! -d ${PREFIX_TARGET}/usr ] && \ - ln -s . ${PREFIX_TARGET}/usr; - _configure_args="--prefix=${PREFIX} --with-sysroot=${PREFIX_TARGET}"; + mkdir -p ${PREFIX_LVL}/include; + [ \! -d ${PREFIX_LVL}/usr ] && \ + ln -s . ${PREFIX_LVL}/usr; + _configure_args="--prefix=${PREFIX} --with-sysroot=${PREFIX_LVL}"; elif [ "x${3}" = "xnative" ]; then - mkdir -p ${PREFIX_NATIVE}/${TARGET}; - if [ \! -d ${PREFIX_NATIVE}/${TARGET}/usr ]; then - ln -s . ${PREFIX_NATIVE}/${TARGET}/usr; + mkdir -p ${PREFIX_LVL}/${TARGET}; + if [ \! -d ${PREFIX_LVL}/${TARGET}/usr ]; then + ln -s . ${PREFIX_LVL}/${TARGET}/usr; fi; _configure_args=" \ --host=x86_64-nt64-midipix \ --prefix=/ \ - --with-elf=${PREFIX_NATIVE} \ - --with-gmp=${PREFIX_NATIVE} \ - --with-mpc=${PREFIX_NATIVE} \ - --with-mpfr=${PREFIX_NATIVE} \ + --with-elf=${PREFIX_LVL} \ + --with-gmp=${PREFIX_LVL} \ + --with-mpc=${PREFIX_LVL} \ + --with-mpfr=${PREFIX_LVL} \ --with-sysroot="; fi; rm_if_exists -m -c ${BUILD_DIR}; @@ -123,7 +123,7 @@ else if [ "x${3}" = "xstage1" ]; then make ${MAKEFLAGS} install-gcc; elif [ "x${3}" = "xnative" ]; then - make -j18 DESTDIR=${PREFIX_NATIVE} install; + make -j18 DESTDIR=${PREFIX_LVL} install; fi; set_build_script_done installed finished; fi; diff --git a/100.perk.build b/100.perk.build index ed05e92..dd9d9c8 100644 --- a/100.perk.build +++ b/100.perk.build @@ -32,7 +32,7 @@ if ! is_build_script_done built2; then set_build_script_done built2 -installed2; fi; if ! is_build_script_done installed2; then - make DESTDIR=${PREFIX_NATIVE} install; + make DESTDIR=${PREFIX_LVL} install; set_build_script_done installed2 finished; fi; diff --git a/200.psxtypes.build b/200.psxtypes.build index 44d6668..52bb82e 120000 --- a/200.psxtypes.build +++ b/200.psxtypes.build @@ -1 +1 @@ -204.psxscl.build \ No newline at end of file +pkg.build \ No newline at end of file diff --git a/200.psxtypes.vars b/200.psxtypes.vars new file mode 100644 index 0000000..493d9c1 --- /dev/null +++ b/200.psxtypes.vars @@ -0,0 +1,8 @@ +pkg_psxtypes_finish() { + if ! is_build_script_done installed; then + make -C ${PKG_SUBDIR} ${MAKEFLAGS} DESTDIR=${PREFIX_LVL}; + set_build_script_done installed finished; + fi; +}; + +# vim:filetype=sh diff --git a/201.pemagine.build b/201.pemagine.build index 44d6668..52bb82e 120000 --- a/201.pemagine.build +++ b/201.pemagine.build @@ -1 +1 @@ -204.psxscl.build \ No newline at end of file +pkg.build \ No newline at end of file diff --git a/202.dalist.build b/202.dalist.build index 44d6668..52bb82e 120000 --- a/202.dalist.build +++ b/202.dalist.build @@ -1 +1 @@ -204.psxscl.build \ No newline at end of file +pkg.build \ No newline at end of file diff --git a/203.ntapi.build b/203.ntapi.build index 44d6668..52bb82e 120000 --- a/203.ntapi.build +++ b/203.ntapi.build @@ -1 +1 @@ -204.psxscl.build \ No newline at end of file +pkg.build \ No newline at end of file diff --git a/204.psxscl.build b/204.psxscl.build deleted file mode 100644 index 7202d1a..0000000 --- a/204.psxscl.build +++ /dev/null @@ -1,37 +0,0 @@ -# Order: psxtypes pemagine dalist ntapi psxscl ntcon ntctty - -parse_with_pkg_name ${2} \ - dalist ntapi ntcon ntctty pemagine psxscl psxtypes; -if is_build_script_done finished; then - exit 212; -else - fetch_git ${PKG_SUBDIR} ${PKG_URL}; - set_build_dir ${PKG_SUBDIR} cross; -fi; -if [ "x${PKG_NAME}" = "xpsxtypes" ]; then - if ! is_build_script_done installed; then - make -C ${PKG_SUBDIR} ${MAKEFLAGS} DESTDIR=${PREFIX_TARGET}; - set_build_script_done installed finished; - fi; -else - if ! is_build_script_done configured; then - rm_if_exists -m -c ${BUILD_DIR}; - ../${PKG_SUBDIR}/configure \ - --prefix=${PREFIX_TARGET} \ - --host=${HOST_NATIVE}; - set_build_script_done configured -built; - else - cd ${BUILD_DIR}; - fi; - if ! is_build_script_done built; then - make ${MAKEFLAGS}; - set_build_script_done built -installed; - fi; - if ! is_build_script_done installed; then - make ${MAKEFLAGS} install; - make ${MAKEFLAGS} DESTDIR=${PREFIX_TARGET}; - set_build_script_done installed finished; - fi; -fi; - -# vim:filetype=sh diff --git a/204.psxscl.build b/204.psxscl.build new file mode 120000 index 0000000..52bb82e --- /dev/null +++ b/204.psxscl.build @@ -0,0 +1 @@ +pkg.build \ No newline at end of file diff --git a/205.ntcon.build b/205.ntcon.build index 44d6668..52bb82e 120000 --- a/205.ntcon.build +++ b/205.ntcon.build @@ -1 +1 @@ -204.psxscl.build \ No newline at end of file +pkg.build \ No newline at end of file diff --git a/206.ntctty.build b/206.ntctty.build index 44d6668..52bb82e 120000 --- a/206.ntctty.build +++ b/206.ntctty.build @@ -1 +1 @@ -204.psxscl.build \ No newline at end of file +pkg.build \ No newline at end of file diff --git a/306.libz.build b/306.libz.build index a6f48d5..a1678bf 100644 --- a/306.libz.build +++ b/306.libz.build @@ -32,9 +32,9 @@ if ! is_build_script_done built; then fi; if ! is_build_script_done installed; then if [ "x${2}" = "xlibz" ]; then - make -j18 DESTDIR=${PREFIX_NATIVE} install; + make -j18 DESTDIR=${PREFIX_LVL} install; elif [ "x${2}" = "xgzip" ]; then - cp gunzip gzip zcat ${PREFIX_NATIVE}/bin; + cp gunzip gzip zcat ${PREFIX_LVL}/bin; fi; set_build_script_done installed finished; fi; diff --git a/build.sh b/build.sh index 6808e44..eb21970 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,7 @@ #!/bin/sh { +#clear_env_with_except HOME PATH SHELL TERM USER; unset AR ARFLAGS CC CFLAGS CXX CXXFLAGS LD LDFLAGS; . ./build.vars; . ./build.subr; check_path_vars PREFIX PREFIX_NATIVE WORKDIR; @@ -24,6 +25,7 @@ for BUILD_LVL in 0 1 2 3; do (set -o errexit -- $(split . ${BUILD_SCRIPT_FNAME%.build}); \ SCRIPT_FNAME=${BUILD_SCRIPT_FNAME}; _pwd=$(pwd); \ export CFLAGS="$(eval echo \${CFLAGS_LVL${BUILD_LVL}})"; \ + export PREFIX_LVL="$(eval echo \${PREFIX_LVL${BUILD_LVL}})"; \ cd ${WORKDIR}; . ${_pwd}/build.subr; \ [ -f ${_pwd}/${SCRIPT_FNAME%.build}.vars ] && \ . ${_pwd}/${SCRIPT_FNAME%.build}.vars; \ diff --git a/build.subr b/build.subr index 1c1e798..4788283 100644 --- a/build.subr +++ b/build.subr @@ -4,6 +4,16 @@ TIMESTAMP_FMT="${TIMESTAMP_FMT:-"%Y/%m/%d %H:%M:%S"}"; +apply_patches() { + (rm_if_exists -m -c ${2}; + wget -c -nd -np -r -R \*.htm\* -R \*.sig ${1}; + for _patch_fname in \ + $(find . -type f -not -iname \*.sig | sort); do + patch -d ../${PKG_SUBDIR} -p0 \ + < ${_patch_fname}; + done; unset _patch_fname); +}; + check_path_vars() { while [ $# -gt 0 ]; do if [ -z "${_val:=$(eval echo \${${1}})}" ]; then @@ -52,6 +62,16 @@ compare_hash() { shift $((${#}-1)); set -- ${1} ${_hash_cmp}; unset _hash_cmp; [ "x${1}" = "x${2}" ]; }; +compare_hash_manifest() { + while [ $# -gt 0 ]; do + if ! compare_hash ${1} ${2}; then + log_msg fail "Error: hash mismatch for patch file \`${1}'."; + exit 1; + else + shift; + fi; + done; return 0; +}; is_build_script_done() { _script_fname=${SCRIPT_FNAME##*/}; @@ -100,7 +120,7 @@ parse_with_pkg_name() { for _vname in \ build_type configure_args configure_extra_args \ no_config_cache no_destdir no_libtool_midipix \ - patches_extra prefix prefix_extra sha256sum \ + patches_extra_url prefix prefix_extra sha256sum \ url version \ CC CFLAGS LDFLAGS; do _vNAME=$(echo "${_vname}" | tr a-z A-Z); diff --git a/build.vars b/build.vars index f4f0bd9..2c6fca1 100644 --- a/build.vars +++ b/build.vars @@ -23,6 +23,10 @@ : ${PREFIX_NATIVE:=${PREFIX}/native}; : ${TARGET:=x86_64-nt64-midipix}; : ${PREFIX_TARGET:=${PREFIX}/${TARGET}}; +: ${PREFIX_LVL0:=${PREFIX_TARGET}}; +: ${PREFIX_LVL1:=${PREFIX_NATIVE}}; +: ${PREFIX_LVL2:=${PREFIX_NATIVE}}; +: ${PREFIX_LVL3:=${PREFIX_NATIVE}}; : ${WORKDIR:=${PREFIX}/tmp}; MAKEFLAGS="-j8${MAKEFLAGS:+ ${MAKEFLAGS}}"; export PATH="${PREFIX}/bin${PATH:+:${PATH}}"; @@ -31,14 +35,14 @@ TIMESTAMP_FMT="%Y/%m/%d %H:%M:%S"; : ${PKG_BASH_CONFIGURE_EXTRA_ARGS:=--without-bash-malloc}; : ${PKG_BASH_SHA256SUM:=afc687a28e0e24dc21b988fa159ff9dbcf6b7caa92ade8645cc6d5605cd024d4}; : ${PKG_BASH_VERSION:=4.3}; -: ${PKG_BASH_PATCHES_EXTRA:=https://ftp.gnu.org/gnu/bash/bash-${PKG_BASH_VERSION}-patches/}; +: ${PKG_BASH_PATCHES_EXTRA_URL:=https://ftp.gnu.org/gnu/bash/bash-${PKG_BASH_VERSION}-patches/}; : ${PKG_BASH_URL:=https://ftp.gnu.org/gnu/bash/bash-${PKG_BASH_VERSION}.tar.gz}; : ${PKG_BINUTILS_CONFIGURE_EXTRA_ARGS:=--with-libelf=${PREFIX_NATIVE} --with-gmp=${PREFIX_NATIVE} --with-mpc=${PREFIX_NATIVE} --with-mpfr=${PREFIX_NATIVE} --with-sysroot=/}; : ${PKG_BINUTILS_SHA256SUM:=250d3b2925c6b211fb16173b0b25bc091c58829fbcad3eb849645e0af52cf7fa}; : ${PKG_BINUTILS_VERSION:=2.24.51}; : ${PKG_BINUTILS_URL:=ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_VERSION}.tar.bz2}; : ${PKG_BINUTILS_HOST_BUILD_TYPE:=cross}; -: ${PKG_BINUTILS_HOST_CONFIGURE_ARGS:=--disable-werror --prefix=${PREFIX} --with-sysroot=${PREFIX_TARGET}}; +: ${PKG_BINUTILS_HOST_CONFIGURE_ARGS:=--disable-werror --prefix=${PREFIX} --target=${TARGET} --with-sysroot=${PREFIX_TARGET}}; : ${PKG_BINUTILS_HOST_NO_DESTDIR:=1}; : ${PKG_BINUTILS_HOST_NO_CONFIG_CACHE:=1}; : ${PKG_BINUTILS_HOST_NO_LIBTOOL_MIDIPIX:=1}; diff --git a/pkg.build b/pkg.build index e32c531..5f46a48 100644 --- a/pkg.build +++ b/pkg.build @@ -1,58 +1,59 @@ +# Order for build level 2 (runtime:) psxtypes pemagine dalist ntapi psxscl ntcon ntctty + parse_with_pkg_name ${2} \ - bash binutils binutils_host coreutils diffutils \ - findutils gawk gmp grep libelf make mpc mpfr \ - patch sed; + bash binutils binutils_host coreutils dalist \ + diffutils findutils gawk gmp grep libelf make \ + mpc mpfr ntapi ntcon ntctty patch pemagine \ + psxscl psxtypes sed; if is_build_script_done finished; then exit 212; else - fetch ${PKG_URL} ${PKG_SHA256SUM}; - if [ "x${SCRIPT_FNAME%[0-9][0-9]*}" = "x1" ]; then - _configure_args="--host=${HOST_NATIVE} --prefix=${PKG_PREFIX:-/}"; - PKG_NO_CONFIG_CACHE=1; + case "${SCRIPT_FNAME%[0-9][0-9]*}" in + 1) _configure_args="--host=${HOST_NATIVE} --prefix=${PKG_PREFIX:-/} --target=${TARGET}"; + PKG_NO_CONFIG_CACHE=1; ;; + 2) + _configure_args="--prefix=${PREFIX_LVL} --host=${HOST_NATIVE}"; + PKG_BUILD_TYPE=cross; PKG_URL_TYPE=git; + PKG_NO_CONFIG_CACHE=${PKG_NO_DESTDIR:=${PKG_NO_EXTRACT:=${PKG_NO_PATCH:=1}}}; + export CFLAGS_PATH=-I${PREFIX_LVL}/include; + export LDFLAGS_PATH=-L${PREFIX_LVL}/lib; ;; + *) _configure_args=${PKG_CONFIGURE_ARGS:--C --host=${HOST_NATIVE} --prefix= --target=${TARGET}}; ;; + esac; + if [ "x${PKG_URL_TYPE:-wget}" = "xwget" ]; then + fetch ${PKG_URL} ${PKG_SHA256SUM}; else - _configure_args=${PKG_CONFIGURE_ARGS:--C --host=${HOST_NATIVE} --prefix=}; - fi; - if [ ${PKG_NO_DESTDIR:-0} -eq 0 ]; then - : ${DESTDIR:=${PREFIX_NATIVE}}; + fetch_git ${PKG_SUBDIR} ${PKG_URL}; fi; set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native}; fi; -if ! is_build_script_done extracted; then +if command -v pkg_${PKG_NAME}_finish >/dev/null; then + pkg_${PKG_NAME}_finish; exit 0; +elif [ ${PKG_NO_EXTRACT:-0} -eq 0 ] &&\ +! is_build_script_done extracted; then 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\* -R \*.sig ${PKG_PATCHES_EXTRA} - for _patch_fname in \ - $(find . -type f -not -iname \*.sig | sort); do - patch -d ../${PKG_SUBDIR} -p0 \ - < ${_patch_fname}; - done; - for _patch_fname in ${PKG_PATCHES_EXTRA_MANIFEST}; do - _patch_sha256sum=${2}; shift; - if ! compare_hash ${_patch_fname} ${_patch_sha256sum}; then - log_msg fail "Error: hash mismatch for patch file \`${_patch_fname}'."; - exit 1; - fi; - done); wait; +if [ ${PKG_NO_PATCH:-0} -eq 0 ] &&\ +! is_build_script_done patched; then + if [ -n "${PKG_PATCHES_EXTRA_URL}" ]; then + apply_patches ${PKG_PATCHES_EXTRA_URL} ${PKG_SUBDIR}-patches-extra; + if [ -n "${PKG_PATCHES_EXTRA_MANIFEST}" ]; then + compare_hash_manifest ${PKG_PATCHES_EXTRA_MANIFEST}; + fi; fi; patch -d ${PKG_SUBDIR} -p1 \ < portage/${PKG_SUBDIR}.midipix.patch; - if [ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ]; then + [ ${PKG_NO_CONFIG_CACHE:-0} -eq 0 ] &&\ + cp ../portage/config.cache .; + [ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ] && \ 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_NO_CONFIG_CACHE:-0} -eq 0 ] &&\ - cp ../portage/config.cache .; ../${PKG_SUBDIR}/configure \ ${_configure_args} \ - --target=${TARGET} \ ${PKG_CONFIGURE_EXTRA_ARGS}; set_build_script_done configured -built; else @@ -63,15 +64,22 @@ if ! is_build_script_done built; then set_build_script_done built -installed; fi; if ! is_build_script_done installed1; then - make ${MAKEFLAGS} ${DESTDIR:+DESTDIR=${DESTDIR}} install; + if [ ${PKG_NO_DESTDIR:-0} -eq 0 ]; then + make ${MAKEFLAGS} DESTDIR=${PREFIX_LVL} install; + else + make ${MAKEFLAGS} install; + fi; set_build_script_done installed1 -installed2 -finished; fi; -if [ -n "${PKG_PREFIX_EXTRA}" ]\ -&& ! is_build_script_done installed2; then - make DESTDIR=${PKG_PREFIX_EXTRA} install; - set_build_script_done installed2 -finished; -elif command -v pkg_${PKG_NAME}_install_post >/dev/null; then - pkg_${PKG_NAME}_install_post; +if ! is_build_script_done installed2; then + [ -n "${PKG_PREFIX_EXTRA}" ] &&\ + make DESTDIR=${PKG_PREFIX_EXTRA} install; + set_build_script_done installed2 -installed3 -finished; +fi; +if ! is_build_script_done installed3; then + command -v pkg_${PKG_NAME}_install_post \ + >/dev/null && pkg_${PKG_NAME}_install_post; + set_build_script_done installed3 -finished; fi; set_build_script_done finished;