Sat May 1 09:04:57 2021 UTC ()
Don't use "response file" while invoking CC and LD

Our tool wrappers don't look into response files, so common mistakes
such as forgetting to declare dependencies have been overlooked by
our buildlink framework. With the change that will no longer happen.


(pho)
diff -r1.11 -r1.12 pkgsrc/lang/ghc90/Makefile
diff -r1.11 -r1.12 pkgsrc/lang/ghc90/distinfo
diff -r0 -r1.1 pkgsrc/lang/ghc90/patches/patch-compiler_GHC_Driver_Pipeline.hs
diff -r0 -r1.1 pkgsrc/lang/ghc90/patches/patch-compiler_GHC_SysTools_Process.hs

cvs diff -r1.11 -r1.12 pkgsrc/lang/ghc90/Makefile (expand / switch to unified diff)

--- pkgsrc/lang/ghc90/Makefile 2021/04/30 03:05:30 1.11
+++ pkgsrc/lang/ghc90/Makefile 2021/05/01 09:04:57 1.12
@@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
1# $NetBSD: Makefile,v 1.11 2021/04/30 03:05:30 pho Exp $ 1# $NetBSD: Makefile,v 1.12 2021/05/01 09:04:57 pho Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-9.0.1-src 5DISTNAME= ghc-9.0.1-src
6PKGREVISION= 3 6PKGREVISION= 4
7PKGNAME= ${DISTNAME:S/-src$//} 7PKGNAME= ${DISTNAME:S/-src$//}
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pkgsrc-users@NetBSD.org 12MAINTAINER= pkgsrc-users@NetBSD.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 9.0 Release Series 14COMMENT= Compiler for the functional language Haskell - 9.0 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17UNLIMIT_RESOURCES= datasize virtualsize 17UNLIMIT_RESOURCES= datasize virtualsize
18 18
19# TODO: We should be using the alternatives framework. 19# TODO: We should be using the alternatives framework.

cvs diff -r1.11 -r1.12 pkgsrc/lang/ghc90/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/ghc90/distinfo 2021/04/30 15:14:30 1.11
+++ pkgsrc/lang/ghc90/distinfo 2021/05/01 09:04:57 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.11 2021/04/30 15:14:30 pho Exp $ 1$NetBSD: distinfo,v 1.12 2021/05/01 09:04:57 pho Exp $
2 2
3SHA1 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 3ff01d768393b3866e7a7543f9f55646aaffce7a 3SHA1 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 3ff01d768393b3866e7a7543f9f55646aaffce7a
4RMD160 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 39bf10b13054a6316c8477609fb98abe4277fa6c 4RMD160 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 39bf10b13054a6316c8477609fb98abe4277fa6c
5SHA512 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 730347bb5eaac4efac8ec487fafd2da6fe2932db45f59e324c83698eb0b0e8a6a4b4fd513de17fb9c152ccee328660cfe1638cad631ce5e35b2dbfddda0d8850 5SHA512 (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 730347bb5eaac4efac8ec487fafd2da6fe2932db45f59e324c83698eb0b0e8a6a4b4fd513de17fb9c152ccee328660cfe1638cad631ce5e35b2dbfddda0d8850
6Size (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 49500236 bytes 6Size (ghc-8.10.4-boot-x86_64-unknown-netbsd.tar.xz) = 49500236 bytes
7SHA1 (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 7b33f71d9ec9951934137703eef61c106f261808 7SHA1 (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 7b33f71d9ec9951934137703eef61c106f261808
8RMD160 (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 98ba27e49e84738a9db92daf669ca7839dd5c0d9 8RMD160 (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 98ba27e49e84738a9db92daf669ca7839dd5c0d9
9SHA512 (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 4fcf2eaa25b33ca77ad4ce465258ca6f9487995219d69416933a84b3d70b7908a09004f3279b4368f81ebb4fdd14465859147ebe683ac7f538307ce5dd74241d 9SHA512 (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 4fcf2eaa25b33ca77ad4ce465258ca6f9487995219d69416933a84b3d70b7908a09004f3279b4368f81ebb4fdd14465859147ebe683ac7f538307ce5dd74241d
10Size (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 48862704 bytes 10Size (ghc-9.0.1-boot-i386-unknown-freebsd.tar.xz) = 48862704 bytes
11SHA1 (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = c866b36b83a3f6cae2ac5e606291231abff5d7a7 11SHA1 (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = c866b36b83a3f6cae2ac5e606291231abff5d7a7
12RMD160 (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = 1791435b251b8534ff70cc10e16300298d060375 12RMD160 (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = 1791435b251b8534ff70cc10e16300298d060375
13SHA512 (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = 1c2d8e1df4d8545068c453e8437e29f1528015ce056150d98827709c026fc23f5460887467d20321b1d32e3fffefe7081c068d702881184029d1c63c0adb25e4 13SHA512 (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = 1c2d8e1df4d8545068c453e8437e29f1528015ce056150d98827709c026fc23f5460887467d20321b1d32e3fffefe7081c068d702881184029d1c63c0adb25e4
14Size (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = 57551160 bytes 14Size (ghc-9.0.1-boot-x86_64-apple-darwin.tar.xz) = 57551160 bytes
@@ -19,34 +19,36 @@ Size (ghc-9.0.1-boot-x86_64-unknown-free @@ -19,34 +19,36 @@ Size (ghc-9.0.1-boot-x86_64-unknown-free
19SHA1 (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = 19fa8860969d332baced6ea281616cdc5ec32d67 19SHA1 (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = 19fa8860969d332baced6ea281616cdc5ec32d67
20RMD160 (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = deb39ae711a2cfa5cec9419e993d2be05e054770 20RMD160 (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = deb39ae711a2cfa5cec9419e993d2be05e054770
21SHA512 (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = 92694ef783274f42800d899af4dd558087e3c2ce13e175558a23f5187c944333a2872cee1df9b14683903a0542954a8483c7413343aacaa2b1676d10a6d27a6d 21SHA512 (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = 92694ef783274f42800d899af4dd558087e3c2ce13e175558a23f5187c944333a2872cee1df9b14683903a0542954a8483c7413343aacaa2b1676d10a6d27a6d
22Size (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = 59903112 bytes 22Size (ghc-9.0.1-boot-x86_64-unknown-solaris2.tar.xz) = 59903112 bytes
23SHA1 (ghc-9.0.1-src.tar.xz) = adaec1c05cd03d6af02716d59ab5f597434b700b 23SHA1 (ghc-9.0.1-src.tar.xz) = adaec1c05cd03d6af02716d59ab5f597434b700b
24RMD160 (ghc-9.0.1-src.tar.xz) = 2bed45072ccb838418ae0405f5cfe64a237315e3 24RMD160 (ghc-9.0.1-src.tar.xz) = 2bed45072ccb838418ae0405f5cfe64a237315e3
25SHA512 (ghc-9.0.1-src.tar.xz) = bee7950a5118be8d8cefe0db5070139a5a93ca21c5bc6f8bf453429831f0c44f5e0fb5ee569865d6b8b92749044ee4123be06920928ac7a1ec9cffa9404a3e53 25SHA512 (ghc-9.0.1-src.tar.xz) = bee7950a5118be8d8cefe0db5070139a5a93ca21c5bc6f8bf453429831f0c44f5e0fb5ee569865d6b8b92749044ee4123be06920928ac7a1ec9cffa9404a3e53
26Size (ghc-9.0.1-src.tar.xz) = 20782336 bytes 26Size (ghc-9.0.1-src.tar.xz) = 20782336 bytes
27SHA1 (netbsd-9.0-amd64-libterminfo.tar.gz) = db6b385b8676efc135c08b06e3dd6fd11b926999 27SHA1 (netbsd-9.0-amd64-libterminfo.tar.gz) = db6b385b8676efc135c08b06e3dd6fd11b926999
28RMD160 (netbsd-9.0-amd64-libterminfo.tar.gz) = 5a246633c90ee85f71efcc02d8280bd0c50ab5a7 28RMD160 (netbsd-9.0-amd64-libterminfo.tar.gz) = 5a246633c90ee85f71efcc02d8280bd0c50ab5a7
29SHA512 (netbsd-9.0-amd64-libterminfo.tar.gz) = 79288d44b84df8848afc2cdfee628cc4fd1ec0334159403ef8ba994d617bc56a7114af3031198afb5f3b8f45c0463a848099431e32bc6725042908576b6f95b8 29SHA512 (netbsd-9.0-amd64-libterminfo.tar.gz) = 79288d44b84df8848afc2cdfee628cc4fd1ec0334159403ef8ba994d617bc56a7114af3031198afb5f3b8f45c0463a848099431e32bc6725042908576b6f95b8
30Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes 30Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes
31SHA1 (patch-aclocal.m4) = 66d27cc50de048beeebee31302107501d5802388 31SHA1 (patch-aclocal.m4) = 66d27cc50de048beeebee31302107501d5802388
 32SHA1 (patch-compiler_GHC_Driver_Pipeline.hs) = cc2c53f14420b8b75bd70b73e2c95bb52a10cd0c
 33SHA1 (patch-compiler_GHC_SysTools_Process.hs) = 36d7171e571d56c4e6ae1ed99d2851c0b0dac084
32SHA1 (patch-configure.ac) = 0905a0e5358d8c3f3f8366b597a59dd824f294d8 34SHA1 (patch-configure.ac) = 0905a0e5358d8c3f3f8366b597a59dd824f294d8
33SHA1 (patch-ghc.mk) = fdcbc5b0c48b616eb96868e49681536d773eaddd 35SHA1 (patch-ghc.mk) = fdcbc5b0c48b616eb96868e49681536d773eaddd
34SHA1 (patch-libraries_base_configure) = f06a961a6507f635aafe50dab3ff4396c012bdec 36SHA1 (patch-libraries_Cabal_Cabal_Distribution_Simple_GHC.hs) = a4c82b1282c0580a7945be8c3b9d38bc760db99f
35SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00 37SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
36SHA1 (patch-libraries_base_System_CPUTime_Posix_Times.hsc) = 2bfb779d534d12073287274ce5e90b99e457a860 38SHA1 (patch-libraries_base_System_CPUTime_Posix_Times.hsc) = 2bfb779d534d12073287274ce5e90b99e457a860
37SHA1 (patch-libraries_base_System_Environment.hs) = 7d79a91f295915b4408d5f41d5405739d7189215 39SHA1 (patch-libraries_base_System_Environment.hs) = 7d79a91f295915b4408d5f41d5405739d7189215
38SHA1 (patch-libraries_Cabal_Cabal_Distribution_Simple_GHC.hs) = a4c82b1282c0580a7945be8c3b9d38bc760db99f 40SHA1 (patch-libraries_base_configure) = f06a961a6507f635aafe50dab3ff4396c012bdec
39SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc) = 588270767f8a9cbde0648fc99807891fef65d721 41SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc) = 588270767f8a9cbde0648fc99807891fef65d721
40SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs) = b2811ec4a845e6b2b44414e940b6108178b597c5 42SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs) = b2811ec4a845e6b2b44414e940b6108178b597c5
41SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00 
42SHA1 (patch-libraries_unix_System_Posix_Env_ByteString.hsc) = 3f675fc5d6bf5cc59a2d5ccffeb9ccd51521645a 
43SHA1 (patch-libraries_unix_System_Posix_Env.hsc) = e94936c139ca15d45cac4a7feb74a601567913ab 43SHA1 (patch-libraries_unix_System_Posix_Env.hsc) = e94936c139ca15d45cac4a7feb74a601567913ab
 44SHA1 (patch-libraries_unix_System_Posix_Env_ByteString.hsc) = 3f675fc5d6bf5cc59a2d5ccffeb9ccd51521645a
44SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607 45SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607
45SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b 46SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
 47SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
 48SHA1 (patch-rts_ProfHeap.c) = 38b0623effbe46e04b98fb221591b4ec329a1b37
46SHA1 (patch-rts_ghc.mk) = 6e3daf71fb7e656131aa2aeeb0346c651520216a 49SHA1 (patch-rts_ghc.mk) = 6e3daf71fb7e656131aa2aeeb0346c651520216a
47SHA1 (patch-rts_posix_GetTime.c) = a0e94043a270697f3754c8e97461fbee36ca78ed 50SHA1 (patch-rts_posix_GetTime.c) = a0e94043a270697f3754c8e97461fbee36ca78ed
48SHA1 (patch-rts_posix_OSThreads.c) = d5873aad8836067b5f29b37250666e37db67a4be 51SHA1 (patch-rts_posix_OSThreads.c) = d5873aad8836067b5f29b37250666e37db67a4be
49SHA1 (patch-rts_ProfHeap.c) = 38b0623effbe46e04b98fb221591b4ec329a1b37 
50SHA1 (patch-rules_build-package-way.mk) = ec73df0bbc85e962f76a9068683879a1a1ba1815 52SHA1 (patch-rules_build-package-way.mk) = ec73df0bbc85e962f76a9068683879a1a1ba1815
51SHA1 (patch-rules_distdir-way-opts.mk) = a058c6428faf02ef94aab3336d2d2874f2726f4e 53SHA1 (patch-rules_distdir-way-opts.mk) = a058c6428faf02ef94aab3336d2d2874f2726f4e
52SHA1 (patch-utils_haddock_driver_Main.hs) = 26b015d3aef9fdff66e66c8e3d9a370a2dbd7067 54SHA1 (patch-utils_haddock_driver_Main.hs) = 26b015d3aef9fdff66e66c8e3d9a370a2dbd7067

File Added: pkgsrc/lang/ghc90/patches/patch-compiler_GHC_Driver_Pipeline.hs
$NetBSD: patch-compiler_GHC_Driver_Pipeline.hs,v 1.1 2021/05/01 09:04:57 pho Exp $

Do not use -Xpreprocessor to pass options to CPP. Our tool wrappers
may remove some of them, and if that happens an unpaired
-Xpreprocessor will be left behind and confuses CC.

--- compiler/GHC/Driver/Pipeline.hs.orig	2021-05-01 06:52:42.897138372 +0000
+++ compiler/GHC/Driver/Pipeline.hs
@@ -1293,8 +1293,8 @@ runPhase (RealPhase cc_phase) input_fn d
         -- (#16737). Doing it in this way is simpler and also enable the C
         -- compiler to perform preprocessing and parsing in a single pass,
         -- but it may introduce inconsistency if a different pgm_P is specified.
-        let more_preprocessor_opts = concat
-              [ ["-Xpreprocessor", i]
+        let more_preprocessor_opts =
+              [ i
               | not hcc
               , i <- getOpts dflags opt_P
               ]

File Added: pkgsrc/lang/ghc90/patches/patch-compiler_GHC_SysTools_Process.hs
$NetBSD: patch-compiler_GHC_SysTools_Process.hs,v 1.1 2021/05/01 09:04:57 pho Exp $

This is more like pkgsrc-specific than an upstream issue. Unless we
are on Windows, don't use "response file", the @FILE syntax while
invoking CC or LD. Our tool wrappers don't look into response files,
and therefore can't detect mistakes like depending on Cabal packages
that aren't declared as pkgsrc dependency.

The reason why GHC does it is due to some limitation on the length of
argv on Windows. So maybe the patch is worth sending to the upstream.

Note that this patch would break the package if we didn't have its
$ORIGIN use eliminated because our wrappers hate relative rpaths.

--- compiler/GHC/SysTools/Process.hs.orig	2021-05-01 04:49:05.262346202 +0000
+++ compiler/GHC/SysTools/Process.hs
@@ -30,7 +30,9 @@ import System.IO
 import System.IO.Error as IO
 import System.Process
 
+#if defined(mingw32_HOST_OS)
 import GHC.SysTools.FileCleanup
+#endif
 
 -- | Enable process jobs support on Windows if it can be expected to work (e.g.
 -- @process >= 1.6.9.0@).
@@ -141,6 +143,7 @@ runSomethingResponseFile
   :: DynFlags -> (String->String) -> String -> String -> [Option]
   -> Maybe [(String,String)] -> IO ()
 
+#if defined(mingw32_HOST_OS)
 runSomethingResponseFile dflags filter_fn phase_name pgm args mb_env =
     runSomethingWith dflags phase_name pgm args $ \real_args -> do
         fp <- getResponseFile real_args
@@ -183,6 +186,10 @@ runSomethingResponseFile dflags filter_f
             x
         , "\""
         ]
+#else
+runSomethingResponseFile dflags filter_fn phase_name pgm args mb_env =
+    runSomethingFiltered dflags filter_fn phase_name pgm args Nothing mb_env
+#endif
 
 runSomethingFiltered
   :: DynFlags -> (String->String) -> String -> String -> [Option]