diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-09-03 10:40:49 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-09-06 08:47:38 +0200 |
commit | 4c6e7fa28b66dee069d10b514d5e1317173da250 (patch) | |
tree | 9a8a85efbcfe36fe8842f5e0ad3e819b73ae3b61 /scripts/lib | |
parent | a7d93ba352b42652f275a946bc4473f2f47bf908 (diff) | |
download | ptxdist-4c6e7fa28b66dee069d10b514d5e1317173da250.tar.gz ptxdist-4c6e7fa28b66dee069d10b514d5e1317173da250.tar.xz |
pkg-config: cleanup and improve path and dependency handling
- move all search path magic into the wrapper script
- use the wrapper script for host packages as well
- enforce the dependencies for host packages
- make it possible to overwrite the script in the BSP
- track host and target dependencies separately
Needed e.g. by barebox to build host tools
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/ptxd_make_00-init.sh | 46 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_common.sh | 21 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_world_install.sh | 13 |
3 files changed, 26 insertions, 54 deletions
diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh index 4103d4f39..7e561a4e6 100644 --- a/scripts/lib/ptxd_make_00-init.sh +++ b/scripts/lib/ptxd_make_00-init.sh @@ -191,7 +191,6 @@ export -f ptxd_get_lib_dir # out: # PTXDIST_CROSS_CPPFLAGS CPPFLAGS for cross-compiled packages # PTXDIST_CROSS_LDFLAGS LDFLAGS for cross-compiled packages -# PTXDIST_CROSS_ENV_PKG_CONFIG PKG_CONFIG_* environemnt for cross pkg-config # ptxd_init_cross_env() { @@ -219,32 +218,6 @@ ptxd_init_cross_env() { export \ PTXDIST_CROSS_CPPFLAGS="${cppflags[*]}" \ PTXDIST_CROSS_LDFLAGS="${ldflags[*]}" - - - - ######## PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH ######## - - # - # PKG_CONFIG_LIBDIR contains the default pkg-config search - # directories. Set it to the components of - # PTXDIST_PATH_SYSROOT_PREFIX. - # - - # add <DIR>/lib/pkgconfig and <DIR>/share/pkgconfig - local -a pkg_libdir pkg_lib_system_path pkg_system_incpath - pkg_libdir=( "${prefix[@]/%//${lib_dir}/pkgconfig}" "${prefix[@]/%//share/pkgconfig}" ) - pkg_system_libpath=( "${pkg_libdir[@]/%//../../lib}" "${pkg_libdir[@]/%//../lib}" "/usr/lib" "/lib" ) - pkg_system_incpath=( "${pkg_libdir[@]/%//../../include}" "${pkg_libdir[@]/%//../include}" "/usr/include" "/include" ) - - IFS=":" - local pc_path="PKG_CONFIG_PATH=''" - local pc_libdir="PKG_CONFIG_LIBDIR='${pkg_libdir[*]}'" - local pc_sys_lib_path="PKG_CONFIG_SYSTEM_LIBRARY_PATH='${pkg_system_libpath[*]}'" - local pc_syc_inc_path="PKG_CONFIG_SYSTEM_INCLUDE_PATH='${pkg_system_incpath[*]}'" - IFS="${orig_IFS}" - local pc="PKG_CONFIG='$(ptxd_get_ptxconf PTXCONF_SYSROOT_CROSS)/bin/$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)pkg-config'" - PTXDIST_CROSS_ENV_PKG_CONFIG="${pc_path} ${pc_libdir} ${pc_sys_lib_path} ${pc_syc_inc_path} ${pc}" - export PTXDIST_CROSS_ENV_PKG_CONFIG } # @@ -287,25 +260,6 @@ ptxd_init_host_env() { export \ PTXDIST_HOST_CPPFLAGS="${cppflags[*]}" \ PTXDIST_HOST_LDFLAGS="${ldflags[*]}" - - ######## PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH ######## - - # - # PKG_CONFIG_LIBDIR contains the default pkg-config search - # directories. - # - - # add <DIR>/lib/pkgconfig and <DIR>/share/pkgconfig - local -a pkg_libdir - pkg_libdir=( "${prefix[@]/%//${lib_dir}/pkgconfig}" "${prefix[@]/%//share/pkgconfig}" ) - - IFS=":" - local pc_path="PKG_CONFIG_PATH=''" - local pc_libdir="PKG_CONFIG_LIBDIR='${pkg_libdir[*]}'" - IFS="${orig_IFS}" - local pc="PKG_CONFIG='$(ptxd_get_ptxconf PTXCONF_SYSROOT_HOST)/bin/pkg-config'" - PTXDIST_HOST_ENV_PKG_CONFIG="${pc_path} ${pc_libdir} ${pc}" - export PTXDIST_HOST_ENV_PKG_CONFIG } ptxd_init_devpkg() diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh index f04d2ed05..86e73538f 100644 --- a/scripts/lib/ptxd_make_world_common.sh +++ b/scripts/lib/ptxd_make_world_common.sh @@ -340,12 +340,21 @@ ptxd_make_world_init() { ;; *) ;; esac - local pkgconfig_whitelist - pkgconfig_whitelist="$(echo $( - for dep in ${pkg_build_deps}; do - cat "${ptx_state_dir}/${dep}.pkgconfig" 2>/dev/null; - done))" - pkg_env="PKGCONFIG_WHITELIST='${pkgconfig_whitelist}' PKGCONFIG_WHITELIST_SRC='${pkg_label}' ${pkg_env}" + local -a deps_host deps_target + local whitelist_host whitelist_target + for dep in ${pkg_build_deps}; do + case "${dep}" in + host-*|cross-*) + deps_host[${#deps_host[@]}]="${ptx_state_dir}/${dep}.pkgconfig" + ;; + *) + deps_target[${#deps_target[@]}]="${ptx_state_dir}/${dep}.pkgconfig" + ;; + esac + done + whitelist_host="$(echo $(cat "${deps_host[@]}" /dev/null 2>/dev/null))" + whitelist_target="$(echo $(cat "${deps_target[@]}" /dev/null 2>/dev/null))" + pkg_env="PKGCONFIG_WHITELIST_HOST='${whitelist_host}' PKGCONFIG_WHITELIST_TARGET='${whitelist_target}' PKGCONFIG_WHITELIST_SRC='${pkg_label}' ${pkg_env}" # DESTDIR if [[ "${pkg_conf_tool}" =~ "python" ]]; then diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh index bcc93539c..eaadfadf4 100644 --- a/scripts/lib/ptxd_make_world_install.sh +++ b/scripts/lib/ptxd_make_world_install.sh @@ -221,11 +221,20 @@ ptxd_make_world_install_post() { ptxd_make_world_init && ( if [ -n "${pkg_pkg_dir}" -a -d "${pkg_pkg_dir}" ]; then - find "${pkg_pkg_dir}"/usr/{lib,share}/pkgconfig -name *.pc \ + find "${pkg_pkg_dir}"{,/usr}/{lib,share}/pkgconfig -name *.pc \ -printf "%f\n" 2>/dev/null | sed 's/\.pc$//' fi for dep in ${pkg_build_deps}; do - cat "${ptx_state_dir}/${dep}.pkgconfig" 2>/dev/null; + case "${dep}" in + host-*|cross-*) + if [ "${pkg_type}" = "target" ]; then + continue + fi + ;& + *) + cat "${ptx_state_dir}/${dep}.pkgconfig" 2>/dev/null + ;; + esac done ) | sort -u > "${ptx_state_dir}/${pkg_label}.pkgconfig" # do nothing if pkg_pkg_dir does not exist |