Skip to content

Commit e73fbb2

Browse files
committed
Deduplicate arguments that hsc2hs passes to gcc and ld
If extra-lib-dirs and/or extra-include-dirs are specified via either command line or project files, they’re going to be added for each package in the dendency graph. With enough long enough directories the command-line length limits for gcc may be hit and calls to the C compiler made from hsc2hs will start failing. Ideally hsc2hs should be using repsonse files, but needlessly specifying myriad of command-line parameters is redundant anyway.
1 parent 6fff593 commit e73fbb2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Cabal/src/Distribution/Simple/PreProcess.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ ppHsc2hs bi lbi clbi =
520520
++ postccldFlags
521521
++ ["-o", outFile, inFile]
522522
where
523-
ldflags = map ("--lflag=" ++) $ concat
523+
ldflags = map ("--lflag=" ++) $ ordNub $ concat
524524
[ programDefaultArgs gccProg ++ programOverrideArgs gccProg
525525
, osxFrameworkDirs
526526
, [ arg
@@ -569,7 +569,7 @@ ppHsc2hs bi lbi clbi =
569569
]
570570
]
571571

572-
cflags = map ("--cflag=" ++) $ concat
572+
cflags = map ("--cflag=" ++) $ ordNub $ concat
573573
[ programDefaultArgs gccProg ++ programOverrideArgs gccProg
574574
, osxFrameworkDirs
575575
, platformDefines lbi

0 commit comments

Comments
 (0)