Change the default stdlib location for Linux packaging (#21328)

* Correctly evaluate the Nim prefix on Posix

* Document new packaging layout
This commit is contained in:
Gabriel Huber
2023-02-12 16:41:27 +01:00
committed by GitHub
parent 642136ec4f
commit 6c15958a83
2 changed files with 17 additions and 12 deletions

View File

@@ -717,22 +717,24 @@ proc getPrefixDir*(conf: ConfigRef): AbsoluteDir =
## clone or using installed nim, so that these exist: `result/doc/advopt.txt`
## and `result/lib/system.nim`
if not conf.prefixDir.isEmpty: result = conf.prefixDir
else: result = AbsoluteDir splitPath(getAppDir()).head
else:
let binParent = AbsoluteDir splitPath(getAppDir()).head
when defined(posix):
if binParent == AbsoluteDir"/usr":
result = AbsoluteDir"/usr/lib/nim"
elif binParent == AbsoluteDir"/usr/local":
result = AbsoluteDir"/usr/local/lib/nim"
else:
result = binParent
else:
result = binParent
proc setDefaultLibpath*(conf: ConfigRef) =
# set default value (can be overwritten):
if conf.libpath.isEmpty:
# choose default libpath:
var prefix = getPrefixDir(conf)
when defined(posix):
if prefix == AbsoluteDir"/usr":
conf.libpath = AbsoluteDir"/usr/lib/nim"
elif prefix == AbsoluteDir"/usr/local":
conf.libpath = AbsoluteDir"/usr/local/lib/nim"
else:
conf.libpath = prefix / RelativeDir"lib"
else:
conf.libpath = prefix / RelativeDir"lib"
conf.libpath = prefix / RelativeDir"lib"
# Special rule to support other tools (nimble) which import the compiler
# modules and make use of them.

View File

@@ -69,8 +69,11 @@ Hints on the build process:
What to install:
- The expected stdlib location is /usr/lib/nim
- Global configuration files under /etc/nim
- The expected stdlib location is `/usr/lib/nim/lib`, previously it was just `/usr/lib/nim`
- `nimdoc.css` and `nimdoc.cls` from the `doc` folder should go into `/usr/lib/nim/doc/`
- `tools/nim-gdb.py` should go into `/usr/lib/nim/tools/`
- `tools/dochack/dochack.js` should be installed to `/usr/lib/nim/tools/dochack/`
- Global configuration files under `/etc/nim`
- Optionally: manpages, documentation, shell completion
- When installing documentation, .idx files are not required
- The "compiler" directory contains compiler sources and should not be part of the compiler binary package