diff options
author | 2020-01-22 19:30:05 -0500 | |
---|---|---|
committer | 2020-01-23 10:06:04 -0500 | |
commit | 83451d68109c398710e54664399c0d0ecdb5dcd9 (patch) | |
tree | b734db03bb7d204fb0ae3316b78338c6d514b968 | |
parent | Makefile.am: remove redundant $(srcdir)s. (diff) | |
download | eselect-php-83451d68109c398710e54664399c0d0ecdb5dcd9.tar.gz eselect-php-83451d68109c398710e54664399c0d0ecdb5dcd9.tar.bz2 eselect-php-83451d68109c398710e54664399c0d0ecdb5dcd9.zip |
autotools: use recursive automake to support out-of-source builds.
When performing an out-of-source build (in particular, with "make
distcheck"), the rules that we were using to replace @LIBDIR@ and
friends were failing. Automake does a lot of path magic in its rules,
but not within the shell commands themselves, so ultimately we wound
up with some confusion between the source and build directories.
Rather than hack around this problem in the top-level Makefile.am,
I've converted the project to a recursive build, where the top-level
Makefile.am delegates to Makefile.am in the subdirectories. This
over-complicates things, but does fix the out-of-source build. Why?
A guess: because the path magic works better in "." than elsewhere.
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
-rw-r--r-- | Makefile.am | 51 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | openrc/conf.d/Makefile.am | 6 | ||||
-rw-r--r-- | openrc/init.d/Makefile.am | 14 | ||||
-rw-r--r-- | src/Makefile.am | 41 |
5 files changed, 73 insertions, 48 deletions
diff --git a/Makefile.am b/Makefile.am index df6430a..335cebc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,55 +1,12 @@ -eselectdir = $(datadir)/eselect/modules -nodist_eselect_DATA = src/php.eselect - -# Without EXTRA_DIST, these files don't wind up in the tarball. -EXTRA_DIST = openrc \ - src/70_mod_php.conf.in \ - src/php-fpm-launcher.in \ - src/php-fpm.logrotate.in - -if APACHE2 - # Without these set, we won't try to install the conf file. - apacheconfdir = $(sysconfdir)/apache2/modules.d - nodist_apacheconf_DATA = src/70_mod_php.conf -endif - -if FPM - # Same as the APACHE2 conditional. - initdir = $(sysconfdir)/init.d - nodist_init_SCRIPTS = openrc/init.d/php-fpm - - confdir = $(sysconfdir)/conf.d - nodist_conf_DATA = openrc/conf.d/php-fpm - - nodist_libexec_SCRIPTS = src/php-fpm-launcher - - logrotatedir = $(sysconfdir)/logrotate.d - nodist_logrotate_DATA = src/php-fpm.logrotate - - tmpfilesdir = $(prefix)/lib/tmpfiles.d - dist_tmpfiles_DATA = src/php-fpm.conf -endif - -# The next few rules allow us to replace bindir, libdir, etc. +# This command allows us to replace bindir, libdir, etc. # within our script and conf file. The example is taken # from the autoconf documentation and can be found in the # "Installation Directory Variables" section. -edit = sed -e 's|@BINDIR[@]|$(bindir)|g' \ +editgnudirs = sed -e 's|@BINDIR[@]|$(bindir)|g' \ -e 's|@LIBDIR[@]|$(libdir)|g' \ -e 's|@LIBEXECDIR[@]|$(libexecdir)|g' \ -e 's|@LOCALSTATEDIR[@]|$(localstatedir)|g' \ -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g' +export editgnudirs - -$(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS) $(nodist_libexec_SCRIPTS) $(nodist_logrotate_DATA): Makefile - rm -f $@ $@.tmp - srcdir=''; \ - test -f ./$@.in || srcdir=$(srcdir)/; \ - $(edit) $${srcdir}$@.in > $@.tmp - mv $@.tmp $@ - -src/php.eselect: src/php.eselect.in -src/php-fpm-launcher: src/php-fpm-launcher.in -src/php-fpm.logrotate: src/php-fpm.logrotate.in -src/70_mod_php.conf: src/70_mod_php.conf.in -openrc/init.d/php-fpm: openrc/init.d/php-fpm.in +SUBDIRS = src openrc/conf.d openrc/init.d diff --git a/configure.ac b/configure.ac index 1b935fb..3246bee 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,13 @@ AC_ARG_WITH(piddir, AC_HELP_STRING([--with-piddir=DIR], AC_SUBST(piddir) # List of output files. -AC_CONFIG_FILES([Makefile src/php.eselect.in openrc/init.d/php-fpm.in]) +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/php.eselect.in + openrc/conf.d/Makefile + openrc/init.d/Makefile + openrc/init.d/php-fpm.in +]) AC_OUTPUT diff --git a/openrc/conf.d/Makefile.am b/openrc/conf.d/Makefile.am new file mode 100644 index 0000000..46e3146 --- /dev/null +++ b/openrc/conf.d/Makefile.am @@ -0,0 +1,6 @@ +EXTRA_DIST = php-fpm + +if FPM + confdir = $(sysconfdir)/conf.d + dist_conf_DATA = php-fpm +endif diff --git a/openrc/init.d/Makefile.am b/openrc/init.d/Makefile.am new file mode 100644 index 0000000..29d53c7 --- /dev/null +++ b/openrc/init.d/Makefile.am @@ -0,0 +1,14 @@ +if FPM + initdir = $(sysconfdir)/init.d + nodist_init_SCRIPTS = php-fpm +endif + +# Otherwise these don't get cleaned up by "make distclean" +DISTCLEANFILES = $(nodist_init_SCRIPTS) + +$(nodist_init_SCRIPTS): Makefile + rm -f $@ $@.tmp + $(editgnudirs) $@.in > $@.tmp + mv $@.tmp $@ + +php-fpm: php-fpm.in diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..fca452f --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,41 @@ +eselectdir = $(datadir)/eselect/modules +nodist_eselect_DATA = php.eselect + +# Without EXTRA_DIST, these files don't wind up in the tarball. +EXTRA_DIST = 70_mod_php.conf.in \ + php-fpm-launcher.in \ + php-fpm.logrotate.in + +if APACHE2 + # Without these set, we won't try to install the conf file. + apacheconfdir = $(sysconfdir)/apache2/modules.d + nodist_apacheconf_DATA = 70_mod_php.conf +endif + +if FPM + # Same as the APACHE2 conditional. + nodist_libexec_SCRIPTS = php-fpm-launcher + + logrotatedir = $(sysconfdir)/logrotate.d + nodist_logrotate_DATA = php-fpm.logrotate + + tmpfilesdir = $(prefix)/lib/tmpfiles.d + dist_tmpfiles_DATA = php-fpm.conf +endif + + +# Otherwise these don't get cleaned up by "make distclean" +DISTCLEANFILES = $(nodist_eselect_DATA) \ + $(nodist_apacheconf_DATA) \ + $(nodist_libexec_SCRIPTS) \ + $(nodist_logrotate_DATA) + +$(DISTCLEANFILES): Makefile + rm -f $@ $@.tmp + $(editgnudirs) $@.in > $@.tmp + mv $@.tmp $@ + +php.eselect: php.eselect.in +php-fpm-launcher: php-fpm-launcher.in +php-fpm.logrotate: php-fpm.logrotate.in +70_mod_php.conf: 70_mod_php.conf.in |