summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Capriotti <p.capriotti@gmail.com>2012-05-04 13:04:43 +0100
committerPaolo Capriotti <p.capriotti@gmail.com>2012-05-15 08:22:42 +0100
commitca2debb201bf44b518bc06a8d37ca1017ccf390f (patch)
tree95a367120912de4bced45658320d79289fd70a49
parent6a831be4aa73e86568256813ffa862d7cfd5732d (diff)
downloadhaskell-ca2debb201bf44b518bc06a8d37ca1017ccf390f.tar.gz
Rename package-conf flags to package-db.
Rename package database flags in both GHC and ghc-pkg so that they are consistent with Cabal nomenclature. Add a version check to the build system so that the correct set of package db flags are used when the bootstrapping GHC has version < 7.5.
-rw-r--r--aclocal.m42
-rw-r--r--bindisttest/Makefile4
-rw-r--r--bindisttest/ghc.mk4
-rw-r--r--compiler/main/DynFlags.hs16
-rw-r--r--compiler/main/Packages.lhs4
-rw-r--r--configure.ac4
-rw-r--r--ghc.mk2
-rw-r--r--mk/config.mk.in2
-rw-r--r--rules/distdir-way-opts.mk2
-rw-r--r--rules/package-config.mk8
-rw-r--r--utils/ghc-cabal/Main.hs2
-rw-r--r--utils/ghc-cabal/ghc.mk2
-rw-r--r--utils/ghc-pkg/Main.hs20
-rw-r--r--utils/ghc-pkg/ghc-pkg.wrapper2
-rw-r--r--utils/ghc-pkg/ghc.mk6
15 files changed, 43 insertions, 37 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index c196bdf026..f05dfe96ea 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1808,7 +1808,7 @@ AC_MSG_NOTICE(Building in-tree ghc-pwd)
dnl except we don't want to have to know what make is called. Sigh.
rm -rf utils/ghc-pwd/dist-boot
mkdir utils/ghc-pwd/dist-boot
- if ! "$WithGhc" -v0 -no-user-package-conf -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd
+ if ! "$WithGhc" -v0 -no-user-$GHC_PACKAGE_DB_FLAG -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd
then
AC_MSG_ERROR([Building ghc-pwd failed])
fi
diff --git a/bindisttest/Makefile b/bindisttest/Makefile
index 238bce7650..7d20bdbf39 100644
--- a/bindisttest/Makefile
+++ b/bindisttest/Makefile
@@ -48,8 +48,8 @@ endif
$(BIN_DIST_INST_DIR)/bin/ghc --make HelloWorld
./HelloWorld > output
$(CONTEXT_DIFF) output expected_output
-# Without --no-user-package-conf we might pick up random packages from ~/.ghc
- $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-conf
+# Without --no-user-package-db we might pick up random packages from ~/.ghc
+ $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db
clean distclean:
"$(RM)" $(RM_OPTS_REC) $(BIN_DIST_INST_SUBDIR)
diff --git a/bindisttest/ghc.mk b/bindisttest/ghc.mk
index e051be0ccd..c911da5e8c 100644
--- a/bindisttest/ghc.mk
+++ b/bindisttest/ghc.mk
@@ -48,8 +48,8 @@ endif
$(BIN_DIST_INST_DIR)/bin/ghc --make bindisttest/HelloWorld
bindisttest/HelloWorld > bindisttest/output
$(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output
-# Without --no-user-package-conf we might pick up random packages from ~/.ghc
- $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-conf
+# Without --no-user-package-db we might pick up random packages from ~/.ghc
+ $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db
$(eval $(call clean-target,bindisttest,all,$(BIN_DIST_INST_DIR) $(wildcard bindisttest/a/b/c/*) bindisttest/HelloWorld bindisttest/HelloWorld.o bindisttest/HelloWorld.hi bindisttest/output))
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index f49da9358f..7d22a7b138 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -551,7 +551,7 @@ data DynFlags = DynFlags {
-- Package flags
extraPkgConfs :: [PkgConfRef],
- -- ^ The @-package-conf@ flags given on the command line, in the order
+ -- ^ The @-package-db@ flags given on the command line, in the order
-- they appeared.
packageFlags :: [PackageFlag],
@@ -1342,7 +1342,7 @@ parseDynamicFlagsCmdLine :: Monad m =>
parseDynamicFlagsCmdLine dflags args = parseDynamicFlags dflags args True
-- | Like 'parseDynamicFlagsCmdLine' but does not allow the package flags
--- (-package, -hide-package, -ignore-package, -hide-all-packages, -package-conf).
+-- (-package, -hide-package, -ignore-package, -hide-all-packages, -package-db).
-- Used to parse flags set in a modules pragma.
parseDynamicFilePragma :: Monad m =>
DynFlags -> [Located String]
@@ -1757,12 +1757,12 @@ dynamic_flags = [
package_flags :: [Flag (CmdLineP DynFlags)]
package_flags = [
------- Packages ----------------------------------------------------
- Flag "package-conf" (HasArg (extraPkgConf_ . PkgConfFile))
- , Flag "clear-package-conf" (NoArg clearPkgConf)
- , Flag "no-global-package-conf" (NoArg (unSetDynFlag Opt_ReadGlobalPackageConf))
- , Flag "no-user-package-conf" (NoArg (unSetDynFlag Opt_ReadUserPackageConf))
- , Flag "global-package-conf" (NoArg (extraPkgConf_ GlobalPkgConf))
- , Flag "user-package-conf" (NoArg (extraPkgConf_ UserPkgConf))
+ Flag "package-db" (HasArg (extraPkgConf_ . PkgConfFile))
+ , Flag "clear-package-db" (NoArg clearPkgConf)
+ , Flag "no-global-package-db" (NoArg (unSetDynFlag Opt_ReadGlobalPackageConf))
+ , Flag "no-user-package-db" (NoArg (unSetDynFlag Opt_ReadUserPackageConf))
+ , Flag "global-package-db" (NoArg (extraPkgConf_ GlobalPkgConf))
+ , Flag "user-package-db" (NoArg (extraPkgConf_ UserPkgConf))
, Flag "package-name" (hasArg setPackageName)
, Flag "package-id" (HasArg exposePackageId)
diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs
index 12aefc0308..6d917fa327 100644
--- a/compiler/main/Packages.lhs
+++ b/compiler/main/Packages.lhs
@@ -184,10 +184,10 @@ initPackages dflags = do
readPackageConfigs :: DynFlags -> IO [PackageConfig]
readPackageConfigs dflags = do
- let -- Read global package db, unless the -no-user-package-conf flag was given
+ let -- Read global package db, unless the -no-user-package-db flag was given
global_conf_refs = [GlobalPkgConf | dopt Opt_ReadGlobalPackageConf dflags]
-- Read user's package conf (eg. ~/.ghc/i386-linux-6.3/package.conf)
- -- unless the -no-user-package-conf flag was given.
+ -- unless the -no-user-package-db flag was given.
user_conf_refs = [UserPkgConf | dopt Opt_ReadUserPackageConf dflags]
system_conf_refs = global_conf_refs ++ user_conf_refs
diff --git a/configure.ac b/configure.ac
index 8e3d9d2837..aeea6a4d9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,6 +161,10 @@ if test "$BootingFromHc" = "NO"; then
or --with-ghc to specify a different GHC to use.])
fi
fi
+
+ GHC_PACKAGE_DB_FLAG=package-db
+ FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.5],GHC_PACKAGE_DB_FLAG=package-conf)
+ AC_SUBST(GHC_PACKAGE_DB_FLAG)
fi;
# GHC is passed to Cabal, so we need a native path
diff --git a/ghc.mk b/ghc.mk
index 195310bef6..a23171caa7 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -899,7 +899,7 @@ install_packages: rts/package.conf.install
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
$(call removeTrees,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
- "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
+ "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
$(foreach p, $(INSTALLED_PKG_DIRS), \
$(call make-command, \
CROSS_COMPILE="$(CrossCompilePrefix)" \
diff --git a/mk/config.mk.in b/mk/config.mk.in
index b998946239..1cf8685383 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -543,6 +543,8 @@ compiler/cmm/Bitmap_HC_OPTS += -ffull-laziness
# for some unknown reason, so turn full-laziness back on for this module.
endif
+GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
+
#-----------------------------------------------------------------------------
# C compiler
#
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index dcbd9cb8a6..bbd37d1ee1 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -61,7 +61,7 @@ define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage
#
# $1_$2_EXTRA_HC_OPTS GHC options for this dir/distdir mk/build.mk
#
-# $1_$2_HC_PKGCONF -package-conf flag if necessary rules/package-config.mk
+# $1_$2_HC_PKGCONF -package-db flag if necessary rules/package-config.mk
#
# $1_$2_HS_SRC_DIRS dirs relative to $1 containing $1/$2/package-data.mk
# source files
diff --git a/rules/package-config.mk b/rules/package-config.mk
index e0c9757862..1173e5f025 100644
--- a/rules/package-config.mk
+++ b/rules/package-config.mk
@@ -34,10 +34,10 @@ $1_$2_HC_MK_DEPEND = $$($1_$2_HC)
# on cygwin we get a dep on c:/ghc/..., and make gets confused by the :
$1_$2_HC_MK_DEPEND_DEP =
$1_$2_HC_DEP =
-$1_$2_HC_PKGCONF = -package-conf $$(BOOTSTRAPPING_CONF)
-$1_$2_GHC_PKG_OPTS = --package-conf=$$(BOOTSTRAPPING_CONF)
+$1_$2_HC_PKGCONF = -$(GHC_PACKAGE_DB_FLAG) $$(BOOTSTRAPPING_CONF)
+$1_$2_GHC_PKG_OPTS = --$(GHC_PACKAGE_DB_FLAG)=$$(BOOTSTRAPPING_CONF)
$1_$2_CONFIGURE_OPTS += --package-db=$$(TOP)/$$(BOOTSTRAPPING_CONF)
-$1_$2_MORE_HC_OPTS += -no-user-package-conf
+$1_$2_MORE_HC_OPTS += -no-user-$(GHC_PACKAGE_DB_FLAG)
$1_$2_MORE_HC_OPTS += -rtsopts
else
$1_$2_HC_PKGCONF =
@@ -51,7 +51,7 @@ $1_$2_GHC_PKG_OPTS =
$1_$2_HC_MK_DEPEND = $$(GHC_STAGE1)
$1_$2_HC_MK_DEPEND_DEP = $$($1_$2_HC_MK_DEPEND)
$1_$2_HC_DEP = $$($1_$2_HC)
-$1_$2_MORE_HC_OPTS += -no-user-package-conf
+$1_$2_MORE_HC_OPTS += -no-user-package-db
$1_$2_MORE_HC_OPTS += -rtsopts
endif
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index c24f127422..0f11eea497 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -190,7 +190,7 @@ doInstall ghc ghcpkg strip topdir directory distDir
programPostConf = \_ _ -> return ["-B" ++ topdir],
programFindLocation = \_ -> return (Just ghc) }
ghcPkgProgram' = ghcPkgProgram {
- programPostConf = \_ _ -> return $ ["--global-conf", ghcpkgconf]
+ programPostConf = \_ _ -> return $ ["--global-package-db", ghcpkgconf]
++ ["--force" | not (null myDestDir) ],
programFindLocation = \_ -> return (Just ghcpkg) }
stripProgram' = stripProgram {
diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
index 3ee2b13fa5..0a3e920e7a 100644
--- a/utils/ghc-cabal/ghc.mk
+++ b/utils/ghc-cabal/ghc.mk
@@ -27,7 +27,7 @@ $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/C
$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/.
"$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \
- -no-user-package-conf \
+ -no-user-$(GHC_PACKAGE_DB_FLAG) \
-Wall \
-DCABAL_VERSION=$(CABAL_VERSION) \
-odir bootstrapping \
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index e29301d933..e63139e997 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -119,11 +119,11 @@ flags = [
"use the current user's package database",
Option [] ["global"] (NoArg FlagGlobal)
"use the global package database",
- Option ['f'] ["package-conf"] (ReqArg FlagConfig "FILE")
+ Option ['f'] ["package-db"] (ReqArg FlagConfig "FILE")
"use the specified package config file",
- Option [] ["global-conf"] (ReqArg FlagGlobalConfig "FILE")
+ Option [] ["global-package-db"] (ReqArg FlagGlobalConfig "FILE")
"location of the global package config",
- Option [] ["no-user-package-conf"] (NoArg FlagNoUserDb)
+ Option [] ["no-user-package-db"] (NoArg FlagNoUserDb)
"never read the user package database",
Option [] ["force"] (NoArg FlagForce)
"ignore missing dependencies, directories, and libraries",
@@ -177,8 +177,8 @@ usageHeader prog = substProg prog $
" $p init {path}\n" ++
" Create and initialise a package database at the location {path}.\n" ++
" Packages can be registered in the new database using the register\n" ++
- " command with --package-conf={path}. To use the new database with GHC,\n" ++
- " use GHC's -package-conf flag.\n" ++
+ " command with --package-db={path}. To use the new database with GHC,\n" ++
+ " use GHC's -package-db flag.\n" ++
"\n" ++
" $p register {filename | -}\n" ++
" Register the package using the specified installed package\n" ++
@@ -247,7 +247,7 @@ usageHeader prog = substProg prog $
" Regenerate the package database cache. This command should only be\n" ++
" necessary if you added a package to the database by dropping a file\n" ++
" into the database directory manually. By default, the global DB\n" ++
- " is recached; to recache a different DB use --user or --package-conf\n" ++
+ " is recached; to recache a different DB use --user or --package-db\n" ++
" as appropriate.\n" ++
"\n" ++
" Substring matching is supported for {module} in find-module and\n" ++
@@ -257,13 +257,13 @@ usageHeader prog = substProg prog $
" When asked to modify a database (register, unregister, update,\n"++
" hide, expose, and also check), ghc-pkg modifies the global database by\n"++
" default. Specifying --user causes it to act on the user database,\n"++
- " or --package-conf can be used to act on another database\n"++
+ " or --package-db can be used to act on another database\n"++
" entirely. When multiple of these options are given, the rightmost\n"++
" one is used as the database to act upon.\n"++
"\n"++
" Commands that query the package database (list, tree, latest, describe,\n"++
" field) operate on the list of databases specified by the flags\n"++
- " --user, --global, and --package-conf. If none of these flags are\n"++
+ " --user, --global, and --package-db. If none of these flags are\n"++
" given, the default is --global --user.\n"++
"\n" ++
" The following optional flags are also accepted:\n"
@@ -471,9 +471,9 @@ getPkgDatabases :: Verbosity
getPkgDatabases verbosity modify use_cache expand_vars my_flags = do
-- first we determine the location of the global package config. On Windows,
-- this is found relative to the ghc-pkg.exe binary, whereas on Unix the
- -- location is passed to the binary using the --global-config flag by the
+ -- location is passed to the binary using the --global-package-db flag by the
-- wrapper script.
- let err_msg = "missing --global-conf option, location of global package.conf unknown\n"
+ let err_msg = "missing --global-package-db option, location of global package database unknown\n"
global_conf <-
case [ f | FlagGlobalConfig f <- my_flags ] of
[] -> do mb_dir <- getLibDir
diff --git a/utils/ghc-pkg/ghc-pkg.wrapper b/utils/ghc-pkg/ghc-pkg.wrapper
index fad4bdfca0..3a14de1e22 100644
--- a/utils/ghc-pkg/ghc-pkg.wrapper
+++ b/utils/ghc-pkg/ghc-pkg.wrapper
@@ -1,5 +1,5 @@
#!/bin/sh
PKGCONF="$topdir/package.conf.d"
-exec "$executablename" --global-conf "$PKGCONF" ${1+"$@"}
+exec "$executablename" --global-package-db "$PKGCONF" ${1+"$@"}
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
index 4f4967e07f..8ec3fd0097 100644
--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -24,7 +24,7 @@ else
$(call removeFiles,$@)
echo "#!/bin/sh" >>$@
echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
- echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@
+ echo '$(TOP)/$< --global-package-db $$PKGCONF $${1+"$$@"}' >> $@
chmod +x $@
endif
@@ -38,7 +38,7 @@ else
$(call removeFiles,$@)
echo "#!/bin/sh" >>$@
echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
- echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@
+ echo '$(TOP)/$< --global-package-db $$PKGCONF $${1+"$$@"}' >> $@
chmod +x $@
endif
@@ -53,7 +53,7 @@ endif
#
utils/ghc-pkg/dist/build/tmp/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/Version.hs | bootstrapping/. $$(dir $$@)/. $(GHC_CABAL_INPLACE)
"$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-pkg/Main.hs -o $@ \
- -no-user-package-conf \
+ -no-user-$(GHC_PACKAGE_DB_FLAG) \
-Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \
$(SRC_HC_WARNING_OPTS) \
-DCABAL_VERSION=$(CABAL_VERSION) \