Eliminate external GMP dependencies
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>
Mon, 17 Dec 2007 09:38:39 +0000 (09:38 +0000)
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>
Mon, 17 Dec 2007 09:38:39 +0000 (09:38 +0000)
- Ensure the stage1 compiler uses ghc's own GMP library on Mac OS
- Need to rebuild installPackage and ifBuildable with stage1 compiler as they
  go into bindists

Makefile
libraries/Makefile
rts/package.conf.in

index 81437ac..f58ae70 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -256,10 +256,15 @@ binary-dist::
 # compiler) with the stage1 compiler. See #1860 for an example.
 # Thus we rebuild the utils with stage 1 here. This is a bit unpleasant,
 # as binary-dist really shouldn't actually build anything, but it works.
+# We need to do the same for utilities used during library package installation.
 binary-dist::
        $(MAKE) -C utils clean
        $(MAKE) -C utils UseStage1=YES boot
        $(MAKE) -C utils UseStage1=YES
+       $(RM) -f libraries/ifBuildable/ifBuildable
+       $(MAKE) -C libraries UseStage1=YES ifBuildable/ifBuildable
+       $(RM) -f libraries/installPackage/installPackage
+       $(MAKE) -C libraries UseStage1=YES installPackage/installPackage
 
 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
 
index 9b61df2..51cb7aa 100644 (file)
@@ -171,15 +171,28 @@ installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS)
        -$(RM) -rf installPackage
        mkdir installPackage
        $(CP) installPackage.hs installPackage/
+ifeq "$(UseStage1)" "YES"
+       cd installPackage && ../$(HC) -Wall -cpp \
+                                   --make installPackage -o installPackage \
+                                   $(BOOTSTRAP_INC_1_UP)
+else
        cd installPackage && $(GHC) -Wall -cpp \
                                    --make installPackage -o installPackage \
                                    $(BOOTSTRAP_INC_1_UP)
+endif
+# TODO: The conditional is yucky, but we need to be able to build with stage1
+#       for bindists and as installPackages/ has no Makefile, it seems hard
+#      to make this nicer.
 
 ifBuildable/ifBuildable: ifBuildable.hs
        -$(RM) -rf ifBuildable
        mkdir ifBuildable
        $(CP) ifBuildable.hs ifBuildable/
+ifeq "$(UseStage1)" "YES"
+       cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable
+else
        cd ifBuildable && $(GHC) -Wall --make ifBuildable -o ifBuildable
+endif
 
 $(BOOTSTRAP_STAMPS): stamp/bootstrapping.%:
        $(RM) -rf bootstrapping.$*
index 9cc03f0..d57ef62 100644 (file)
@@ -150,6 +150,14 @@ ld-options:
         , "-u", "base_GHCziConc_ensureIOManagerIsRunning_closure"
 #endif
 
+/*  Pick up static libraries in preference over dynamic if in earlier search
+ *  path.  This is important to use the static gmp in preference on Mac OS.
+ *  The used option is specific to the Darwin linker.
+ */
+#ifdef darwin_BUILD_OS
+        , "-Wl,-search_paths_first"
+#endif
+
 framework-dirs:
 
 #ifdef HAVE_FRAMEWORK_GMP