>From ee991b158c92fe0225c18cb7454f0191690ed765 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 27 Jun 2015 00:27:23 +0200 Subject: [PATCH 3/4] Use a more conventional build system. --- .gitignore | 11 ++----- ChangeLog | 14 +++++++++ Makefile.am | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile.ed | 34 +++++++++++++++++++++ README--git | 2 +- bootstrap | 5 +++ configure.ac | 5 +-- makefile.am | 85 --------------------------------------------------- makefile.ed | 34 --------------------- scm/mcron/Makefile.am | 15 +++++++++ scm/mcron/makefile.am | 15 --------- 11 files changed, 160 insertions(+), 145 deletions(-) create mode 100644 Makefile.am create mode 100644 Makefile.ed create mode 100755 bootstrap delete mode 100644 makefile.am delete mode 100644 makefile.ed create mode 100644 scm/mcron/Makefile.am delete mode 100644 scm/mcron/makefile.am diff --git a/.gitignore b/.gitignore index 2bedd6e..6c0f726 100644 --- a/.gitignore +++ b/.gitignore @@ -3,25 +3,20 @@ INSTALL aclocal.m4 autom4te.cache -compile +/build-aux config.log config.scm config.status configure core.scm -depcomp /doc/.dirstamp /doc/config.texi /doc/mcron.info /doc/mcron.1 /doc/stamp-vti /doc/version.texi -install-sh -makefile -makefile.in +Makefile +Makefile.in /mcron mcron.c -/mdate-sh *.o -missing -texinfo.tex diff --git a/ChangeLog b/ChangeLog index 806a03f..81e32b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2015-06-27 Mathieu Lirzin + + Use a more conventional build system. + * bootstrap: New convenient build script. + * README--git: Document it. + * makefile.am: Capitalize file name. + * makefile.ed: Likewise. + * scm/mcron/makefile: Likewise. + * Makefile.am: New file. + * Makefile.ed: Likewise. + * scm/mcron/Makefile: Likewise. + * .gitignore: Adapt to them. + + 2015-06-26 Mathieu Lirzin Fix build of the manual. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..038aabf --- /dev/null +++ b/Makefile.am @@ -0,0 +1,85 @@ +## Makefile for the toplevel directory of mcron. +## Copyright (C) 2003 Dale Mellor +## Copyright (C) 2015 Mathieu Lirzin +## +# This file is part of GNU mcron. +# +# GNU mcron is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU mcron is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with GNU mcron. If not, see . + +## Process this file with automake to produce Makefile.in + +SUBDIRS = scm/mcron . + +ED = @ED@ # !!!! Are these needed? +CP = @CP@ + +MAINTAINERCLEANFILES = configure Makefile Makefile.in config.guess config.sub \ + install-sh missing texinfo.tex INSTALL \ + aclocal.m4 compile depcomp mcron.1 + +CLEANFILES = mcron.c core.scm + +EXTRA_DIST = Makefile.ed mcron.c.template BUGS + +info_TEXINFOS = doc/mcron.texi + +dist_man_MANS = doc/mcron.1 + +bin_PROGRAMS = mcron +mcron_SOURCES = mcron.c +mcron_LDADD = @GUILE_LIBS@ + +# The second option is so that we can execute the binary in the local directory, +# in turn so that we can do mcron --help during the build process. +mcron_CFLAGS = @GUILE_CFLAGS@ -DGUILE_LOAD_PATH=\"$(datadir):./scm:...\" + + +mcron.c : scm/mcron/main.scm scm/mcron/crontab.scm Makefile.ed mcron.c.template + @echo 'Building mcron.c...' + @$(ED) < Makefile.ed > /dev/null 2>&1 + @rm -f mcron.escaped.scm > /dev/null 2>&1 + + +#full program prefix +fpp = $(DESTDIR)$(bindir)/@real_program_prefix@ + + +install-exec-hook: + @if [ "address@hidden@" != "xyes" -a "`id -u`" -eq "0" ]; then \ + rm -f $(fpp)cron$(EXEEXT) > /dev/null 2>&1; \ + $(INSTALL) --mode='u=rwx' mcron$(EXEEXT) $(fpp)cron$(EXEEXT); \ + rm -f $(fpp)crontab$(EXEEXT) > /dev/null 2>&1; \ + $(INSTALL) --mode='u=rwxs,og=rx' mcron$(EXEEXT) $(fpp)crontab$(EXEEXT); \ + $(INSTALL) -d --mode='u=rwx' $(DESTDIR)/var/cron; \ + $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)/var/run; \ + $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@; \ + $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@/mcron; \ + elif [ "address@hidden@" = "xyes" ]; then \ + echo "Not installing Vixie-style programs"; \ + else \ + echo "+++ WARNING: NON-ROOT INSTALL: ONLY mcron WILL BE INSTALLED, NOT ANY OF THE VIXIE REPLACEMENT PROGRAMS"; \ + fi + + +uninstall-hook: + if [ "`id -u`" -eq "0" ]; then \ + rm -f $(fpp){cron,crontab}$(EXEEXT); \ + fi + + +# Not part of formal package building, but a rule for manual use to get the +# elemental man page. Will only work once the mcron program is installed. +$(dist_man_MANS): mcron.c + $(HELP2MAN) -n 'a program to run tasks at regular (or not) intervals' \ + ./mcron > $@ diff --git a/Makefile.ed b/Makefile.ed new file mode 100644 index 0000000..bc2e732 --- /dev/null +++ b/Makefile.ed @@ -0,0 +1,34 @@ +# Copyright (C) 2003 Dale Mellor +# +# This file is part of GNU mcron. +# +# GNU mcron is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU mcron is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with GNU mcron. If not, see . +# +# +# +e scm/mcron/main.scm +/\(load "crontab.scm"\)/d +-1r scm/mcron/crontab.scm +%s/\\/\\\\/g +%s/"/\\"/g +%s/ *;;.*$/ /g +g/^ *$/d +%s/^/\"/ +%s/$/\"/ +w mcron.escaped.scm +e mcron.c.template +/GUILE_PROGRAM_GOES_HERE/d +-1r mcron.escaped.scm +w mcron.c +q diff --git a/README--git b/README--git index 9ebaa0d..c26d94f 100644 --- a/README--git +++ b/README--git @@ -11,7 +11,7 @@ GNU mcron --- README--git -*-text-*- If you have pulled mcron from the GIT repository, these are the steps you will need to take to build it the first time: -1) autoreconf -vfi +1) ./bootstrap 2) ./configure --prefix={wherever} 3) make install diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..cb774bc --- /dev/null +++ b/bootstrap @@ -0,0 +1,5 @@ +#!/bin/sh +# Create the build system. + +set -e -x +exec autoreconf -vfi diff --git a/configure.ac b/configure.ac index 7422469..721144b 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,7 @@ AC_PREREQ(2.61) AC_INIT([mcron], [1.0.8], address@hidden) +AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE @@ -172,7 +173,7 @@ real_program_prefix=`echo $program_prefix | sed s/NONE//` AC_SUBST(real_program_prefix) AC_CONFIG_FILES([doc/config.texi - makefile - scm/mcron/makefile + Makefile + scm/mcron/Makefile scm/mcron/config.scm]) AC_OUTPUT diff --git a/makefile.am b/makefile.am deleted file mode 100644 index 5d19aa2..0000000 --- a/makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -## Makefile for the toplevel directory of mcron. -## Copyright (C) 2003 Dale Mellor -## Copyright (C) 2015 Mathieu Lirzin -## -# This file is part of GNU mcron. -# -# GNU mcron is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# GNU mcron is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along -# with GNU mcron. If not, see . - -## Process this file with automake to produce Makefile.in - -SUBDIRS = scm/mcron . - -ED = @ED@ # !!!! Are these needed? -CP = @CP@ - -MAINTAINERCLEANFILES = configure makefile makefile.in config.guess config.sub \ - install-sh missing texinfo.tex INSTALL \ - aclocal.m4 compile depcomp mcron.1 - -CLEANFILES = mcron.c core.scm - -EXTRA_DIST = makefile.ed mcron.c.template BUGS - -info_TEXINFOS = doc/mcron.texi - -dist_man_MANS = doc/mcron.1 - -bin_PROGRAMS = mcron -mcron_SOURCES = mcron.c -mcron_LDADD = @GUILE_LIBS@ - -# The second option is so that we can execute the binary in the local directory, -# in turn so that we can do mcron --help during the build process. -mcron_CFLAGS = @GUILE_CFLAGS@ -DGUILE_LOAD_PATH=\"$(datadir):./scm:...\" - - -mcron.c : scm/mcron/main.scm scm/mcron/crontab.scm makefile.ed mcron.c.template - @echo 'Building mcron.c...' - @$(ED) < makefile.ed > /dev/null 2>&1 - @rm -f mcron.escaped.scm > /dev/null 2>&1 - - -#full program prefix -fpp = $(DESTDIR)$(bindir)/@real_program_prefix@ - - -install-exec-hook: - @if [ "address@hidden@" != "xyes" -a "`id -u`" -eq "0" ]; then \ - rm -f $(fpp)cron$(EXEEXT) > /dev/null 2>&1; \ - $(INSTALL) --mode='u=rwx' mcron$(EXEEXT) $(fpp)cron$(EXEEXT); \ - rm -f $(fpp)crontab$(EXEEXT) > /dev/null 2>&1; \ - $(INSTALL) --mode='u=rwxs,og=rx' mcron$(EXEEXT) $(fpp)crontab$(EXEEXT); \ - $(INSTALL) -d --mode='u=rwx' $(DESTDIR)/var/cron; \ - $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)/var/run; \ - $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@; \ - $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@/mcron; \ - elif [ "address@hidden@" = "xyes" ]; then \ - echo "Not installing Vixie-style programs"; \ - else \ - echo "+++ WARNING: NON-ROOT INSTALL: ONLY mcron WILL BE INSTALLED, NOT ANY OF THE VIXIE REPLACEMENT PROGRAMS"; \ - fi - - -uninstall-hook: - if [ "`id -u`" -eq "0" ]; then \ - rm -f $(fpp){cron,crontab}$(EXEEXT); \ - fi - - -# Not part of formal package building, but a rule for manual use to get the -# elemental man page. Will only work once the mcron program is installed. -$(dist_man_MANS): mcron.c - $(HELP2MAN) -n 'a program to run tasks at regular (or not) intervals' \ - ./mcron > $@ diff --git a/makefile.ed b/makefile.ed deleted file mode 100644 index 7047ec7..0000000 --- a/makefile.ed +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2003 Dale Mellor -# -# This file is part of GNU mcron. -# -# GNU mcron is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# GNU mcron is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along -# with GNU mcron. If not, see . -# -# -# -e scm/mcron/main.scm -/\(load "crontab.scm"\)/d --1r scm/mcron/crontab.scm -%s/\\/\\\\/g -%s/"/\\"/g -%s/ *;;.*$/ /g -g/^ *$/d -%s/^/\"/ -%s/$/\"/ -w mcron.escaped.scm -e mcron.c.template -/GUILE_PROGRAM_GOES_HERE/d --1r mcron.escaped.scm -w mcron.c -q diff --git a/scm/mcron/Makefile.am b/scm/mcron/Makefile.am new file mode 100644 index 0000000..c5c3d49 --- /dev/null +++ b/scm/mcron/Makefile.am @@ -0,0 +1,15 @@ +EXTRA_DIST = main.scm mcron-core.scm vixie-specification.scm \ + crontab.scm environment.scm job-specifier.scm redirect.scm \ + vixie-time.scm + +pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \ + vixie-time.scm vixie-specification.scm config.scm + + +# If you're wondering, the configure script keeps deleting all files with a name +# like core.*, so we have to keep re-making it (I lost a good day's work because +# of this). + +core.scm : mcron-core.scm + $(CP) $< $@ + diff --git a/scm/mcron/makefile.am b/scm/mcron/makefile.am deleted file mode 100644 index 931b03b..0000000 --- a/scm/mcron/makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -EXTRA_DIST = main.scm mcron-core.scm vixie-specification.scm \ - crontab.scm environment.scm job-specifier.scm redirect.scm \ - vixie-time.scm - -pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \ - vixie-time.scm vixie-specification.scm config.scm - - -# If you're wondering, the configure script keeps deleting all files with a name -# like core.*, so we have to keep re-making it (I lost a good day's work because -# of this). - -core.scm : mcron-core.scm - $(CP) mcron-core.scm core.scm - -- 2.1.4