diff options
author | Jan Luebbe <jlu@pengutronix.de> | 2012-10-24 23:21:50 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2012-11-20 11:52:17 +0100 |
commit | 2a21a0e4c219211bf8d6596740e1a4740d4f65ad (patch) | |
tree | b3c10f0e3febadaf5e7aad671cdf789509131468 /bin/ptxdist | |
parent | 335bb61b7afa564e984a34b62bb008d329651523 (diff) | |
download | ptxdist-2a21a0e4c219211bf8d6596740e1a4740d4f65ad.tar.gz ptxdist-2a21a0e4c219211bf8d6596740e1a4740d4f65ad.tar.xz |
wrapper: introduce a wrapper for cc, c++, cpp and ld
This is used to inject compiler and linker options without relying on the
build-systems to pass additional options to the tools.
It is used for options needed for cross-compiling, hardening flags and
other user defined options.
The wrapper also calls ccache if ptxdist is configured to use it.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin/ptxdist')
-rwxr-xr-x | bin/ptxdist | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index a6a1f36d1..73a950d18 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -515,6 +515,9 @@ check_dirs() { mkdir -p -- "${PTX_CCACHE_DIR}" || ptxd_bailout "cannot create dir: '${PTX_CCACHE_DIR}'" fi + rm -rf -- "${PTX_WRAPPER_DIR}" && + mkdir -p -- "${PTX_WRAPPER_DIR}" || ptxd_bailout "cannot create dir: '${PTX_WRAPPER_DIR}'" + # check for case sensitive file system for dir in \ "${BUILDDIR}" \ @@ -649,18 +652,14 @@ check_compiler() { fi } - if [ -n "${PTX_CCACHE_DIR}" ]; then - for cc in \ - gcc \ - g++ \ - ; do - ln -sf "$(which "ccache")" "${PTX_CCACHE_DIR}/${compiler_prefix}${cc}" || \ - ptxd_bailout "unable to create ccache link" - done - fi local toolchain="$(readlink -f "${PTXDIST_TOOLCHAIN}")" + local sysroot_host="$(ptxd_get_ptxconf PTXCONF_SYSROOT_HOST)" rm -f "${PTXDIST_PLATFORMDIR}/selected_toolchain" && - ln -s "${toolchain}" "${PTXDIST_PLATFORMDIR}/selected_toolchain" + ln -sf "${toolchain}" "${PTXDIST_PLATFORMDIR}/selected_toolchain" && + for cc in gcc g++ cpp ld; do + ln -sf "$(which ${compiler_prefix}${cc})" "${PTX_WRAPPER_DIR}/${compiler_prefix}${cc}.real" && + ln -sf "${SCRIPTSDIR}/wrapper/${cc}-wrapper" "${PTX_WRAPPER_DIR}/${compiler_prefix}${cc}" + done } @@ -2296,7 +2295,8 @@ setup_path() { fi if [ -n "${PTXCONF_SETUP_CCACHE}" ]; then - if [ -x "$(which ccache 2>/dev/null)" ]; then + PTXDIST_CCACHE="$(which ccache 2>/dev/null)" + if [ -n "${PTXDIST_CCACHE}" ]; then PTX_CCACHE_DIR="${sysroot_host}/lib/ccache" PATH="${PTX_CCACHE_DIR}:${PATH}" else @@ -2308,6 +2308,9 @@ setup_path() { sleep 3 fi fi + + PTX_WRAPPER_DIR="${sysroot_host}/lib/wrapper" + PATH="${PTX_WRAPPER_DIR}:${PATH}" } @@ -2383,6 +2386,7 @@ setup_export() { PTXDIST_PARALLELMFLAGS_INTERN \ PTXDIST_LOADMFLAGS_INTERN \ \ + PTXDIST_CCACHE \ PTXDIST_FORCE_DOWNLOAD \ PTXDIST_LOG_PROMPT \ PTXDIST_PEDANTIC \ |