sof patch for --ghc-pkg-config-file=

Emailing to libraries@, please followup to cabal-devel. Here's a patch from Sigbjorn which adds --ghc-pkg-config-file= to cabal. This is an oldish patch, but I haven't stopped getting requests for this feature :) This allows you to create a "local" package config file, rather than using the --user or --global files, this is useful for in-place building, as when you're developing a set of related packages. I still have some debate about whether this patch should go in; it assumes a model of package registration where you have a config file (as opposed to a directory) which isn't the case for nhc or Hugs. But the idea doesn't seem to bother anyone but me, and the flag is clearly marked as a ghc-related flag, so I'm thinking of letting it through. Opinions? Does anyone want to massage this to work w/ the current cabal head? peace, isaac ------------------------------------------------------------ Changed paths: M /Distribution/Make.hs M /Distribution/Setup.hs M /Distribution/Simple/Build.hs M /Distribution/Simple/Configure.hs M /Distribution/Simple/GHCPackageConfig.hs M /Distribution/Simple/Install.hs M /Distribution/Simple/LocalBuildInfo.hs M /Distribution/Simple/Register.hs M /Distribution/Simple.hs M /tests/ModuleTest.hs A couple of extensions: - support for specifying what GHC package configuration file to use during (un)registration. Specified via the command-line option --ghc-pkg-config-file=<path> which is understood by 'configure', 'install', 'register', and 'unregister' commands. - better handling of package-specific header files during installation. If you use the Include-Dirs: and Includes: fields in your .cabal file to refer to package-local header files and directories, these will be created&copied during 'install'. i.e., suppose you spec the following: Include-Dirs: /usr/local/include/openssl, include Includes: include/openssl-exts.h, +openssl/openssl.h The 'install' action will emit the following ghc-pkg fields when updating/installing the GHC package: include_dirs = [ "/usr/local/include/openssl", "/path/to/your/pkg/installation/lib/directory/include"] c_includes = [ "openssl-exts.h", "openssl/openssl.h"] and creates the directory in include_dirs's second element, followed by copying openssl-exts.h into that directory. Note: - only directories that don't start with '/' are created inside the package's install directory. - Includes: entries that are prefixed with '+' are assumed to be referring to non-package header files and aren't (attempted) copied into the package's installation tree. Bit of a twiddly hack, but supporting the distinction between package and non-package header files does seem to be necessary.

On Fri, 2006-09-15 at 10:06 -0700, Isaac Jones wrote:
Emailing to libraries@, please followup to cabal-devel.
Here's a patch from Sigbjorn which adds --ghc-pkg-config-file= to cabal. This is an oldish patch, but I haven't stopped getting requests for this feature :)
This allows you to create a "local" package config file, rather than using the --user or --global files, this is useful for in-place building, as when you're developing a set of related packages.
I still have some debate about whether this patch should go in; it assumes a model of package registration where you have a config file (as opposed to a directory) which isn't the case for nhc or Hugs. But the idea doesn't seem to bother anyone but me, and the flag is clearly marked as a ghc-related flag, so I'm thinking of letting it through. Opinions?
Note that there is already a register --inplace flag to register a package in the build tree. To allow multiple packages to be built against each other inplace we'd also need some flag for configure. Would this be enough? Do we really also need the ability to specify arbitrary package databases? What is the use case? (BTW, I'm not saying we don't need it, I'm just wondering what people want it for) Duncan

Duncan Coutts
On Fri, 2006-09-15 at 10:06 -0700, Isaac Jones wrote:
Emailing to libraries@, please followup to cabal-devel.
Here's a patch from Sigbjorn which adds --ghc-pkg-config-file= to cabal. This is an oldish patch, but I haven't stopped getting requests for this feature :)
This allows you to create a "local" package config file, rather than using the --user or --global files, this is useful for in-place building, as when you're developing a set of related packages.
I still have some debate about whether this patch should go in; it assumes a model of package registration where you have a config file (as opposed to a directory) which isn't the case for nhc or Hugs. But the idea doesn't seem to bother anyone but me, and the flag is clearly marked as a ghc-related flag, so I'm thinking of letting it through. Opinions?
Note that there is already a register --inplace flag to register a package in the build tree.
And this is mostly so you can build in the build tree, register to --user (or global), muck around a bit, and presumably unregister the package later.
To allow multiple packages to be built against each other inplace we'd also need some flag for configure.
To specify the package file location, you mean? I guess you could do something sloppy like: cd my-package ./setup build ./setup register --inplace --user cd my-other-package ./setup configure --user etc ghc-pkg unregister my-package --user (which is what I just did for cabal & cabal-install.)
Would this be enough? Do we really also need the ability to specify arbitrary package databases? What is the use case?
I think it's mainly for registering packages together in a build tree. peace, isaac

Isaac Jones wrote:
Duncan Coutts
writes: On Fri, 2006-09-15 at 10:06 -0700, Isaac Jones wrote:
Emailing to libraries@, please followup to cabal-devel.
Here's a patch from Sigbjorn which adds --ghc-pkg-config-file= to cabal. This is an oldish patch, but I haven't stopped getting requests for this feature :)
This allows you to create a "local" package config file, rather than using the --user or --global files, this is useful for in-place building, as when you're developing a set of related packages.
I still have some debate about whether this patch should go in; it assumes a model of package registration where you have a config file (as opposed to a directory) which isn't the case for nhc or Hugs. But the idea doesn't seem to bother anyone but me, and the flag is clearly marked as a ghc-related flag, so I'm thinking of letting it through. Opinions?
Note that there is already a register --inplace flag to register a package in the build tree.
And this is mostly so you can build in the build tree, register to --user (or global), muck around a bit, and presumably unregister the package later.
To allow multiple packages to be built against each other inplace we'd also need some flag for configure.
To specify the package file location, you mean?
I guess you could do something sloppy like:
cd my-package ./setup build ./setup register --inplace --user
cd my-other-package ./setup configure --user etc
ghc-pkg unregister my-package --user
(which is what I just did for cabal & cabal-install.)
Would this be enough? Do we really also need the ability to specify arbitrary package databases? What is the use case?
I think it's mainly for registering packages together in a build tree.
I imagine that the "local package database" idea would be what cabal-install uses when it builds multiple packages. Remember our discussion a while back about a developer working on a multi-package system? You want a way to build all the packages in dependency order, but without installing. Some way to specify a local package database is the missing piece to make this doable. We don't have to assume the package database is a file: as far as Cabal is concerned, the package database is just a FilePath that it passes to hc-pkg when it needs to modify the database in some way. If we can assume that a database can always be specified by a FilePath, then this is compiler-independent (except that perhaps we want an 'hc-pkg init' command, which we don't currently have). BTW, I think that this part of Sigbjorn's patch might be already addressed in current Cabal: - better handling of package-specific header files during installation. If you use the Include-Dirs: and Includes: fields in your .cabal file to refer to package-local header files and directories, these will be created&copied during 'install' Cheers, Simon
participants (3)
-
Duncan Coutts
-
Isaac Jones
-
Simon Marlow