bgarrigues pushed a commit to branch automake2 in repository groff. commit 68cd10314ce5368d8fb4060f5aefcbd612e5207b Author: Bertrand Garrigues <bertrand.garrig...@laposte.net> Date: Sat Sep 13 20:08:56 2014 +0200
- Add the 'current' symlink in the installation tree - Create localfontdir and systemtmacdir - Build in presence of a non-GNU troff: add a 'g' prefix to some programs, scripts, and man pages. --- Makefile.am | 129 +++++++++++++++++++++++++++++++++++++++++- TESTS | 37 ++++++++---- configure.ac | 3 + contrib/chem/chem.am | 2 +- doc/doc.am | 5 +- m4/groff.m4 | 2 + src/preproc/eqn/eqn.am | 6 +- src/preproc/grn/grn.am | 4 +- src/preproc/pic/pic.am | 4 +- src/preproc/refer/refer.am | 4 +- src/preproc/soelim/soelim.am | 4 +- src/preproc/tbl/tbl.am | 4 +- src/roff/nroff/nroff.am | 4 +- src/roff/troff/troff.am | 4 +- src/utils/indxbib/indxbib.am | 4 +- src/utils/lookbib/lookbib.am | 4 +- 16 files changed, 184 insertions(+), 36 deletions(-) diff --git a/Makefile.am b/Makefile.am index a24142c6..8b37cc9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -508,6 +508,9 @@ CLEANFILES = # gnulib asks to include this file EXTRA_DIST = gnulib_m4/gnulib-cache.m4 FONTFILES = +PREFIXMAN1 = +PREFIXMAN5 = +PREFIXMAN7 = man1_MANS = man5_MANS = man7_MANS = @@ -526,6 +529,33 @@ AM_TESTS_ENVIRONMENT = \ abs_top_builddir=$(abs_top_builddir) \ export abs_top_srcdir abs_top_builddir; +# We use Automake's Uniform Naming Scheme. +# +# prefixexecbin_PROGRAMS is the list of programs that may have a +# NAMEPREFIX if an existing non-GNU troff system was detected. +# +# This is done by the m4 macro GROFF_G that checks for the presence of +# GNU Troff built-in \n[.g] macro. If a Unix Troff binary was +# detected, the following programs and scripts names will have a 'g' +# prefix: chem, tbl, eqn, neqn, pic, soleimm grn, refer, lookbib, +# troff, nroff. Also, PROG_PREFIX will be set to 'g' in the generated +# header defs.h so that these programs could be called correctly. +# +# prefixexecbindir is used to temporary install these programs. They +# are then moved to bindir during the install-exec-hook. Same thing +# for the scripts. +NAMEPREFIX=$(g) +prefixexecbin_PROGRAMS = +prefixexecbin_SCRIPTS = +if USEPROGRAMPREFIX +# We use datadir because the uninstall rule for the PROGRAMS attempt +# to cd into prefixexecbindir, and thus if prefixexecbindir is removed +# two consecutive uninstall would fail +prefixexecbindir = $(datadir) +else +prefixexecbindir = $(bindir) +endif + # Path to binaries and flags used by contribs and doc to generated doc. # These may be overridden if cross-compiling. GROFFBIN = $(abs_top_builddir)/groff @@ -624,6 +654,79 @@ BUILT_SOURCES += defs.h # possible lib/localcharset.$(OBJEXT): lib/configmake.h +# if there is a name prefix we install the man pages by hand +all: generate_man_files +install-data-hook: install-prefix-man +uninstall-hook: uninstall-prefix-man +if USEPROGRAMPREFIX +generate_man_files: $(PREFIXMAN1) +install-prefix-man: + for f in $(PREFIXMAN1); do \ + manfile_final_name=`basename $$f | sed 's/n$$/1/'`; \ + cp -f $$f $(DESTDIR)$(man1dir)/$(NAMEPREFIX)$$manfile_final_name; \ + done + for f in $(PREFIXMAN5); do \ + manfile_final_name=`basename $$f | sed 's/n$$/5/'`; \ + cp -f $$f $(DESTDIR)$(man5dir)/$(NAMEPREFIX)$$manfile_final_name; \ + done + for f in $(PREFIXMAN7); do \ + manfile_final_name=`basename $$f | sed 's/n$$/7/'`; \ + cp -f $$f $(DESTDIR)$(man7dir)/$(NAMEPREFIX)$$manfile_final_name; \ + done +uninstall-prefix-man: + for f in $(PREFIXMAN1); do \ + manfile_final_name=`basename $$f | sed 's/n$$/1/'`; \ + rm -f $(DESTDIR)$(man1dir)/$(NAMEPREFIX)$$manfile_final_name; \ + done + for f in $(PREFIXMAN5); do \ + manfile_final_name=`basename $$f | sed 's/n$$/5/'`; \ + rm -f $(DESTDIR)$(man5dir)/$(NAMEPREFIX)$$manfile_final_name; \ + done + for f in $(PREFIXMAN7); do \ + manfile_final_name=`basename $$f | sed 's/n$$/7/'`; \ + rm -f $(DESTDIR)$(man7dir)/$(NAMEPREFIX)$$manfile_final_name; \ + done +else +man1_MANS += $(PREFIXMAN1) +man1_MANS += $(PREFIXMAN5) +man1_MANS += $(PREFIXMAN7) +install-prefix-man: +uninstall-prefix-man: +generate_man_files: +endif + +# Hook to create the 'current' symlink +install-data-hook: create_current_symlink +create_current_symlink: + cd $(DESTDIR)$(dataprogramdir); \ + rm -f current; \ + $(LN_S) $(VERSION) current + +# Hook to move the binaries that potentially have a prefix from +# prefixexecbindir to bindir. +install-exec-hook: move_binaries_with_prefix +move_binaries_with_prefix: +if USEPROGRAMPREFIX + if test -n "$(NAMEPREFIX)"; then \ + for f in $(prefixexecbin_PROGRAMS) $(prefixexecbin_SCRIPTS); do \ + mv -f $(DESTDIR)$(prefixexecbindir)/$$f$(EXEEXT) \ + $(DESTDIR)$(bindir)/$(NAMEPREFIX)$$f$(EXEEXT); \ + done \ + fi +endif + +# Always create the site-font directory as a guide to the user. +install-data-hook: install_site_font +install_site_font: + -test -d $(DESTDIR)$(localfontdir) \ + || $(mkinstalldirs) $(DESTDIR)$(localfontdir) + +# Create systemtmacdir if not present +install-data-hook: install_tmacdir +install_tmacdir: + -test -d $(DESTDIR)$(systemtmacdir) \ + || $(mkinstalldirs) $(DESTDIR)$(systemtmacdir) + # directories specific to groff uninstall-hook: uninstall_groffdirs uninstall_groffdirs: @@ -633,12 +736,23 @@ uninstall_groffdirs: rmdir $(DESTDIR)$(datasubdir); \ fi if test -d $(DESTDIR)$(dataprogramdir); then \ + if test -h $(DESTDIR)$(dataprogramdir)/current; then \ + rm -f $(DESTDIR)$(dataprogramdir)/current; \ + fi; \ + if test -d $(DESTDIR)$(localfontdir); then \ + rm -f $(DESTDIR)$(localfontdir)/*; \ + rmdir $(DESTDIR)$(localfontdir); \ + fi; \ rmdir $(DESTDIR)$(dataprogramdir); \ fi if test -d $(DESTDIR)$(grog_dir); then \ rmdir $(DESTDIR)$(grog_dir); \ fi if test -d $(DESTDIR)$(libprogramdir); then \ + if test -d $(DESTDIR)$(systemtmacdir); then \ + rm -f $(DESTDIR)$(systemtmacdir)/*; \ + rmdir $(DESTDIR)$(systemtmacdir); \ + fi; \ rmdir $(DESTDIR)$(libprogramdir); \ fi if test -d $(DESTDIR)$(docdir); then \ @@ -651,6 +765,17 @@ uninstall_groffdirs: rmdir $(DESTDIR)$(docdir); \ fi +# Uninstall program that have a 'g' prefix +uninstall-hook: uninstall_binaries_with_prefix +uninstall_binaries_with_prefix: +if USEPROGRAMPREFIX + if test -n "$(NAMEPREFIX)"; then \ + for f in $(prefixexecbin_PROGRAMS) $(prefixexecbin_SCRIPTS); do \ + rm -f $(DESTDIR)$(bindir)/$(NAMEPREFIX)$$f$(EXEEXT); \ + done; \ + fi +endif + # Other files that should be present in the distribution tarball. EXTRA_DIST += \ BUG-REPORT \ @@ -676,7 +801,9 @@ EXTRA_DIST += \ README.MinGW \ arch/djgpp -MOSTLYCLEANFILES += $(man1_MANS) $(man5_MANS) $(man7_MANS) $(bin_SCRIPTS) +MOSTLYCLEANFILES += $(prefixexecbin_SCRIPTS) $(bin_SCRIPTS) \ + $(man1_MANS) $(man5_MANS) $(man7_MANS) \ + $(PREFIXMAN1) $(PREFIXMAN5) $(PREFIXMAN7) # Rule to build .man files. The brackets around the @ are used to prevent the # substitution of the variable by automake. diff --git a/TESTS b/TESTS index b2e9689..6dffc47 100644 --- a/TESTS +++ b/TESTS @@ -256,6 +256,8 @@ The following files remain (this is expected): - Makefile - config.status - config.log + - doc/groff.info-1 + - doc/groff.info-3 - src/include/config.h - src/include/stamp-h1 - .deps directories and .dirstamp files @@ -317,8 +319,7 @@ Differences with former build system: - Programs from 'src' installed in $(DESTDIR)/usr/local/bin: - man files from man, src are installed in - $(DESTDIR)/usr/local/share/man/man1, man5 and man7 (TODO: - remaining man files from contrib) + $(DESTDIR)/usr/local/share/man/man1, man5 and man7. - $(DESTDIR)/usr/local/share/groff/1.22.2/eign (from src/utils/indxbib) @@ -341,8 +342,7 @@ Differences with former build system: strictly identical to the one install by the original build system. - - contrib scripts installed in $(DESTDIR)/usr/local/bin (TODO: - remaining contrib) + - contrib scripts installed in $(DESTDIR)/usr/local/bin - contrib/chem: @@ -399,16 +399,12 @@ Diff with previous build system: TODO: - - create the 'current' symlink - - The original build system might uses tmac_s_prefix, tmac_an_prefix, tmac_wrap and sys_tmac_prefix during the installation of some tmac files but set these variables to an empty value in tmac/Makefile.sub, I don't quite understand how these variables could be set. - - Add automake conditional for examples, html, and doc in `contrib'. - - When contrib and doc will be completed, full installation tree comparison with the tree installed by the old build system. Note: to ease tree comparison, it is usefull to touch all .man files in @@ -432,6 +428,8 @@ TODO: │ ├── lib │ └── share │ ├── doc + │ ├── info + │ │ └── dir │ └── man │ ├── man1 │ ├── man5 @@ -441,7 +439,7 @@ TODO: └── X11 └── app-defaults -14 directories, 0 files +15 directories, 1 file - Notes: -- $(DESTDIR)/usr/local/lib/charset.alias is removed if exists @@ -465,8 +463,6 @@ TODO: TESTS - Missing files/directories (TODO): - contrib/ - doc/ test-groff.in - Files/directories not present in the git tree that are @@ -571,7 +567,24 @@ in the install tree). Diff with old build system: On the old build system, $(DESTDIR)/usr/local/share/doc/groff-1.22.2/examples/ideal/files is always installed, no matter which option is passed, which is a bug. - + +3.3 Build in presence of an non-GNU Troff installation + + - To simulate the existence of a non-GNU Troff, removed any existing + troff, and added a dummy troff script in /usr/bin/troff that + contains: + + #!/bin/sh + echo 0 + + and built groff as usuall. + + - Programs listed in prefixexecbin_PROGRAMS, scripts listed in + prefixecbin_SCRIPTS and man pages listed in PREFIXMAN1 are + correctly installed with a 'g' prefix. All targets (clean, + install/uninstall, distcheck) work as usual. No diff with the old + build system. + Notes ----- diff --git a/configure.ac b/configure.ac index a60282f..ef7bba9 100644 --- a/configure.ac +++ b/configure.ac @@ -183,6 +183,9 @@ gl_LOCALCHARSET # src/libs/libxutil AM_CONDITIONAL([WITHOUT_X11], [test "x$groff_no_x" = "xyes"]) +# Some programs have a "g" prefix if an existing groff installation is detected +AM_CONDITIONAL([USEPROGRAMPREFIX], [test x$g = xg]) + AM_CONDITIONAL([BUILD_INFODOC], [test -n "$make_infodoc"]) AM_CONDITIONAL([BUILD_HTML], [test -n "$make_htmldoc"]) AM_CONDITIONAL([BUILD_HTMLEXAMPLES], [test -n "$make_htmlexamples"]) diff --git a/contrib/chem/chem.am b/contrib/chem/chem.am index b46b488..2e7cac6 100644 --- a/contrib/chem/chem.am +++ b/contrib/chem/chem.am @@ -24,7 +24,7 @@ ######################################################################## chem_srcdir = $(top_srcdir)/contrib/chem -bin_SCRIPTS += chem +prefixexecbin_SCRIPTS += chem # Files installed in $(datasubdir)/pic chempicdir = $(datasubdir)/pic diff --git a/doc/doc.am b/doc/doc.am index f6df5ea..905ab2d 100644 --- a/doc/doc.am +++ b/doc/doc.am @@ -326,7 +326,10 @@ EXTRA_DIST += doc/groff.texi doc/fdl.texi fi # Targets to make all the doc in all formats. These doc are not built -# by default. +# by default. pdf, dvi, ps, html and their install equivalent +# install-pdf, install-dvi, install-ps, install-html are standard +# Automake targets. + doc: doc_all doc_all: doc_txt dvi pdf html doc_txt: doc/groff.txt diff --git a/m4/groff.m4 b/m4/groff.m4 index 5ba4a39..f7e30fb 100644 --- a/m4/groff.m4 +++ b/m4/groff.m4 @@ -894,6 +894,8 @@ AC_DEFUN([GROFF_TMAC], AC_SUBST([tmac_wrap])]) +# Searching if a non-GNU Troff is installed. The built-in register +# \n[.g] is always 1 in GNU Troff. AC_DEFUN([GROFF_G], [AC_MSG_CHECKING([for existing troff installation]) if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then diff --git a/src/preproc/eqn/eqn.am b/src/preproc/eqn/eqn.am index addc159..3369a17 100644 --- a/src/preproc/eqn/eqn.am +++ b/src/preproc/eqn/eqn.am @@ -16,8 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -bin_PROGRAMS += eqn -bin_SCRIPTS += neqn +prefixexecbin_PROGRAMS += eqn +prefixexecbin_SCRIPTS += neqn eqn_CPPFLAGS = \ $(AM_CPPFLAGS) \ -I $(top_srcdir)/src/preproc/eqn \ @@ -43,7 +43,7 @@ eqn_SOURCES = \ src/preproc/eqn/pbox.h \ src/preproc/eqn/eqn.h -man1_MANS += src/preproc/eqn/eqn.n src/preproc/eqn/neqn.n +PREFIXMAN1 += src/preproc/eqn/eqn.n src/preproc/eqn/neqn.n EXTRA_DIST += \ src/preproc/eqn/TODO \ src/preproc/eqn/neqn.sh \ diff --git a/src/preproc/grn/grn.am b/src/preproc/grn/grn.am index 2aa7e65..f61d893 100644 --- a/src/preproc/grn/grn.am +++ b/src/preproc/grn/grn.am @@ -1,4 +1,4 @@ -bin_PROGRAMS += grn +prefixexecbin_PROGRAMS += grn grn_SOURCES = \ src/preproc/grn/hdb.cpp \ src/preproc/grn/hpoint.cpp \ @@ -7,5 +7,5 @@ grn_SOURCES = \ src/preproc/grn/gprint.h src/preproc/grn/main.$(OBJEXT): defs.h grn_LDADD = lib/libgnu.a libgroff.a $(LIBM) -man1_MANS += src/preproc/grn/grn.n +PREFIXMAN1 += src/preproc/grn/grn.n EXTRA_DIST += src/preproc/grn/README src/preproc/grn/grn.man diff --git a/src/preproc/pic/pic.am b/src/preproc/pic/pic.am index 16ec882..94dd1ed 100644 --- a/src/preproc/pic/pic.am +++ b/src/preproc/pic/pic.am @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -bin_PROGRAMS += pic +prefixexecbin_PROGRAMS += pic pic_LDADD = libgroff.a $(LIBM) pic_SOURCES = \ src/preproc/pic/pic.ypp \ @@ -36,7 +36,7 @@ pic_SOURCES = \ pic_CPPFLAGS = $(AM_CPPFLAGS) \ -I $(top_srcdir)/src/preproc/pic \ -I $(top_builddir)/src/preproc/pic -man1_MANS += src/preproc/pic/pic.n +PREFIXMAN1 += src/preproc/pic/pic.n src/preproc/pic/pic-lex.$(OBJEXT): src/preproc/pic/pic.hpp EXTRA_DIST += src/preproc/pic/pic.n src/preproc/pic/TODO diff --git a/src/preproc/refer/refer.am b/src/preproc/refer/refer.am index 4700a41..8cd9886 100644 --- a/src/preproc/refer/refer.am +++ b/src/preproc/refer/refer.am @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -bin_PROGRAMS += refer +prefixexecbin_PROGRAMS += refer refer_CPPFLAGS = $(AM_CPPFLAGS) -I $(top_srcdir)/src/preproc/refer refer_LDADD = libbib.a libgroff.a $(LIBM) refer_SOURCES = \ @@ -29,7 +29,7 @@ refer_SOURCES = \ src/preproc/refer/ref.h \ src/preproc/refer/token.h \ src/preproc/refer/command.h -man1_MANS += src/preproc/refer/refer.n +PREFIXMAN1 += src/preproc/refer/refer.n EXTRA_DIST += src/preproc/refer/TODO src/preproc/refer/refer.man CLEANFILES += \ src/preproc/refer/label.cpp \ diff --git a/src/preproc/soelim/soelim.am b/src/preproc/soelim/soelim.am index 9b3a906..4c9e083 100644 --- a/src/preproc/soelim/soelim.am +++ b/src/preproc/soelim/soelim.am @@ -1,7 +1,7 @@ -bin_PROGRAMS += soelim +prefixexecbin_PROGRAMS += soelim soelim_LDADD = libgroff.a $(LIBM) soelim_SOURCES = src/preproc/soelim/soelim.cpp -man1_MANS += src/preproc/soelim/soelim.n +PREFIXMAN1 += src/preproc/soelim/soelim.n EXTRA_DIST += \ src/preproc/soelim/TODO \ src/preproc/soelim/soelim.man diff --git a/src/preproc/tbl/tbl.am b/src/preproc/tbl/tbl.am index 4794f1d..0af757c 100644 --- a/src/preproc/tbl/tbl.am +++ b/src/preproc/tbl/tbl.am @@ -1,8 +1,8 @@ -bin_PROGRAMS += tbl +prefixexecbin_PROGRAMS += tbl tbl_LDADD = libgroff.a $(LIBM) tbl_SOURCES = \ src/preproc/tbl/main.cpp \ src/preproc/tbl/table.cpp \ src/preproc/tbl/table.h -man1_MANS += src/preproc/tbl/tbl.n +PREFIXMAN1 += src/preproc/tbl/tbl.n EXTRA_DIST += src/preproc/tbl/tbl.man diff --git a/src/roff/nroff/nroff.am b/src/roff/nroff/nroff.am index 3255542..bcefb10 100644 --- a/src/roff/nroff/nroff.am +++ b/src/roff/nroff/nroff.am @@ -1,6 +1,6 @@ -bin_SCRIPTS += nroff +prefixexecbin_SCRIPTS += nroff nroff_srcdir = $(top_srcdir)/src/roff/nroff -man1_MANS += src/roff/nroff/nroff.n +PREFIXMAN1 += src/roff/nroff/nroff.n EXTRA_DIST += \ src/roff/nroff/nroff.man \ src/roff/nroff/nroff.sh diff --git a/src/roff/troff/troff.am b/src/roff/troff/troff.am index 3c71302..c527215 100644 --- a/src/roff/troff/troff.am +++ b/src/roff/troff/troff.am @@ -16,8 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -bin_PROGRAMS += troff -man1_MANS += src/roff/troff/troff.n +prefixexecbin_PROGRAMS += troff +PREFIXMAN1 += src/roff/troff/troff.n EXTRA_DIST += \ src/roff/troff/column.cpp \ src/roff/troff/troff.man \ diff --git a/src/utils/indxbib/indxbib.am b/src/utils/indxbib/indxbib.am index aff316f..044b389 100644 --- a/src/utils/indxbib/indxbib.am +++ b/src/utils/indxbib/indxbib.am @@ -17,13 +17,13 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. indxbib_srcdir = $(top_srcdir)/src/utils/indxbib -bin_PROGRAMS += indxbib +prefixexecbin_PROGRAMS += indxbib indxbib_SOURCES = \ src/utils/indxbib/indxbib.cpp \ src/utils/indxbib/signal.c src/utils/indxbib/indxbib.$(OBJEXT): defs.h indxbib_LDADD = libbib.a libgroff.a $(LIBM) -man1_MANS += src/utils/indxbib/indxbib.n +PREFIXMAN1 += src/utils/indxbib/indxbib.n EXTRA_DIST += \ src/utils/indxbib/indxbib.man \ src/utils/indxbib/eign diff --git a/src/utils/lookbib/lookbib.am b/src/utils/lookbib/lookbib.am index 2c8ceaa..7d28b3e 100644 --- a/src/utils/lookbib/lookbib.am +++ b/src/utils/lookbib/lookbib.am @@ -1,5 +1,5 @@ -bin_PROGRAMS += lookbib -man1_MANS += src/utils/lookbib/lookbib.n +prefixexecbin_PROGRAMS += lookbib +PREFIXMAN1 += src/utils/lookbib/lookbib.n EXTRA_DIST += src/utils/lookbib/lookbib.man lookbib_LDADD = libbib.a libgroff.a $(LIBM) lookbib_SOURCES = src/utils/lookbib/lookbib.cpp _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit