From 143d87d88ca20b7f40dec1eb187a2b533e42bb56 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 8 May 2013 16:26:20 -0400 Subject: [PATCH] Bug 407580: Can't build project with GnuMakefile using Autotools plug-in - Remove trailing separator from PWD during configuration step Change-Id: Ideddd1ce9b9d0a5a90219a411c114315046a7c8d Reviewed-on: https://git.eclipse.org/r/12657 Reviewed-by: Jeff Johnston IP-Clean: Jeff Johnston Tested-by: Jeff Johnston --- .../autotools/core/AutotoolsNewMakeGenerator.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java index ae7c4b16266..10e703376f0 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java @@ -1152,9 +1152,20 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // For Windows/Mac, check for PWD environment variable being passed. // Remove it for now as it is causing errors in configuration. // Fix for bug #343879 - if (!removePWD || !variables[i].getName().equals("PWD")) // $NON-NLS-1$ + if (!removePWD || !variables[i].getName().equals("PWD")) { // $NON-NLS-1$ + String value = variables[i].getValue(); + // The following is a work-around for bug #407580. Configure doesn't recognize + // a directory with a trailing separator at the end is equivalent to the same + // directory without that trailing separator. This problem can cause + // configure to try and link a file to itself (e.g. projects with a GnuMakefile) and + // obliterate the contents. Thus, we remove the trailing separator to be safe. + if (variables[i].getName().equals("PWD")) { // $NON-NLS-1$ + if (value.charAt(value.length()-1) == IPath.SEPARATOR) + value = value.substring(0, value.length() - 1); + } envList.add(variables[i].getName() - + "=" + variables[i].getValue()); //$NON-NLS-1$ + + "=" + value); //$NON-NLS-1$ + } } if (additionalEnvs != null) envList.addAll(additionalEnvs); // add any additional environment variables specified ahead of script