On Mon, Sep 29 2008, Adrien Pierard wrote:
With the new version of Gambit, I decided to take some time to fix the installer
What is the "installer"? Are you referring to the Makefiles in the Gambit-C source, as they pertain to unix? If so, I have some comments.
and chose to install gambit in
$prefix/bin/{gsi-$version,gsc-$version} $prefix/lib/gambit-c/$version $prefix/doc/gambit-c/$version $prefix/share/gambit-c/$version $prefix/info/gambit-c/$version $prefix/include/gambit-c/$version
(the hardcoded "gambit-c" couls also be a variable, for those who run only one version of gambit and want to install directly into the $prefix subtree.)
This should hopefully allow those who want to run several versions of gambit at once to do so (which explains the current behaviour of the installer),
IMHO, the current method is better than your suggestion for multiple version installation in /usr/local/. For the standard Gambit library package (libgambc4 and libgmabc4-dev) installation on Debian, the file layout is currently /usr/lib/libgambc.so.4.2.8 /usr/lib/libgambcgsc.so.4.2.8 /usr/lib/libgambcgsi.so.4.2.8 /usr/lib/gambc4/_eval#.scm /usr/lib/gambc4/_gambit#.scm /usr/lib/gambc4/_io#.scm /usr/lib/gambc4/_kernel#.scm /usr/lib/gambc4/_nonstd#.scm /usr/lib/gambc4/_num#.scm /usr/lib/gambc4/_repl#.scm /usr/lib/gambc4/_std#.scm /usr/lib/gambc4/_system#.scm /usr/lib/gambc4/_thread#.scm /usr/lib/gambc4/digest#.scm /usr/lib/gambc4/digest.scm /usr/lib/gambc4/gambit#.scm /usr/lib/gambc4/r4rs#.scm /usr/lib/gambc4/r5rs#.scm /usr/lib/gambc4/_gambc.c /usr/lib/gambc4/_gambcgsc.c /usr/lib/gambc4/_gambcgsi.c /usr/lib/libgambc.so.4 S /usr/lib/libgambcgsc.so.4 S /usr/lib/libgambcgsi.so.4 S /usr/lib/libgambcgsi.so S /usr/lib/libgambcgsc.so S /usr/lib/libgambc.so S The files marked with S are symlinks. Putting the supporting files in /usr/lib/gambc4 is a good idea, because we don't want to clutter up /usr/lib/, and we'd never find them in the hundreds of files in /usr/lib, anyway. (As an aside, the Gambit source is now creating three shared libs. This caused me some pain, because it's three times as much to move around during packaging if something changes. Why three?) Gambit has the possibility of creating stand-alone executables linked to a dynamic library. This is very nice, but one thing I haven't seen discussed is the backwards ABI compatibility. I've seen a hint that a Gambit executable will only run with the exact point version shared lib it was linked with. That would defeat the usefulness of the shared lib, because you'd either have to recompile all your Gambit executables on every upgrade, or maintain all previous versions of the library, which is impractical. You'd be far better off using static libs. Think about this in terms of other shared libs you work with! What I would hope is that any executable compiled with Gambit 4.X.X could be dynamically linked with any later 4.X.X shared lib. When ABI backwards compatibility is broken, then it's time for 5.0.0, a libgambc5 package, and /usr/lib/gambc5. I would hope this wouldn't happen more than once every couple of years, or less. I bring this up because I think the versioning scheme you are proposing differs from standard practice, especially for shared libs. As we move to Gambit-C 5, it might make sense to keep the libgambc4 package installed for awhile to support old apps built with Gambit-C 4 which haven't yet moved to Gambit-C 5. But it isn't practical to have a bunch of point release packages installed and tracked in the Debian infrastructure.
and also avoid clashes with names already taken by other binaires (such as ghostscript).
A different subject. Installing as gsi-4.2.9 is a little ugly, and doesn't really solve your name clash. What are you planning to call your man pages? How about using gambci and gambcc? That way, if people have scripts that call these executables, they won't have to constantly update them. On Debian, I'll just symlink gsi and gsc. We don't have a clash, I think because gambit was there first. Ghostscript is gs.
Yet, there's two issues for which I need your advice: - Where should I put syntax-case.scm?
I've got it in /usr/share/doc/gambc-doc/examples/syntax-case.scm.gz :-) but I would have no problem if it was in /usr/lib/gambc4/.
- What happens to the shortcut "~~" in file paths?
ideally, "~~" should be expanded by the binaries into the corresponding path (such as $prefix/lib/gambit-c/$version) where everything needed is found, and where I plan to put syntax-case.scm
"everything needed" ?? On Debian following a standard $ apt-get install gambc gambc-doc (path-expand "~~") -> "/usr" (Note that Debian and Ubuntu are currently at 4.2.8. Updates to these systems occur automatically during the system wide upgrades once gambc is installed for the first time. I'll upload the next release to unstable once Debian Lenny is released - RSN! I'm keeping unstable open in case an RC bug in 4.2.8 pops up which needs a fix. So far, so good.) The package installation system on Debian doesn't touch /usr/local/. I can install any number of vanilla upstream versions in /usr/local/Gambit-C/vX.X.X/, which can be helpful for development and packaging. When I do that, ~~ expands to /usr/local/Gambit-C/vX.X.X/. In other words, it always points at the current install tree. This is consistent, and works fine. If you want lib, then ~~/lib/ will do it, no matter which installation you're in. If you do change this, you will need to update the Gambit documentation, and worry about existing code. Note that with the current Debian configuration, the comments in the Gambit Manual Section 3.4.1 on compiler options are unnecessary, and so are -lm -ldl -lutil. Everything just works.
The aim of this "fix" is to make gambit fully portable and configurable on as many OSs as possible.
It's already pretty good. Most of the "fix" will just complicate things for the rest of us packagers. Packaging is usually done in two stages. First, build and do a dummy installation in a suitable place. I do something like $(MAKE) install prefix=$(CURDIR)/debian/tmp/usr \ PACKAGE_SUBDIR="" ^^^^^^^^^^^^^^^^^ this gets rid of the v4.2.8/ Then install the files into the final locations in the package from there using your distro's packaging tools and brute force, in some clever combination. The locations can differ from what you might consider a unix "standard". For example, on Debian the info files go into /usr/share/info, and the docs into /usr/share/doc/gambc-doc/ It seems that you are planning on changing the first stage (what Gambit's make install does) to make it more convenient for your purposes. Fine, but you are going to cause the other packagers pain, because we've already worked out all these details and will have to modify our packaging to undo your "fix". OTOH, putting the supporting files in .../lib/gambc4 is a good thing. I've included a couple of patches below to give you an idea of what's involved. The first one shows how the soname is created, and is something that might be good to add to the Gambit-C source. The second one allows Gambit to find the supporting files in /usr/lib/gambc4. Right now, it needs a bootstrap, and it would be nice if that could be eliminated. -- KBK #!/bin/sh /usr/share/dpatch/dpatch-run ## 100_pass_soname_when_linking.dpatch by Kurt B. Kaiser <kbk@shore.net> ## ## DP: Support passing soname when linking libgambc; install libgambc as ## DP: libgambc.so.4 and install links libgambc.so.4 and libgambc.so ## DP: Also do the same for libgambcgsc.so and libgambcgsi.so ## DP: Upstream is now creating three shared libs. @DPATCH@ diff -urNad gambc~/configure.ac gambc/configure.ac --- gambc~/configure.ac 2008-06-04 18:20:15.000000000 -0400 +++ gambc/configure.ac 2008-06-04 18:20:17.000000000 -0400 @@ -12,6 +12,19 @@ PACKAGE_SUBDIR="/$PACKAGE_VERSION" #PACKAGE_SUBDIR="" +LIB_NAME="lib$PACKAGE_SHORTNAME" +TRIPLET_VERSION=$(echo $PACKAGE_VERSION | sed -e "s/v//") +LIB_VERSION=${LIB_NAME}.so.$TRIPLET_VERSION +LIB_SONAME=${LIB_NAME}.so.4 + +GSC_LIB_NAME=${LIB_NAME}gsc +GSC_LIB_VERSION=${GSC_LIB_NAME}.so.$TRIPLET_VERSION +GSC_LIB_SONAME=${GSC_LIB_NAME}.so.4 + +GSI_LIB_NAME=${LIB_NAME}gsi +GSI_LIB_VERSION=${GSI_LIB_NAME}.so.$TRIPLET_VERSION +GSI_LIB_SONAME=${GSI_LIB_NAME}.so.4 + AC_SUBST(PACKAGE_SHORTNAME) AC_SUBST(PACKAGE_NAME) AC_SUBST(PACKAGE_VERSION) @@ -1196,6 +1209,14 @@ SETDLPATH="LIBPATH=\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${LIBPATH}" ;; + # Debian: + linux* | kfreebsd* | hurd*) + GAMBCLIB=$LIB_VERSION + GAMBCGSCLIB=$GSC_LIB_VERSION + GAMBCGSILIB=$GSI_LIB_VERSION + SETDLPATH="LD_LIBRARY_PATH=\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${LD_LIBRARY_PATH}" + ;; + *) GAMBCLIB="libgambc.so" GAMBCGSCLIB="libgambcgsc.so" GAMBCGSILIB="libgambcgsi.so" @@ -1203,8 +1224,18 @@ ;; esac - MAKE_LIBRARY='$(C_COMPILER) $(FLAGS_LIB) -o $(LIBRARY) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_LIBS) $(LIBS)' - MAKE_LIBRARY_FOR_INSTALL='$(C_COMPILER) $(FLAGS_LIB) -o $(LIBRARY) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_FOR_INSTALL_LIBS) $(LIBS)' + if test $GAMBCLIB = $LIB_VERSION; then + MAKE_LIBRARY='$(C_COMPILER) $(FLAGS_LIB) -Wl,-soname,$(LIB_SONAME) -o $(LIBRARY) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_LIBS) $(LIBS)' + else + MAKE_LIBRARY='$(C_COMPILER) $(FLAGS_LIB) -o $(LIBRARY) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_LIBS) $(LIBS)' + fi + + if test $GAMBCLIB = $LIB_VERSION; then + MAKE_LIBRARY_FOR_INSTALL='$(C_COMPILER) $(FLAGS_LIB) -Wl,-soname,$(LIB_SONAME) -o $(LIBRARY) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_FOR_INSTALL_LIBS) $(LIBS)' + else + MAKE_LIBRARY_FOR_INSTALL='$(C_COMPILER) $(FLAGS_LIB) -o $(LIBRARY) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_FOR_INSTALL_LIBS) $(LIBS)' + fi + FIXLIB='#' LINK='$(C_COMPILER) $(FLAGS_EXE) $(EXECUTABLE_OBJECTS) $(LINK_LIBS) $(LIBS) -o $(EXECUTABLE)' LINK_FOR_INSTALL='$(C_COMPILER) $(FLAGS_EXE) $(EXECUTABLE_OBJECTS) $(LINK_FOR_INSTALL_LIBS) $(LIBS) -o $(EXECUTABLE)' @@ -1341,6 +1372,10 @@ AC_SUBST(bat) AC_SUBST(SETDLPATH) AC_SUBST(GSC_CC_O) +AC_SUBST(LIB_VERSION) +AC_SUBST(LIB_SONAME) +AC_SUBST(GSC_LIB_SONAME) +AC_SUBST(GSI_LIB_SONAME) AC_SUBST(GAMBCLIB) AC_SUBST(GAMBCGSCLIB) AC_SUBST(GAMBCGSILIB) diff -urNad gambc~/gsc/makefile.in gambc/gsc/makefile.in --- gambc~/gsc/makefile.in 2008-06-04 18:20:15.000000000 -0400 +++ gambc/gsc/makefile.in 2008-06-04 18:20:17.000000000 -0400 @@ -30,8 +30,10 @@ LIBS = @LIBS@ GAMBCLIB = @GAMBCLIB@ +LIB_VERSION = @LIB_VERSION@ GAMBCGSCLIB = @GAMBCGSCLIB@ GAMBCGSILIB = @GAMBCGSILIB@ +LIB_SONAME = @GSC_LIB_SONAME@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIB = @INSTALL_LIB@ @@ -146,6 +148,11 @@ $(LIBRARY): $(LIBRARY_OBJECTS_IN_COMPILE_ORDER) rm -f $(LIBRARY) @MAKE_LIBRARY@ + # needed for bootstrap: + if test $(GAMBCLIB) = $(LIB_VERSION); then \ + ln -sf $(GAMBCGSCLIB) $(LIB_SONAME); \ + ln -sf $(LIB_SONAME) libgambcgsc.so; \ + fi _gambcgsc.c: $(LIBRARY_MODULES_C) $(rootfromhere)/lib/_gambc.c @SETDLPATH@ $(rootfromhere)/gsc-comp -:=$(srcdirpfx)$(rootfromhere) -f -link -l $(srcdirpfx)$(rootfromhere)/lib/_gambc -o $@ $(LIBRARY_MODULES_C) @@ -182,6 +189,11 @@ $(INSTALL_DATA) $(srcdirpfx)_gambcgsc.c $(libdir)/_gambcgsc.c @MAKE_LIBRARY_FOR_INSTALL@ $(INSTALL_LIB) $(LIBRARY) $(libdir)/$(LIBRARY) + if test $(GAMBCLIB) = $(LIB_VERSION); then \ + cd $(libdir); \ + ln -sf $(GAMBCGSCLIB) $(LIB_SONAME); \ + ln -sf $(LIB_SONAME) libgambcgsc.so; \ + fi @FIXLIB@ $(libdir)/$(LIBRARY) #for library in $(LIBRARIES_SCM); do \ # $(INSTALL_DATA) $$library $(libdir)/$$library; \ @@ -193,6 +205,8 @@ uninstall-post: rm -f $(bindir)/$(EXECUTABLE) + rm -f $(libdir)/$(LIB_SONAME) + rm -f $(libdir)/libgambcgsc.so mostlyclean-pre: diff -urNad gambc~/gsi/makefile.in gambc/gsi/makefile.in --- gambc~/gsi/makefile.in 2008-06-04 18:20:15.000000000 -0400 +++ gambc/gsi/makefile.in 2008-06-04 18:20:42.000000000 -0400 @@ -30,8 +30,10 @@ LIBS = @LIBS@ GAMBCLIB = @GAMBCLIB@ +LIB_VERSION = @LIB_VERSION@ GAMBCGSCLIB = @GAMBCGSCLIB@ GAMBCGSILIB = @GAMBCGSILIB@ +LIB_SONAME = @GSI_LIB_SONAME@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIB = @INSTALL_LIB@ @@ -166,6 +168,11 @@ $(INSTALL_DATA) $(srcdirpfx)_gambcgsi.c $(libdir)/_gambcgsi.c @MAKE_LIBRARY_FOR_INSTALL@ $(INSTALL_LIB) $(LIBRARY) $(libdir)/$(LIBRARY) + if test $(GAMBCLIB) = $(LIB_VERSION); then \ + cd $(libdir); \ + ln -sf $(GAMBCGSILIB) $(LIB_SONAME); \ + ln -sf $(LIB_SONAME) libgambcgsi.so; \ + fi @FIXLIB@ $(libdir)/$(LIBRARY) #for library in $(LIBRARIES_SCM); do \ # $(INSTALL_DATA) $$library $(libdir)/$$library; \ @@ -177,6 +184,8 @@ uninstall-post: rm -f $(bindir)/$(EXECUTABLE) + rm -f $(libdir)/$(LIB_SONAME) + rm -f $(libdir)/libgambcgsi.so mostlyclean-pre: diff -urNad gambc~/lib/makefile.in gambc/lib/makefile.in --- gambc~/lib/makefile.in 2008-06-04 18:20:15.000000000 -0400 +++ gambc/lib/makefile.in 2008-06-04 18:20:17.000000000 -0400 @@ -30,6 +30,8 @@ LIBS = @LIBS@ GAMBCLIB = @GAMBCLIB@ +LIB_VERSION = @LIB_VERSION@ +LIB_SONAME = @LIB_SONAME@ GAMBCCOMPLIB = @GAMBCCOMPLIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -117,6 +119,11 @@ $(LIBRARY): $(LIBRARY_OBJECTS_IN_COMPILE_ORDER) rm -f $(LIBRARY) @MAKE_LIBRARY@ + # needed for bootstrap: + if test $(GAMBCLIB) = $(LIB_VERSION); then \ + ln -sf $(GAMBCLIB) $(LIB_SONAME); \ + ln -sf $(LIB_SONAME) libgambc.so; \ + fi _gambc.c: $(MODULES_C) @SETDLPATH@ $(rootfromhere)/gsc-comp -:=$(srcdirpfx)$(rootfromhere) -f -link -flat -o _gambc.c $(MODULES_C) @@ -166,6 +173,11 @@ $(srcdirpfx)$(rootfromhere)/mkidirs $(libdir) $(INSTALL_DATA) $(srcdirpfx)_gambc.c $(libdir)/_gambc.c $(INSTALL_LIB) $(LIBRARY) $(libdir)/$(LIBRARY) + if test $(GAMBCLIB) = $(LIB_VERSION); then \ + cd $(libdir); \ + ln -sf $(GAMBCLIB) $(LIB_SONAME); \ + ln -sf $(LIB_SONAME) libgambc.so; \ + fi @FIXLIB@ $(libdir)/$(LIBRARY) for library in $(LIBRARIES_SCM); do \ $(INSTALL_DATA) $$library $(libdir)/$$library; \ @@ -176,6 +188,8 @@ uninstall-post: rm -f $(libdir)/_gambc.c rm -f $(libdir)/$(LIBRARY) + rm -f $(libdir)/$(LIB_SONAME) + rm -f $(libdir)/libgambc.so @for library in $(LIBRARIES_SCM); do \ rm -f $(libdir)/$$library; \ done ================================ It would be nice if this could be configured without requiring a bootstrap: #!/bin/sh /usr/share/dpatch/dpatch-run ## 99_move_base_link_file.dpatch by "Kurt B. Kaiser" <kbk@shore.net> ## ## DP: Find the compiler's base link file in lib/gambc4 instead of lib/ so ## DP: the user doesn't have to specify the path. It would be best if ## DP: this wasn't hard coded in Gambit-C. @DPATCH@ diff -urNad gambc~/gsc/_gsclib.scm gambc/gsc/_gsclib.scm --- gambc~/gsc/_gsclib.scm 2008-03-10 12:22:50.000000000 -0400 +++ gambc/gsc/_gsclib.scm 2008-06-05 09:20:01.000000000 -0400 @@ -244,7 +244,7 @@ (let ((gambcdir-lib (parameterize ((##current-directory - (##path-expand "lib" (##path-expand "~~")))) + (##path-expand "lib/gambc4" (##path-expand "~~")))) (##current-directory)))) (##string-append gambcdir-lib "_gambc")) (macro-force-vars (base)