diff options
author | Lucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de> | 2017-11-19 01:12:10 +0000 |
---|---|---|
committer | Lucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de> | 2017-11-19 01:12:10 +0000 |
commit | 48fd1448870357a4f9eadb7086b4b4f7d0590fdd (patch) | |
tree | 73010fab2b20aa21a1593feffb33a28a69ec5379 /subr | |
parent | d70de2ba01b1b791d7303944cba4e2b6853ba29f (diff) | |
download | midipix_build-48fd1448870357a4f9eadb7086b4b4f7d0590fdd.tar.bz2 midipix_build-48fd1448870357a4f9eadb7086b4b4f7d0590fdd.tar.xz |
subr/pkg_install.subr:pkgp_install_dlltool(): va-yehi ken.
subr/build.subr:build_fileop(): include -L when testing pathnames for existence.
vars/build.vars: adds `host_packages' target comprised of all host packages.
vars/build.vars:lib_packages: adds w32lib (via Redfoxmoon.)
Diffstat (limited to 'subr')
-rw-r--r-- | subr/build.subr | 6 | ||||
-rw-r--r-- | subr/pkg_install.subr | 64 |
2 files changed, 47 insertions, 23 deletions
diff --git a/subr/build.subr b/subr/build.subr index 0e5bea4e..14c932e2 100644 --- a/subr/build.subr +++ b/subr/build.subr @@ -2,7 +2,9 @@ # set -o errexit -o noglob are assumed. # +basename() { echo "${1##*/}"; }; date() { command date "+${1:-${TIMESTAMP_FMT}}"; }; +dirname() { echo "${1%/*}"; }; get_var_unsafe() { eval echo \${${1}}; }; set_var_unsafe() { [ -n "${2}" ] && eval ${1}=\"${2}\" || return 0; }; pop_IFS() { IFS="${_pI_IFS}"; unset _pI_IFS; }; @@ -14,7 +16,7 @@ build_fileop() { local _op="${1}"; shift; if [ "${_op}" = cd ]; then log_msg varn "Changing working directory to \`${1}'."; - [ \( -n "${1}" \) -a \( -e "${1}" \) ] && cd -- "${1}"; + [ \( -n "${1}" \) -a \( -L "${1}" -o -e "${1}" \) ] && cd -- "${1}"; elif [ "${_op}" = cp ]; then log_msg varn "Copying \`${1}' to \`${2}' w/ -pPR."; [ ${#} -ge 2 ] && cp -pPR -- "${@}"; @@ -34,7 +36,7 @@ build_fileop() { log_msg varn "Making directory \`${1}'."; mkdir -p -- "${1}"; elif [ "${_op}" = rm ]\ - && [ -e "${1}" ]; then + && [ \( -L "${1}" \) -o \( -e "${1}" \) ]; then log_msg varn "Removing directory or file \`${1}'."; rm -rf -- "${1}"; fi; shift; diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index 35dd5d42..fc76098e 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -11,34 +11,56 @@ pkgp_install_clean_lib() { fi; }; -pkgp_install_dlltool() { - local _so_fname _so_name; +pkgp_install_lib_link() { + local _so_path="${1}" _so_dir="${2}" _lib_name="${3}" \ + _lib_link_tgt _lib_link_path; + _lib_link_tgt="$(find "${_so_dir}" \ + -name "${_lib_name%%.*}.*.lib.a" |\ + sort | tail -1)"; + if [ -n "${_lib_link_tgt}" ]; then + _lib_link_path="${_so_path%.so*}.lib.a"; + build_fileop rm "${_lib_link_path}"; + build_fileop ln_symbolic "${_lib_link_tgt}" \ + "${_lib_link_path}"; + fi; +}; + +pkgp_install_libs() { + local _so_src_path _so_dst_path _so_dst_dir \ + _lib_src_path _lib_name _lib_dst_path; if [ "${PKG_BUILD_TYPE}" != "host" ] \ && test_cmd perk \ && test_cmd ${PKG_TARGET}-mdso; then - for _so_fname in \ + for _so_src_path in \ $(find \( -name "*.so" \ -or -name "*.so.[0-9]*" \ -or -name "*.so.[0-9]*.[0-9]*" \ -or -name "*.so.[0-9]*.[0-9]*.[0-9]*" \) -print); - do _so_fname="${_so_fname#./}"; - case "${_so_fname}" in - *.so) _so_fname_ver=""; ;; - *.so.*) _so_fname_ver="${_so_fname##*.so.}"; ;; - esac; - _so_name="${_so_fname%%.so*}"; - _lib_fname="${_so_name}${_so_fname_ver:+.${_so_fname_ver}}.lib.a"; - if [ -e "${_lib_fname}" ] \ - || [ -e "${PKG_PREFIX}/lib/${_lib_fname}" ] \ - || [ "$(readlink -f "${_so_fname}")" = "/dev/null" ]; then + do _so_src_path="${_so_src_path#./}"; + if [ "$(readlink -f "${_so_src_path}")" = "/dev/null" ]; then + continue; + else case "${_so_src_path}" in + *.so) _lib_src_path="${_so_src_path%%.so}.lib.a"; ;; + *.so.*) _lib_src_path="${_so_src_path%%.so.*}.${_so_src_path##*.so.}.lib.a"; ;; + esac; + _lib_name="$(basename "${_lib_src_path}")"; + _so_dst_path="$(find "${PKG_PREFIX}/lib" \ + -name "$(basename "${_so_src_path}")" \ + -size "$(stat -c %s "${_so_src_path}")c")"; + _so_dst_dir="${_so_dst_path%/*}"; + fi; + if [ -z "${_so_dst_path}" ]; then continue; - else - echo perk -e "${_so_fname}" \|\ - ${PKG_TARGET}-mdso -i ${_lib_fname} -n "${_so_fname##*/}" - - perk -e "${_so_fname}" |\ - ${PKG_TARGET}-mdso -i ${_lib_fname} -n "${_so_fname##*/}" - - build_fileop cp "${_lib_fname}" "${PKG_PREFIX}/lib"; + elif [ ! -L "${_lib_src_path}" ]; then + _lib_dst_path="${_so_dst_dir}/${_lib_name}"; + perk -e "${_so_src_path}" |\ + "${PKG_TARGET}-mdso" \ + -i "${_lib_src_path}" \ + -n "${_so_src_path}" -; + build_fileop rm "${_lib_dst_path}"; + build_fileop cp "${_lib_src_path}" "${_lib_dst_path}"; fi; + pkgp_install_lib_link "${_so_dst_path}" "${_so_dst_dir}" "${_lib_name}"; done; fi; }; @@ -48,7 +70,7 @@ pkgp_install_pkgconfig() { for __ in $(find "${WORKDIR}/${PKG_BUILD_DIR}" -name \*.pc); do if grep -Eq '^libdir=[^$]+$' "${__}"; then sed -i -e '/^libdir=[^$]\+$/s/^libdir=\(.\+\)$/libdir=${exec_prefix}\1/' \ - -e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/' \ + -e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/' \ "${__}"; fi; done; @@ -85,7 +107,7 @@ pkg_install() { if [ -n "${PKG_INSTALL_FILES}" ]; then (install_files -v ${PKG_PREFIX} ${PKG_INSTALL_FILES}); fi; - pkgp_install_dlltool; + pkgp_install_libs; pkgp_install_pkgconfig; }; |