From bd6eba4b100a068999822f1c54933adf55fa75e9 Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Feb 03 2017 03:52:55 +0000 Subject: build.sh: create dirs/symlinks via install_files(). subr/{pkg_install,rtl}.subr: moved pkgp_install_files() to rtl.subr. --- diff --git a/build.sh b/build.sh index 8992c5a..196e634 100755 --- a/build.sh +++ b/build.sh @@ -118,34 +118,23 @@ if [ ${ARG_CLEAN:-0} -eq 1 ]; then fi; done; fi; -insecure_mkdir ${PREFIX} ${PREFIX}/x86_64-w64-mingw32 ${PREFIX_NATIVE} ${PREFIX_CROSS} ${PREFIX_TARGET}/lib ${DLCACHEDIR} ${WORKDIR}; -for __ in ${PREFIX}/usr ${PREFIX_NATIVE}/usr; do - if [ ! -L "${__}" ]; then - secure_rm "${__}"; ln -sf -- . "${__}"; - fi; -done; -if [ ! -L ${PREFIX}/x86_64-w64-mingw32/mingw ]; then - secure_rm ${PREFIX}/x86_64-w64-mingw32/mingw; - ln -sf . ${PREFIX}/x86_64-w64-mingw32/mingw; -fi; -if [ ! -d ${PREFIX}/x86_64-w64-mingw32/mingw/include ]; then - secure_rm ${PREFIX}/x86_64-w64-mingw32/mingw/include; - insecure_mkdir ${PREFIX}/x86_64-w64-mingw32/mingw/include; -fi; -if [ ! -L ${PREFIX}/man ]; then - secure_rm ${PREFIX}/man; - ln -sf share/man ${PREFIX}/man; -fi; -if [ ! -L ${PREFIX_NATIVE}/man ]; then - secure_rm ${PREFIX_NATIVE}/man; - ln -sf share/man ${PREFIX_NATIVE}/man; -fi; -insecure_mkdir ${PREFIX_MINIPIX}/bin; -for __ in lib libexec share; do - if [ ! -e ${PREFIX_MINIPIX}/${__} ]; then - ln -sf bin ${PREFIX_MINIPIX}/${__}; - fi; -done; +install_files \ + /=${DLCACHEDIR} \ + /=${WORKDIR} \ + /=${PREFIX} \ + /=${PREFIX}/x86_64-w64-mingw32/mingw/include \ + /=${PREFIX_CROSS} \ + /=${PREFIX_MINIPIX}/bin \ + /=${PREFIX_NATIVE} \ + /=${PREFIX_TARGET}/lib \ + @.=${PREFIX}/usr \ + @.=${PREFIX}/x86_64-w64-mingw32/mingw \ + @.=${PREFIX_NATIVE}/usr \ + @bin=${PREFIX_MINIPIX}/lib \ + @bin=${PREFIX_MINIPIX}/libexec \ + @bin=${PREFIX_MINIPIX}/share \ + @share/man=${PREFIX}/man \ + @share/man=${PREFIX_NATIVE}/man; if [ -e ${BUILD_LOG_FNAME} ]; then mv -- ${BUILD_LOG_FNAME} ${BUILD_LOG_LAST_FNAME}; fi; diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index ddd6230..7389833 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -11,33 +11,6 @@ pkgp_install_clean_lib() { fi; }; -pkgp_install_files() { - if [ -n "${PKG_INSTALL_FILES}" ]; then - (set -- ${PKG_INSTALL_FILES}; - while [ ${#} -gt 0 ]; do - case "${1}" in - @*=*) - __ln_target="${1%=*}"; - __ln_target="${__ln_target#@}"; - __ln_fname="${1#*=}"; - echo ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname}; - ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname}; - ;; - /=*) - __mkdir_fname="${1#/=}"; - insecure_mkdir ${PKG_PREFIX}/${__mkdir_fname}; - ;; - *) - __file_fname_src="${1%=*}"; - __file_fname_dst="${1#*=}"; - echo cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst}; - cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst}; - ;; - esac; shift; - done); - fi; -}; - pkgp_install_dlltool() { if [ "${PKG_BUILD_TYPE}" != "host" ] \ && test_cmd perk \ @@ -97,7 +70,9 @@ pkg_install() { pkg_${PKG_NAME}_install_post; fi; pkgp_install_clean_lib; - pkgp_install_files; + if [ -n "${PKG_INSTALL_FILES}" ]; then + (install_files -v ${PKG_INSTALL_FILES}); + fi; pkgp_install_dlltool; set_build_script_done install -finish; }; diff --git a/subr/rtl.subr b/subr/rtl.subr index be3efa4..90faa3c 100644 --- a/subr/rtl.subr +++ b/subr/rtl.subr @@ -55,6 +55,46 @@ insecure_mkdir() { done; }; +install_files() { + if [ "${1}" = "-v" ]; then + _if_verbose="${1}"; shift; + fi; + while [ ${#} -gt 0 ]; do + case "${1}" in + @*=*) + __ln_target="${1%=*}"; + __ln_target="${__ln_target#@}"; + __ln_fname="${1#*=}"; + if [ -e ${__ln_fname} ]; then + if [ ${_if_verbose:-0} -eq 1 ]; then + echo secure_rm ${__ln_fname}; + fi; + secure_rm ${__ln_fname}; + fi; + if [ ${_if_verbose:-0} -eq 1 ]; then + echo ln -sf -- ${__ln_target} ${PKG_PREFIX:+${PKG_PREFIX}/}${__ln_fname}; + fi; + ln -sf -- ${__ln_target} ${PKG_PREFIX:+${PKG_PREFIX}/}${__ln_fname}; + ;; + /=*) + __mkdir_fname="${1#/=}"; + if [ ${_if_verbose:-0} -eq 1 ]; then + echo insecure_mkdir ${PKG_PREFIX:+${PKG_PREFIX}/}${__mkdir_fname}; + fi; + insecure_mkdir ${PKG_PREFIX:+${PKG_PREFIX}/}${__mkdir_fname}; + ;; + *) + __file_fname_src="${1%=*}"; + __file_fname_dst="${1#*=}"; + if [ ${_if_verbose:-0} -eq 1 ]; then + echo cp -pP -- ${__file_fname_src} ${PKG_PREFIX:+${PKG_PREFIX}/}${__file_fname_dst}; + fi; + cp -pP -- ${__file_fname_src} ${PKG_PREFIX:+${PKG_PREFIX}/}${__file_fname_dst}; + ;; + esac; shift; + done; unset _if_verbose; +}; + match_list() { _ml_cmp="${3}"; push_IFS "${2}"; set -- ${1}; pop_IFS; while [ ${#} -gt 0 ]; do