Closed chitrak7 closed 5 years ago
A simple hack that I have implemented is similar to those used by current make binaries. They are not putting binaries in bindir but scripts that point to binaries and put binaries in lib/bin folder. But this is not a nice approach. We have to make these paths configurable somehow.
The package database is relocatable, that's precisely the use for ${pkgroot}
. That's as much relocatability as we can get. There is no support for relocating librarys relative to the package db without chaning the repsective .conf
file and recaching the pacakge db.
What problem as we trying to solve here? The relocatability of the binary distribution is always wrt to moving bin
and lib
around, but keeping them in the same folder.
Yes, but the configure file gives an option for specifying directories such as bindir, libdir, and docdir apart from prefix. Although all these are relative, if someone changes it packages won't be accessible.
If you are installing into custom directories, the wrapper scripts should be installed. I think @alpmestan implemented that already, but might be wrong.
Note that libdir would still retain libraries relative to the package database, which are all in lib.
And only he tools would need to be informed about a different lib location via -B, hence the wrapper scripts when installing in custom locations.
Hmm no I don't think I ever got around to restoring the wrapper scripts just yet. This is what they looked like: https://github.com/snowleopard/hadrian/blob/fe5759b46cb9f04ba78a975c99a6d99b866d448e/src/Rules/Wrappers.hs
Whether it's really required to generate them or not is I think a call that we can only make in... the Makefile
of the bindist. When people have a bindist, all they need to do is unpack it, ./configure <some options>
, make install
. It is during the ./configure
bit that users get a chance to specify non-default bin/lib directories. We can react accordingly in the Makefile, depending on the layout requested by the configure step, to generate the wrapper scripts when bin
and lib
are not going to end up next to each other.
I have worked a bit in this regards. I looked into the database and think I can specify the libraries path using an additional --global-package-db flag to ghc-pkg wrapper. But still I could't figure out how to link docdir.
The file I linked to above gives the contents we want to put in each wrapper. And I don't any any of those cares about docdir, that one is probably only ever used as the target of a cp
/install
command somewhere and that's it. Maybe I misunderstood your problem though?
Consider the package info file for array. It has doc-dir feilds. haddock-interfaces: ${pkgroot}/../share/doc/x86_64-linux-ghc-8.5.20180611/array-0.5.2.0/html/array.haddock haddock-html: ${pkgroot}/../share/doc/x86_64-linux-ghc-8.5.20180611/array-0.5.2.0/html
Now if custom installation changes this directory, how will we handle this??
@angerman @alpmestan I have written a bit of code to write wrapper scripts with Makefile only. These scripts will be incorporated only when the relative path is changed, and we will put scripts in bindir, and rest will be copied as required. This could be a temporary hack. But still, I couldn't figure out what to do with docs?
@angerman @alpmestan I think we will need to generate wrapper scripts separately for each of the files. Should I add need rules for them? We can also copy the required wrappers. What should better?
Currently, fields in the binary distribution such as "include-dirs" etc are configured with respect to ${pkgroot} This doesn't allow changing the relative paths between them. I am stuck here as due to this, user-based configuration settings are not getting implemented. Can anyone give any pointers on how to tackle this issue? @angerman @alpmestan @snowleopard