Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-10-31 18:35:42 +0000
committerDoug Schaefer2017-10-31 18:35:42 +0000
commitbfe7f8f3d74ddfd871bed0dd5135aa7a69d784d8 (patch)
tree42c0f4728621018efa5b2096bb9269ac683ab305 /build/org.eclipse.cdt.build.gcc.core
parenta974ba9c9ee7372f98bdb5f561c3d49aeeb10eab (diff)
downloadorg.eclipse.cdt-bfe7f8f3d74ddfd871bed0dd5135aa7a69d784d8.tar.gz
org.eclipse.cdt-bfe7f8f3d74ddfd871bed0dd5135aa7a69d784d8.tar.xz
org.eclipse.cdt-bfe7f8f3d74ddfd871bed0dd5135aa7a69d784d8.zip
Fix up MSYS2 autodetect in to use new GCCToolChain API.
Make sure we pass the path to gcc as well as the environment with the MSYS2/MINGW* path. Also mark the old API deprecated. Not sure it even works anymore so we need to move things over. Change-Id: I1df10a4a77dbdd9027788bc404ae367421673e26
Diffstat (limited to 'build/org.eclipse.cdt.build.gcc.core')
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java3
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java40
2 files changed, 39 insertions, 4 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 86af92019d3..ea791e734da 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -62,14 +62,17 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
private String cppCommand;
private String[] commands;
+ @Deprecated
public GCCToolChain(IToolChainProvider provider, String id, String version) {
this(provider, id, version, null, null);
}
+ @Deprecated
public GCCToolChain(IToolChainProvider provider, String id, String version, Path[] path) {
this(provider, id, version, path, null);
}
+ @Deprecated
public GCCToolChain(IToolChainProvider provider, String id, String version, Path[] path, String prefix) {
this.provider = provider;
this.id = id;
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
index 7e62455a92a..7b4cb3a5e1d 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
@@ -6,6 +6,7 @@
*******************************************************************************/
package org.eclipse.cdt.build.gcc.core.internal;
+import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -14,6 +15,8 @@ import org.eclipse.cdt.build.gcc.core.GCCToolChain;
import org.eclipse.cdt.core.build.IToolChain;
import org.eclipse.cdt.core.build.IToolChainManager;
import org.eclipse.cdt.core.build.IToolChainProvider;
+import org.eclipse.cdt.core.envvar.EnvironmentVariable;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.utils.WindowsRegistry;
import org.eclipse.core.runtime.Platform;
@@ -66,8 +69,23 @@ public class Msys2ToolChainProvider implements IToolChainProvider {
Path msysPath = Paths.get(installLocation);
Path gccPath = msysPath.resolve("mingw64\\bin\\gcc.exe"); //$NON-NLS-1$
if (Files.exists(gccPath)) {
- GCCToolChain toolChain = new GCCToolChain(this, "x86_64-w64-mingw32", "msys2.x86_64", new Path[] { //$NON-NLS-1$ //$NON-NLS-2$
- gccPath.getParent(), msysPath.resolve("bin"), msysPath.resolve("usr\\bin") }); //$NON-NLS-1$ //$NON-NLS-2$
+ StringBuilder pathVar = new StringBuilder();
+ pathVar.append(msysPath);
+ pathVar.append("\\mingw64\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\local\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\bin"); //$NON-NLS-1$
+ IEnvironmentVariable[] vars = new IEnvironmentVariable[] {
+ new EnvironmentVariable("PATH", pathVar.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
+ File.pathSeparator)
+ };
+ GCCToolChain toolChain = new GCCToolChain(this, gccPath, Platform.ARCH_X86_64, vars);
toolChain.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$
manager.addToolChain(toolChain);
return true;
@@ -81,8 +99,22 @@ public class Msys2ToolChainProvider implements IToolChainProvider {
Path msysPath = Paths.get(installLocation);
Path gccPath = msysPath.resolve("mingw32\\bin\\gcc.exe"); //$NON-NLS-1$
if (Files.exists(gccPath)) {
- GCCToolChain toolChain = new GCCToolChain(this, "i686-w64-mingw32", "msys2.i686", new Path[] { //$NON-NLS-1$ //$NON-NLS-2$
- gccPath.getParent(), msysPath.resolve("bin"), msysPath.resolve("usr\\bin") }); //$NON-NLS-1$ //$NON-NLS-2$
+ StringBuilder pathVar = new StringBuilder();
+ pathVar.append(msysPath);
+ pathVar.append("\\mingw32\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\local\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\bin"); //$NON-NLS-1$
+ IEnvironmentVariable[] vars = new IEnvironmentVariable[] {
+ new EnvironmentVariable("PATH", pathVar.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
+ File.pathSeparator) };
+ GCCToolChain toolChain = new GCCToolChain(this, gccPath, Platform.ARCH_X86, vars);
toolChain.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$
manager.addToolChain(toolChain);
return true;

Back to the top