Chromium Code Reviews| Index: build_tools/common.sh |
| diff --git a/build_tools/common.sh b/build_tools/common.sh |
| index 16290c909f12230646ec7e48ab4beca168537115..5fae910c9b4fb1f80a6b1e53fdbbbc3ac66279e2 100644 |
| --- a/build_tools/common.sh |
| +++ b/build_tools/common.sh |
| @@ -296,10 +296,10 @@ InjectSystemHeaders() { |
| } |
| -PatchSpecFile() { |
| +PatchSpecsFile() { |
| if [ "${NACL_ARCH}" = "pnacl" -o \ |
| "${NACL_ARCH}" = "emscripten" ]; then |
| - # The arm compiler doesn't currently need a patched specs file |
| + # The emscripten compiler doesn't currently need a patched specs file |
|
noelallen1
2014/10/07 18:25:03
NIT: A split sentence is kinda confusing. And th
Sam Clegg
2014/10/07 18:34:26
Done.
|
| # as it ships with the correct paths. As does the pnacl toolchain. |
| return |
| fi |
| @@ -328,6 +328,19 @@ PatchSpecFile() { |
| local SED_SAFE_SPACES_USR_INCLUDE=${NACL_SDK_MULTIARCH_USR_INCLUDE/ /\ /} |
| local SED_SAFE_SPACES_USR_LIB=${NACL_SDK_MULTIARCH_USR_LIB/ /\ /} |
| + if [ -f ${SPECS_FILE} ]; then |
| + if grep -q "${NACL_SDK_MULTIARCH_USR_LIB}" ${SPECS_FILE}; then |
| + echo "Specs file already patched" |
| + return |
| + fi |
| + echo "Patching existing specs file" |
| + cp ${SPECS_FILE} ${SPECS_FILE}.current |
| + else |
| + echo "Creating new specs file" |
| + ${NACLCC} -dumpspecs > ${SPECS_FILE}.current |
| + fi |
| + |
| + # add include & lib search paths to specs file |
| if [ "${NACL_ARCH}" = "arm" ]; then |
| local ARCH_SUBST='/\*cpp:/ { \ |
| printf("*nacl_arch:\narm-nacl\n\n", $1); } \ |
| @@ -338,8 +351,7 @@ PatchSpecFile() { |
| { print $0; }' |
| fi |
| - # have nacl-gcc dump specs file & add include & lib search paths |
| - ${NACLCC} -dumpspecs |\ |
| + cat ${SPECS_FILE}.current |\ |
| awk "${ARCH_SUBST}" |\ |
| sed "/*cpp:/{ |
| N |
| @@ -350,9 +362,9 @@ PatchSpecFile() { |
| s|$| -rpath-link=${SED_SAFE_SPACES_USR_LIB} -L${SED_SAFE_SPACES_USR_LIB}| |
| }" > ${SPECS_FILE} |
| - # For newlib toolchain, modify the specs file to give an error when attempting |
| - # to create a shared object. |
| - if [ "${NACL_LIBC}" = "newlib" ]; then |
| + # For static-only toolchains (i.e. newlib), modify the specs file to give an |
| + # error when attempting to create a shared object. |
| + if [ "${NACL_SHARED}" != "1" ]; then |
| sed -i.bak "s/%{shared:-shared/%{shared:%e${ERROR_MSG}/" "${SPECS_FILE}" |
| fi |
| } |
| @@ -1641,7 +1653,7 @@ RunInstallStep() { |
| CheckToolchain |
| CheckPatchVersion |
| CheckSDKVersion |
| -PatchSpecFile |
| +PatchSpecsFile |
| InjectSystemHeaders |
| InstallConfigSite |
| GetRevision |