Make $1 in $1_$2_$3_FOO actually be directory.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Sat, 20 Jun 2015 23:32:56 +0000 (16:32 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Tue, 23 Jun 2015 17:59:10 +0000 (10:59 -0700)
Summary:
Previously, we used $1_$2_PACKAGE_KEY to parametrize $1.  But the
documentation says that $1 should be the directory...  and we're now
putting the libraries in $1_$2_LIB_NAME.  So use /that/.  This is just
alpha-renaming, so as long as we're consistent, there's no material
difference.)

I also fixed a bug of a package ID calculation which I missed first
time around, which was tickled by this change.

BTW, this means DEP_KEYS and TRANSITIVE_DEP_KEYS are unused, so
remove them from ghc-cabal.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1010

rules/build-package-way.mk
rules/build-package.mk
rules/build-prog.mk
utils/ghc-cabal/Main.hs

index cb8440d..c179159 100644 (file)
@@ -25,7 +25,7 @@ $(call hs-objs,$1,$2,$3)
 # the second is indexed by the package id, distdir and way
 $1_$2_$3_LIB_FILE = libHS$$($1_$2_LIB_NAME)$$($3_libsuf)
 $1_$2_$3_LIB = $1/$2/build/$$($1_$2_$3_LIB_FILE)
-$$($1_$2_PACKAGE_KEY)_$2_$3_LIB = $$($1_$2_$3_LIB)
+$$($1_$2_LIB_NAME)_$2_$3_LIB = $$($1_$2_$3_LIB)
 
 ifeq "$$(HostOS_CPP)" "mingw32"
 ifneq "$$($1_$2_dll0_HS_OBJS)" ""
@@ -42,7 +42,7 @@ endif
 # Really we should use a consistent scheme for distdirs, but in the
 # meantime we work around it by defining ghc-<ver>_dist-install_way_LIB:
 ifeq "$$($1_PACKAGE) $2" "ghc stage2"
-$$($1_$2_PACKAGE_KEY)_dist-install_$3_LIB = $$($1_$2_$3_LIB)
+$$($1_$2_LIB_NAME)_dist-install_$3_LIB = $$($1_$2_$3_LIB)
 endif
 
 # All the .a/.so library file dependencies for this library.
@@ -50,8 +50,8 @@ endif
 # The $(subst stage2,dist-install,..) is needed due to Note
 # [inconsistent distdirs].
 #
-# NB: Use DEP_KEYS, since DEPS only contains package IDs
-$1_$2_$3_DEPS_LIBS=$$(foreach dep,$$($1_$2_DEP_KEYS),$$($$(dep)_$(subst stage2,dist-install,$2)_$3_LIB))
+# NB: Use DEP_LIB_NAMES for the /directory/ parameter.
+$1_$2_$3_DEPS_LIBS=$$(foreach dep,$$($1_$2_DEP_LIB_NAMES),$$($$(dep)_$(subst stage2,dist-install,$2)_$3_LIB))
 
 $1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS)  $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
 $1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS)
index 34997cc..f05f230 100644 (file)
@@ -133,7 +133,7 @@ $$(foreach way,$$($1_$2_WAYS),$$(eval \
 # If dyn libs are not being built then $$($1_$2_dyn_LIB) will just
 # expand to the empty string, and be ignored.
 $1_$2_PROGRAM_DEP_LIB = $$($1_$2_v_LIB) $$($1_$2_dyn_LIB)
-$$($1_PACKAGE)-$$($1_$2_VERSION)_$2_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB)
+$$($1_$2_LIB_NAME)_$2_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB)
 
 # C and S files are possibly built the "dyn" way.
 ifeq "$$(BuildSharedLibs)" "YES"
index eca3358..1029fdd 100644 (file)
@@ -189,7 +189,7 @@ ifneq "$$(BINDIST)" "YES"
 # The quadrupled $'s here are because the _<way>_LIB variables aren't
 # necessarily set when this part of the makefile is read
 $1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \
-    $$(foreach dep,$$($1_$2_DEPS),\
+    $$(foreach dep,$$($1_$2_DEP_LIB_NAMES),\
         $$(if $$(filter ghc%,$$(dep)),\
             $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\
             $(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
index 77caf58..ed57fb8 100644 (file)
@@ -402,11 +402,13 @@ generate directory distdir dll0Modules config_args
                            . fst)
                        . externalPackageDeps
                        $ lbi
-          dep_keys
+          dep_ipids = map (display . Installed.installedPackageId) dep_direct
+          depLibNames
             | packageKeySupported comp
-                   = map (display . Installed.packageKey) dep_direct
+                = map (\p -> packageKeyLibraryName
+                                (Installed.sourcePackageId p)
+                                (Installed.packageKey p)) dep_direct
             | otherwise = deps
-          dep_ipids = map (display . Installed.installedPackageId) dep_direct
           depNames = map (display . packageName) dep_ids
 
           transitive_dep_ids = map Installed.sourcePackageId dep_pkgs
@@ -443,9 +445,9 @@ generate directory distdir dll0Modules config_args
                 variablePrefix ++ "_SYNOPSIS =" ++ synopsis pd,
                 variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi),
                 variablePrefix ++ "_DEPS = " ++ unwords deps,
-                variablePrefix ++ "_DEP_KEYS = " ++ unwords dep_keys,
                 variablePrefix ++ "_DEP_IPIDS = " ++ unwords dep_ipids,
                 variablePrefix ++ "_DEP_NAMES = " ++ unwords depNames,
+                variablePrefix ++ "_DEP_LIB_NAMES = " ++ unwords depLibNames,
                 variablePrefix ++ "_TRANSITIVE_DEPS = " ++ unwords transitiveDeps,
                 variablePrefix ++ "_TRANSITIVE_DEP_LIB_NAMES = " ++ unwords transitiveDepLibNames,
                 variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords transitiveDepNames,