From 7e8b4baaf563b7cd804b3b653d4823b9762f5c87 Mon Sep 17 00:00:00 2001 From: Drew Crampsie Date: Tue, 25 May 2021 09:48:59 -0700 Subject: [PATCH] ./configure && make && make install <-- install! --- Makefile.in | 47 +++++++--------------- doc/configure-and-make.org | 81 +++++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 70 deletions(-) diff --git a/Makefile.in b/Makefile.in index 7d63c18a2..a31df5177 100644 --- a/Makefile.in +++ b/Makefile.in @@ -36,15 +36,18 @@ mandir = @mandir@ LIBS = @LIBS@ -gerbil_home = "${prefix}/lib/${PACKAGE_SHORTNAME}" -gerbil_bin = "${gerbil_home}/bin" +gerbil_home = ${prefix}/lib/${PACKAGE_SHORTNAME} +gerbil_bin = "$(gerbil_home)/bin" gerbil_lib = "${gerbil_home}/lib" +gerbil_share = "${gerbil_home}/share" + + gerbil_bin_linkdir = "${prefix}/bin" +gerbil_share_linkdir = "${prefix}/share" gerbil_make_conf = @gerbil_make_conf@ gerbil: configure - echo "LIBXML:" $(foo) cd src && LDFLAGS="$(LIBS)" ./build.sh ensure-gx-version: @@ -67,44 +70,22 @@ r7rs-large: tools: cd src && LDFLAGS="$(LIBS)" ./build.sh tools -stage0: +stage0: configure cd src && LDFLAGS="$(LIBS)" ./build.sh stage0 stage1: cd src && LDFLAGS="$(LIBS)" ./build.sh stage1 layout: - cd src && LDFLAGS="$(LIBS)" ./build.sh layout + cd src && LDFLAGS="$(LIBS)" ./build.sh layout tags: cd src && LDFLAGS="$(LIBS)" ./build.sh tags install: -# Symlinks - mkdir -p ${gerbil_bin} ; - mkdir -p ${gerbil_lib} ; - cp -a bin/* ${gerbil_bin} ; - cp -a lib/* ${gerbil_lib} ; - @for i in `find ${gerbil_bin} -type f` ; do \ - _name=`basename $$i`;\ - _link="${gerbil_bin_linkdir}/$$_name" ; \ - mkdir -p "${gerbil_bin_linkdir}"; \ - if test -f $$_link ; then rm "$$_link" ; fi ;\ - echo "Linking $$_link to $$i"; \ - ln -sr $$i "$$_link" ; \ - done ; - - -uninstall: -# Symlinks - @for i in `find ${gerbil_bin} -type f` ; do \ - _name=`basename $$i`;\ - _link="${gerbil_bin_linkdir}/$$_name" ; \ - if test -L $$_link && test $$(dirname `readlink $$_link`) = ${gerbil_bin}; then \ - echo removing "$$_link" ; rm "$$_link" ; elif test -f "$$_link" ; then echo $$_link is not a link to $$i. Not removing. ; fi ; \ - done ; - - rm -rf ${gerbil_home}; - -test: - echo $(LIBS) ; + mkdir -p ${gerbil_bin} ${gerbil_share} ${gerbil_bin_linkdir} ${gerbil_share_linkdir} + cd src && ./install + cp -a --link --remove-destination ${gerbil_bin}/* ${gerbil_bin_linkdir} || \ + cp -a ${gerbil_bin}/* ${gerbil_bin_linkdir} + cp -a --link --remove-destination ${gerbil_share}/* ${gerbil_share_linkdir} || \ + cp -a ${gerbil_share}/* ${gerbil_share_linkdir} diff --git a/doc/configure-and-make.org b/doc/configure-and-make.org index 17e3062ec..3d37aa3c2 100644 --- a/doc/configure-and-make.org +++ b/doc/configure-and-make.org @@ -212,13 +212,51 @@ AC_OUTPUT We want a Makefile. The way this has worked over the last half-century or so is that we write scripts on scripts on scripts. This is no exception. -** `make configure` +** ~make configure~ + +We set ~$gerbil_make_conf~ in ~./configure~. *Gerbil* has ~./src/configure~. #+begin_src makefile :noweb-ref make-configure configure: ensure-gx-version cd src && ./configure $(gerbil_make_conf) --prefix=$(gerbil_home) #+end_src +** ~make install~ + +*Gerbil* has ~./src/install~ which does in fact do what we want for installing +to our ~${gerbil_home}~. But, We've (royal we, AKA drewc) decided that I'd love to install to ~/usr/local/~ and not have ~/usr/local/lib~ "polluted". + +Actually, there's a wee bit more than that, as for packaging we may want things to differ. In particular, we may want a few gerbils installed in the same place. + +So, we do as follows. + +#+begin_src makefile :noweb-ref gerbil_home +gerbil_home = ${prefix}/lib/${PACKAGE_SHORTNAME} +#+end_src + +Now *Gerbil* has its own ~bin/~ and ~share/~ directories which we'd actually +like to propagate as links, and its own ~lib/~ dir which is the main thing we do not want to propagate. + +#+begin_src makefile :noweb-ref gerbil_dirs +gerbil_bin = "$(gerbil_home)/bin" +gerbil_lib = "${gerbil_home}/lib" +gerbil_share = "${gerbil_home}/share" + + +gerbil_bin_linkdir = "${prefix}/bin" +gerbil_share_linkdir = "${prefix}/share" +#+end_src + +#+begin_src makefile :noweb-ref make-install +install: + mkdir -p ${gerbil_bin} ${gerbil_share} ${gerbil_bin_linkdir} ${gerbil_share_linkdir} + cd src && ./install + cp -a --link --remove-destination ${gerbil_bin}/* ${gerbil_bin_linkdir} || \ + cp -a ${gerbil_bin}/* ${gerbil_bin_linkdir} + cp -a --link --remove-destination ${gerbil_share}/* ${gerbil_share_linkdir} || \ + cp -a ${gerbil_share}/* ${gerbil_share_linkdir} +#+end_src + ** Version file: ./src/gerbil/runtime/gx-version.scm Essentially, that file only exists for releases. For "snapshots", that is to say @@ -280,15 +318,12 @@ mandir = @mandir@ LIBS = @LIBS@ -gerbil_home = "${prefix}/lib/${PACKAGE_SHORTNAME}" -gerbil_bin = "${gerbil_home}/bin" -gerbil_lib = "${gerbil_home}/lib" -gerbil_bin_linkdir = "${prefix}/bin" +<> +<> gerbil_make_conf = @gerbil_make_conf@ gerbil: configure - echo "LIBXML:" $(foo) cd src && LDFLAGS="$(LIBS)" ./build.sh <> @@ -308,47 +343,19 @@ r7rs-large: tools: cd src && LDFLAGS="$(LIBS)" ./build.sh tools -stage0: +stage0: configure cd src && LDFLAGS="$(LIBS)" ./build.sh stage0 stage1: cd src && LDFLAGS="$(LIBS)" ./build.sh stage1 layout: - cd src && LDFLAGS="$(LIBS)" ./build.sh layout + cd src && LDFLAGS="$(LIBS)" ./build.sh layout tags: cd src && LDFLAGS="$(LIBS)" ./build.sh tags -install: -# Symlinks - mkdir -p ${gerbil_bin} ; - mkdir -p ${gerbil_lib} ; - cp -a bin/* ${gerbil_bin} ; - cp -a lib/* ${gerbil_lib} ; - @for i in `find ${gerbil_bin} -type f` ; do \ - _name=`basename $$i`;\ - _link="${gerbil_bin_linkdir}/$$_name" ; \ - mkdir -p "${gerbil_bin_linkdir}"; \ - if test -f $$_link ; then rm "$$_link" ; fi ;\ - echo "Linking $$_link to $$i"; \ - ln -sr $$i "$$_link" ; \ - done ; - - -uninstall: -# Symlinks - @for i in `find ${gerbil_bin} -type f` ; do \ - _name=`basename $$i`;\ - _link="${gerbil_bin_linkdir}/$$_name" ; \ - if test -L $$_link && test $$(dirname `readlink $$_link`) = ${gerbil_bin}; then \ - echo removing "$$_link" ; rm "$$_link" ; elif test -f "$$_link" ; then echo $$_link is not a link to $$i. Not removing. ; fi ; \ - done ; - - rm -rf ${gerbil_home}; - -test: - echo $(LIBS) ; +<> #+END_SRC