-
Notifications
You must be signed in to change notification settings - Fork 181
Description
When building a package that uses libgap, it would be helpful if we could easily obtain the argv needed for GAP_Initialize(). We gained --print-gaproot in #4448, but this only prints the primary root with sysinfo.g in it.
There are at least two important gaproots that one might need to know. From Makefile.rules,
# generate a special main.c which sets SYS_DEFAULT_PATHS and then includes
# regular main.c; this is used to build the `gap-install` binary
build/main.c: sysinfo.gap
@echo "#define SYS_DEFAULT_PATHS \"$(libdir)/gap;$(datarootdir)/gap\"" > $@
@echo "#include \"$(abs_srcdir)/src/main.c\"" >> $@(You may also want $HOME/.gap, but that is knowable a priori.) We can actually obtain the first of those without --print-gaproot, by querying pkg-config:
$ echo $(pkg-config --variable=libdir libgap)/gap
/usr/lib/gap
The second however is elusive. When using make install, the build system puts lots of architecture-independent files there... such as lib/init.g... that we need to initialize libgap.
One easy option would be to put the datarootdir into the pkg-config file. Then we could query both it and libdir using pkg-config. Another would be to extend, or add a companion to --print-gaproot, depending on how official you want to make this. Either way would make life a bit easier, thanks :)