From d6cecde585b0980ed8e0050c5a1d315789fb6356 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Sat, 17 Jun 2017 01:05:52 +0100 Subject: Remove the Windows GCC driver. Summary: This patch drops the GCC driver and instead moves the only remaining path that we need to keep for backwards compatibility to the settings file. It also generalizes the code that expands `$TopDir` so it can expand it within any location in the string and also changes it so `$TopDir` is expanded only after the words call because `$TopDir` can contains spaces which would be horribly broken. Test Plan: ./validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #13709 Differential Revision: https://phabricator.haskell.org/D3592 --- driver/gcc/gcc.c | 66 -------------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 driver/gcc/gcc.c (limited to 'driver') diff --git a/driver/gcc/gcc.c b/driver/gcc/gcc.c deleted file mode 100644 index b398c5ea46..0000000000 --- a/driver/gcc/gcc.c +++ /dev/null @@ -1,66 +0,0 @@ - -/* gcc on mingw is hardcoded to use /mingw (which is c:/mingw) to - find various files. If this is a different version of mingw to the - one that we have in the GHC tree then things can go wrong. We - therefore need to add various -B flags to the gcc commandline, - so that it uses our in-tree mingw. Hence this wrapper. */ - -#include "cwrapper.h" -#include "getLocation.h" - -#include -#include - -int main(int argc, char** argv) { - char *binDir; - char *exePath; - char *preArgv[4]; - char *oldPath; - char *newPath; - char *base; - char *version; - int n; - - binDir = getExecutablePath(); - exePath = mkString("%s/realgcc.exe", binDir); - - /* We need programs like - inplace/mingw/libexec/gcc/mingw32/4.5.0/cc1.exe - to be able to find the DLLs in inplace/mingw/bin, so we need to - add it to $PATH */ - oldPath = getenv("PATH"); - if (!oldPath) { - die("Couldn't read PATH\n"); - } - n = snprintf(NULL, 0, "PATH=%s;%s", binDir, oldPath); - n++; - newPath = malloc(n); - if (!newPath) { - die("Couldn't allocate space for PATH\n"); - } - snprintf(newPath, n, "PATH=%s;%s", binDir, oldPath); - n = putenv(newPath); - if (n) { - die("putenv failed\n"); - } - - /* GCC Version. */ - version = mkString("%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); - - /* Without these -B args, gcc will still work. However, if you - have a mingw installation in c:/mingw then it will use files - from that in preference to the in-tree files. */ - preArgv[0] = mkString("-B%s", binDir); - preArgv[1] = mkString("-B%s/../lib", binDir); -#if defined(__MINGW64__) - base = mkString("x86_64-w64-mingw32"); -#else - base = mkString("i686-w64-mingw32"); -#endif - - preArgv[2] = mkString("-B%s/../lib/gcc/%s/%s" , binDir, base, version); - preArgv[3] = mkString("-B%s/../libexec/gcc/%s/%s", binDir, base, version); - - run(exePath, 4, preArgv, argc - 1, argv + 1); -} - -- cgit v1.2.1