Permalink
Browse files

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.
  • Loading branch information...
1 parent 6a831be commit ca2debb201bf44b518bc06a8d37ca1017ccf390f @pcapriotti pcapriotti committed May 4, 2012
View
@@ -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
@@ -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)
View
@@ -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))
@@ -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)
@@ -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
View
@@ -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
View
@@ -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)" \
View
@@ -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
#
@@ -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
@@ -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
@@ -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 {
@@ -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 \
View
@@ -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
@@ -1,5 +1,5 @@
#!/bin/sh
PKGCONF="$topdir/package.conf.d"
-exec "$executablename" --global-conf "$PKGCONF" ${1+"$@"}
+exec "$executablename" --global-package-db "$PKGCONF" ${1+"$@"}
@@ -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) \

0 comments on commit ca2debb

Please sign in to comment.