[commit: ghc] master: Move gmp/config.mk.in to config.mk.in, fix #14972 (2534164)

git at git.haskell.org git at git.haskell.org
Tue Apr 10 15:36:59 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2534164aefd346c7c51b70e8e8c49aa881dd9f85/ghc

>---------------------------------------------------------------

commit 2534164aefd346c7c51b70e8e8c49aa881dd9f85
Author: Edward Z. Yang <ezyang at fb.com>
Date:   Sat Apr 7 13:32:47 2018 -0400

    Move gmp/config.mk.in to config.mk.in, fix #14972
    
    Here's how the rube goldberg machine triggered the old bug:
    
    1. If you have a file gmp/config.mk.in, then Cabal will
    create a generated file in $DIST/build/gmp/config.mk
    
    2. When you attempt to load inplace integer-gmp via GHCi, it will
    ask gcc (aka clang on OS X) for the file name of 'gmp', with
    base directory set to $DIST/build
    
    3. There is a folder named 'gmp', and so this folder is returned
    as the 'library' for gmp
    
    4. GHCi loadArchive chokes to death trying to open a library
    that is actually a folder
    
    This patch solves the problem by breaking the chain at (1): if we
    don't put config.mk in a folder named gmp, NO PROBLEM.
    
    Signed-off-by: Edward Z. Yang <ezyang at fb.com>
    
    Test Plan: validate
    
    Reviewers: angerman, hvr, bgamari
    
    Reviewed By: angerman
    
    Subscribers: erikd, thomie, carter
    
    GHC Trac Issues: #14972
    
    Differential Revision: https://phabricator.haskell.org/D4552


>---------------------------------------------------------------

2534164aefd346c7c51b70e8e8c49aa881dd9f85
 libraries/integer-gmp/{gmp => }/config.mk.in | 4 ++++
 libraries/integer-gmp/configure.ac           | 2 +-
 libraries/integer-gmp/gmp/ghc.mk             | 5 ++---
 libraries/integer-gmp/integer-gmp.cabal      | 7 +++++--
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/libraries/integer-gmp/gmp/config.mk.in b/libraries/integer-gmp/config.mk.in
similarity index 53%
rename from libraries/integer-gmp/gmp/config.mk.in
rename to libraries/integer-gmp/config.mk.in
index 93a4f53..b66f94c 100644
--- a/libraries/integer-gmp/gmp/config.mk.in
+++ b/libraries/integer-gmp/config.mk.in
@@ -1,3 +1,7 @@
+# NB: This file lives in the top-level integer-gmp folder, and not in
+# the gmp subfolder, because of #14972, where we MUST NOT create a
+# folder named 'gmp' in dist/build/
+
 ifeq "$(HaveLibGmp)" ""
  HaveLibGmp = @HaveLibGmp@
 endif
diff --git a/libraries/integer-gmp/configure.ac b/libraries/integer-gmp/configure.ac
index 3aebeba..1ccd48e 100644
--- a/libraries/integer-gmp/configure.ac
+++ b/libraries/integer-gmp/configure.ac
@@ -106,7 +106,7 @@ AC_SUBST(GhcGmpVerMj)
 AC_SUBST(GhcGmpVerMi)
 AC_SUBST(GhcGmpVerPl)
 
-AC_CONFIG_FILES([integer-gmp.buildinfo gmp/config.mk include/HsIntegerGmp.h])
+AC_CONFIG_FILES([integer-gmp.buildinfo config.mk include/HsIntegerGmp.h])
 
 dnl--------------------------------------------------------------------
 dnl * Generate output files
diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk
index f18e27d..2a9f3eb 100644
--- a/libraries/integer-gmp/gmp/ghc.mk
+++ b/libraries/integer-gmp/gmp/ghc.mk
@@ -27,7 +27,6 @@ endif
 ifneq "$(NO_CLEAN_GMP)" "YES"
 $(eval $(call clean-target,gmp,,\
   libraries/integer-gmp/include/ghc-gmp.h \
-  libraries/integer-gmp/gmp/config.mk \
   libraries/integer-gmp/gmp/libgmp.a \
   libraries/integer-gmp/gmp/gmp.h \
   libraries/integer-gmp/gmp/gmpbuild \
@@ -53,10 +52,10 @@ endif
 ifeq "$(phase)" "final"
 
 ifneq "$(CLEANING)" "YES"
-# Hack. The file gmp/config.mk doesn't exist yet after running ./configure in
+# Hack. The file config.mk doesn't exist yet after running ./configure in
 # the toplevel (ghc) directory. To let some toplevel make commands such as
 # sdist go through, right after ./configure, don't consider this an error.
--include libraries/integer-gmp/dist-install/build/gmp/config.mk
+-include libraries/integer-gmp/dist-install/build/config.mk
 endif
 
 gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS))
diff --git a/libraries/integer-gmp/integer-gmp.cabal b/libraries/integer-gmp/integer-gmp.cabal
index 6edacea..d2f6e3c 100644
--- a/libraries/integer-gmp/integer-gmp.cabal
+++ b/libraries/integer-gmp/integer-gmp.cabal
@@ -26,16 +26,19 @@ extra-source-files:
     config.sub
     configure
     configure.ac
-    gmp/config.mk.in
+    config.mk.in
     include/HsIntegerGmp.h.in
     install-sh
     integer-gmp.buildinfo.in
 
+-- NB: Many of these tmp files no longer ever actually get plopped in
+-- the root directory post Cabal 2.4, thanks to a change that causes
+-- autoconf/configure to get run inside the dist directory.
 extra-tmp-files:
     autom4te.cache
     config.log
     config.status
-    gmp/config.mk
+    config.mk
     integer-gmp.buildinfo
     include/HsIntegerGmp.h
 



More information about the ghc-commits mailing list