From 649ebc918e508385a4fde71836dc918309ee8ad1c60514db4ce977112a06a60f Mon Sep 17 00:00:00 2001 From: Peter Trommler Date: Mon, 29 May 2017 11:09:39 +0000 Subject: [PATCH] Accepting request 498934 from devel:languages:haskell:lts:8 - make compactible with new upstream macros - added patches for more stable abi: * buildpath-abi-stability.patch * reproducible-tmp-names.patch OBS-URL: https://build.opensuse.org/request/show/498934 OBS-URL: https://build.opensuse.org/package/show/devel:languages:haskell/ghc?expand=0&rev=245 --- buildpath-abi-stability.patch | 23 +++++++++++++++ ghc.changes | 8 ++++++ ghc.spec | 54 +++++++++++++++++++---------------- reproducible-tmp-names.patch | 43 ++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 buildpath-abi-stability.patch create mode 100644 reproducible-tmp-names.patch diff --git a/buildpath-abi-stability.patch b/buildpath-abi-stability.patch new file mode 100644 index 0000000..350cac4 --- /dev/null +++ b/buildpath-abi-stability.patch @@ -0,0 +1,23 @@ +Index: ghc-7.10.1/compiler/iface/MkIface.hs +=================================================================== +--- ghc-7.10.1.orig/compiler/iface/MkIface.hs 2015-05-17 20:34:02.808643844 +0200 ++++ ghc-7.10.1/compiler/iface/MkIface.hs 2015-05-17 20:34:02.804643799 +0200 +@@ -611,7 +611,7 @@ + iface_hash <- computeFingerprint putNameLiterally + (mod_hash, + ann_fn (mkVarOcc "module"), -- See mkIfaceAnnCache +- mi_usages iface0, ++ usages, + sorted_deps, + mi_hpc iface0) + +@@ -644,6 +644,9 @@ + (non_orph_fis, orph_fis) = mkOrphMap ifFamInstOrph (mi_fam_insts iface0) + fix_fn = mi_fix_fn iface0 + ann_fn = mkIfaceAnnCache (mi_anns iface0) ++ -- Do not allow filenames to affect the interface ++ usages = [ case u of UsageFile _ fp -> UsageFile "" fp; _ -> u | u <- mi_usages iface0 ] ++ + + getOrphanHashes :: HscEnv -> [Module] -> IO [Fingerprint] + getOrphanHashes hsc_env mods = do diff --git a/ghc.changes b/ghc.changes index f6ebee3..4775fda 100644 --- a/ghc.changes +++ b/ghc.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sun May 28 12:52:06 UTC 2017 - mimi.vx@gmail.com + +- make compactible with new upstream macros +- added patches for more stable abi: +* buildpath-abi-stability.patch +* reproducible-tmp-names.patch + ------------------------------------------------------------------- Sat May 6 09:02:02 UTC 2017 - meissner@suse.com diff --git a/ghc.spec b/ghc.spec index be89dfa..9263053 100644 --- a/ghc.spec +++ b/ghc.spec @@ -78,6 +78,10 @@ Patch30: 0001-PPC-CodeGen-fix-lwa-instruction-generation.patch Patch31: ghc-pie.patch # PATCH-FIX-OPENSUSE ghc-8.0.2-Cabal-dynlibdir.patch -- Fix shared library directory location. Patch100: ghc-8.0.2-Cabal-dynlibdir.patch +# PATCH-FIX-UPSTREAM buildpath-abi-stability.patch -- debian patch for more stable abi-1 +Patch110: buildpath-abi-stability.patch +# PATCH-FIX-UPSTREAM reproducible-tmp-names.patch -- debian patch for more stable abi-2 +Patch111: reproducible-tmp-names.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -119,30 +123,30 @@ To install all of GHC install package ghc. %global ghc_pkg_c_deps ghc-compiler = %{ghc_version_override}-%{release} %if %{defined ghclibdir} -%ghc_lib_subpackage Cabal-1.24.2.0 -%ghc_lib_subpackage array-0.5.1.1 -%ghc_lib_subpackage -c gmp-devel,libffi-devel,libdw-devel,libelf-devel base-4.9.1.0 -%ghc_lib_subpackage binary-0.8.3.0 -%ghc_lib_subpackage bytestring-0.10.8.1 -%ghc_lib_subpackage containers-0.5.7.1 -%ghc_lib_subpackage deepseq-1.4.2.0 -%ghc_lib_subpackage directory-1.3.0.0 -%ghc_lib_subpackage filepath-1.4.1.1 -%ghc_lib_subpackage -x ghc-%{ghc_version_override} -%ghc_lib_subpackage ghc-boot-%{ghc_version_override} -%ghc_lib_subpackage ghc-boot-th-%{ghc_version_override} -%ghc_lib_subpackage -x ghci-%{ghc_version_override} -%ghc_lib_subpackage haskeline-0.7.3.0 -%ghc_lib_subpackage hoopl-3.10.2.1 -%ghc_lib_subpackage hpc-0.6.0.3 -%ghc_lib_subpackage pretty-1.1.3.3 -%ghc_lib_subpackage process-1.4.3.0 -%ghc_lib_subpackage template-haskell-2.11.1.0 -%ghc_lib_subpackage -c ncurses-devel terminfo-0.4.0.2 -%ghc_lib_subpackage time-1.6.0.1 -%ghc_lib_subpackage transformers-0.5.2.0 -%ghc_lib_subpackage unix-2.7.2.1 -%ghc_lib_subpackage xhtml-3000.2.1 +%ghc_lib_subpackage -d Cabal-1.24.2.0 +%ghc_lib_subpackage -d array-0.5.1.1 +%ghc_lib_subpackage -d -c gmp-devel,libffi-devel,libdw-devel,libelf-devel base-4.9.1.0 +%ghc_lib_subpackage -d binary-0.8.3.0 +%ghc_lib_subpackage -d bytestring-0.10.8.1 +%ghc_lib_subpackage -d containers-0.5.7.1 +%ghc_lib_subpackage -d deepseq-1.4.2.0 +%ghc_lib_subpackage -d directory-1.3.0.0 +%ghc_lib_subpackage -d filepath-1.4.1.1 +%ghc_lib_subpackage -d -x ghc-%{ghc_version_override} +%ghc_lib_subpackage -d ghc-boot-%{ghc_version_override} +%ghc_lib_subpackage -d ghc-boot-th-%{ghc_version_override} +%ghc_lib_subpackage -d -x ghci-%{ghc_version_override} +%ghc_lib_subpackage -d haskeline-0.7.3.0 +%ghc_lib_subpackage -d hoopl-3.10.2.1 +%ghc_lib_subpackage -d hpc-0.6.0.3 +%ghc_lib_subpackage -d pretty-1.1.3.3 +%ghc_lib_subpackage -d process-1.4.3.0 +%ghc_lib_subpackage -d template-haskell-2.11.1.0 +%ghc_lib_subpackage -d -c ncurses-devel terminfo-0.4.0.2 +%ghc_lib_subpackage -d time-1.6.0.1 +%ghc_lib_subpackage -d transformers-0.5.2.0 +%ghc_lib_subpackage -d unix-2.7.2.1 +%ghc_lib_subpackage -d xhtml-3000.2.1 %endif %global version %{ghc_version_override} @@ -168,6 +172,8 @@ except the ghc library, which is installed by the toplevel ghc metapackage. %patch30 -p1 %patch31 -p1 %patch100 -p1 +%patch110 -p1 +%patch111 -p1 %build # Check if bootstrap is required, i.e. version is different from ghc's version diff --git a/reproducible-tmp-names.patch b/reproducible-tmp-names.patch new file mode 100644 index 0000000..9a16dda --- /dev/null +++ b/reproducible-tmp-names.patch @@ -0,0 +1,43 @@ +This is an attempt to make GHC build reproducible. The name of .c files may end +up in the resulting binary (in the debug section), but not the directory. + +Instead of using the process id, create a hash from the command line arguments, +and assume that is going to be unique. + +Index: ghc-8.0.2/compiler/main/SysTools.hs +=================================================================== +--- ghc-8.0.2.orig/compiler/main/SysTools.hs ++++ ghc-8.0.2/compiler/main/SysTools.hs +@@ -65,6 +65,7 @@ + import Util + import DynFlags + import Exception ++import Fingerprint + + import LlvmCodeGen.Base (llvmVersionStr, supportedLlvmVersion) + +@@ -1145,8 +1146,8 @@ + mapping <- readIORef dir_ref + case Map.lookup tmp_dir mapping of + Nothing -> do +- pid <- getProcessID +- let prefix = tmp_dir "ghc" ++ show pid ++ "_" ++ pid <- getStableProcessID ++ let prefix = tmp_dir "ghc" ++ pid ++ "_" + mask_ $ mkTempDir prefix + Just dir -> return dir + where +@@ -1562,6 +1563,13 @@ + getProcessID = System.Posix.Internals.c_getpid >>= return . fromIntegral + #endif + ++-- Debian-specific hack to get reproducible output, by not using the "random" ++-- pid, but rather something determinisic ++getStableProcessID :: IO String ++getStableProcessID = do ++ args <- getArgs ++ return $ take 4 $ show $ fingerprintString $ unwords args ++ + -- Divvy up text stream into lines, taking platform dependent + -- line termination into account. + linesPlatform :: String -> [String]