@@ -520,90 +520,96 @@ ppHsc2hs bi lbi clbi =
520
520
++ postccldFlags
521
521
++ [" -o" , outFile, inFile]
522
522
where
523
- ldflags = map (" --lflag=" ++ ) $ concat
524
- [ programDefaultArgs gccProg ++ programOverrideArgs gccProg
525
- , osxFrameworkDirs
526
- , [ arg
527
- | isOSX
528
- , opt <- map getSymbolicPath (PD. frameworks bi) ++ concatMap Installed. frameworks pkgs
529
- , arg <- [" -framework" , opt]
530
- ]
531
-
532
- -- Note that on ELF systems, wherever we use -L, we must also use -R
533
- -- because presumably that -L dir is not on the normal path for the
534
- -- system's dynamic linker. This is needed because hsc2hs works by
535
- -- compiling a C program and then running it.
536
-
537
- -- Options from the current package:
538
-
539
- , [ " -L" ++ u opt
540
- | opt <-
541
- if withFullyStaticExe lbi
542
- then PD. extraLibDirsStatic bi
543
- else PD. extraLibDirs bi
544
- ]
545
- , [ " -Wl,-R," ++ u opt
546
- | isELF
547
- , opt <-
548
- if withFullyStaticExe lbi
549
- then PD. extraLibDirsStatic bi
550
- else PD. extraLibDirs bi
551
- ]
552
- , [" -l" ++ opt | opt <- PD. extraLibs bi]
553
- , PD. ldOptions bi
554
-
555
- -- Options from dependent packages
556
- , [ opt
557
- | pkg <- pkgs
558
- , opt <-
559
- [" -L" ++ opt | opt <- Installed. libraryDirs pkg]
560
- ++ [ " -Wl,-R," ++ opt | isELF, opt <- Installed. libraryDirs pkg
561
- ]
562
- ++ [ " -l" ++ opt
563
- | opt <-
564
- if withFullyStaticExe lbi
565
- then Installed. extraLibrariesStatic pkg
566
- else Installed. extraLibraries pkg
567
- ]
568
- ++ Installed. ldOptions pkg
569
- ]
570
- ]
523
+ ldflags =
524
+ map (" --lflag=" ++ ) $
525
+ ordNub $
526
+ concat
527
+ [ programDefaultArgs gccProg ++ programOverrideArgs gccProg
528
+ , osxFrameworkDirs
529
+ , [ arg
530
+ | isOSX
531
+ , opt <- map getSymbolicPath (PD. frameworks bi) ++ concatMap Installed. frameworks pkgs
532
+ , arg <- [" -framework" , opt]
533
+ ]
534
+
535
+ -- Note that on ELF systems, wherever we use -L, we must also use -R
536
+ -- because presumably that -L dir is not on the normal path for the
537
+ -- system's dynamic linker. This is needed because hsc2hs works by
538
+ -- compiling a C program and then running it.
539
+
540
+ -- Options from the current package:
541
+
542
+ , [ " -L" ++ u opt
543
+ | opt <-
544
+ if withFullyStaticExe lbi
545
+ then PD. extraLibDirsStatic bi
546
+ else PD. extraLibDirs bi
547
+ ]
548
+ , [ " -Wl,-R," ++ u opt
549
+ | isELF
550
+ , opt <-
551
+ if withFullyStaticExe lbi
552
+ then PD. extraLibDirsStatic bi
553
+ else PD. extraLibDirs bi
554
+ ]
555
+ , [" -l" ++ opt | opt <- PD. extraLibs bi]
556
+ , PD. ldOptions bi
571
557
572
- cflags = map (" --cflag=" ++ ) $ concat
573
- [ programDefaultArgs gccProg ++ programOverrideArgs gccProg
574
- , osxFrameworkDirs
575
- , platformDefines lbi
576
-
577
- -- Options from the current package:
578
- , [ " -I" ++ u dir | dir <- PD. includeDirs bi ]
579
- , [ " -I" ++ u (buildDir lbi </> unsafeCoerceSymbolicPath relDir)
580
- | relDir <- mapMaybe symbolicPathRelative_maybe $ PD. includeDirs bi
581
- ]
582
-
583
- -- hsc2hs uses the C ABI
584
- -- We assume that there are only C sources
585
- -- and C++ functions are exported via a C
586
- -- interface and wrapped in a C source file.
587
- -- Therefore we do not supply C++ flags
588
- -- because there will not be C++ sources.
589
- --
590
- -- DO NOT add PD.cxxOptions unless this changes!
591
- , PD. ccOptions bi ++ PD. cppOptions bi
592
-
593
- , [ " -I" ++ u (autogenComponentModulesDir lbi clbi)
594
- , " -I" ++ u (autogenPackageModulesDir lbi)
595
- , " -include"
596
- , u $ autogenComponentModulesDir lbi clbi </> makeRelativePathEx cppHeaderName
597
- ]
598
-
599
- -- Options from dependent packages
600
- , [ opt
601
- | pkg <- pkgs
602
- , opt <-
603
- [" -I" ++ opt | opt <- Installed. includeDirs pkg]
604
- ++ Installed. ccOptions pkg
605
- ]
606
- ]
558
+ -- Options from dependent packages
559
+ , [ opt
560
+ | pkg <- pkgs
561
+ , opt <-
562
+ [" -L" ++ opt | opt <- Installed. libraryDirs pkg]
563
+ ++ [ " -Wl,-R," ++ opt | isELF, opt <- Installed. libraryDirs pkg
564
+ ]
565
+ ++ [ " -l" ++ opt
566
+ | opt <-
567
+ if withFullyStaticExe lbi
568
+ then Installed. extraLibrariesStatic pkg
569
+ else Installed. extraLibraries pkg
570
+ ]
571
+ ++ Installed. ldOptions pkg
572
+ ]
573
+ ]
574
+
575
+ cflags =
576
+ map (" --cflag=" ++ ) $
577
+ ordNub $
578
+ concat
579
+ [ programDefaultArgs gccProg ++ programOverrideArgs gccProg
580
+ , osxFrameworkDirs
581
+ , platformDefines lbi
582
+
583
+ -- Options from the current package:
584
+ , [ " -I" ++ u dir | dir <- PD. includeDirs bi ]
585
+ , [ " -I" ++ u (buildDir lbi </> unsafeCoerceSymbolicPath relDir)
586
+ | relDir <- mapMaybe symbolicPathRelative_maybe $ PD. includeDirs bi
587
+ ]
588
+
589
+ -- hsc2hs uses the C ABI
590
+ -- We assume that there are only C sources
591
+ -- and C++ functions are exported via a C
592
+ -- interface and wrapped in a C source file.
593
+ -- Therefore we do not supply C++ flags
594
+ -- because there will not be C++ sources.
595
+ --
596
+ -- DO NOT add PD.cxxOptions unless this changes!
597
+ , PD. ccOptions bi ++ PD. cppOptions bi
598
+
599
+ , [ " -I" ++ u (autogenComponentModulesDir lbi clbi)
600
+ , " -I" ++ u (autogenPackageModulesDir lbi)
601
+ , " -include"
602
+ , u $ autogenComponentModulesDir lbi clbi </> makeRelativePathEx cppHeaderName
603
+ ]
604
+
605
+ -- Options from dependent packages
606
+ , [ opt
607
+ | pkg <- pkgs
608
+ , opt <-
609
+ [" -I" ++ opt | opt <- Installed. includeDirs pkg]
610
+ ++ Installed. ccOptions pkg
611
+ ]
612
+ ]
607
613
608
614
osxFrameworkDirs =
609
615
[ " -F" ++ opt
0 commit comments