Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect-php:master commit in: /, openrc/init.d/, src/, openrc/conf.d/
Date: Thu, 23 Jan 2020 15:06:40
Message-Id: 1579791964.83451d68109c398710e54664399c0d0ecdb5dcd9.mjo@gentoo
1 commit: 83451d68109c398710e54664399c0d0ecdb5dcd9
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 23 00:30:05 2020 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 23 15:06:04 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=83451d68
7
8 autotools: use recursive automake to support out-of-source builds.
9
10 When performing an out-of-source build (in particular, with "make
11 distcheck"), the rules that we were using to replace @LIBDIR@ and
12 friends were failing. Automake does a lot of path magic in its rules,
13 but not within the shell commands themselves, so ultimately we wound
14 up with some confusion between the source and build directories.
15
16 Rather than hack around this problem in the top-level Makefile.am,
17 I've converted the project to a recursive build, where the top-level
18 Makefile.am delegates to Makefile.am in the subdirectories. This
19 over-complicates things, but does fix the out-of-source build. Why?
20 A guess: because the path magic works better in "." than elsewhere.
21
22 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
23
24 Makefile.am | 51 ++++-------------------------------------------
25 configure.ac | 9 ++++++++-
26 openrc/conf.d/Makefile.am | 6 ++++++
27 openrc/init.d/Makefile.am | 14 +++++++++++++
28 src/Makefile.am | 41 +++++++++++++++++++++++++++++++++++++
29 5 files changed, 73 insertions(+), 48 deletions(-)
30
31 diff --git a/Makefile.am b/Makefile.am
32 index df6430a..335cebc 100644
33 --- a/Makefile.am
34 +++ b/Makefile.am
35 @@ -1,55 +1,12 @@
36 -eselectdir = $(datadir)/eselect/modules
37 -nodist_eselect_DATA = src/php.eselect
38 -
39 -# Without EXTRA_DIST, these files don't wind up in the tarball.
40 -EXTRA_DIST = openrc \
41 - src/70_mod_php.conf.in \
42 - src/php-fpm-launcher.in \
43 - src/php-fpm.logrotate.in
44 -
45 -if APACHE2
46 - # Without these set, we won't try to install the conf file.
47 - apacheconfdir = $(sysconfdir)/apache2/modules.d
48 - nodist_apacheconf_DATA = src/70_mod_php.conf
49 -endif
50 -
51 -if FPM
52 - # Same as the APACHE2 conditional.
53 - initdir = $(sysconfdir)/init.d
54 - nodist_init_SCRIPTS = openrc/init.d/php-fpm
55 -
56 - confdir = $(sysconfdir)/conf.d
57 - nodist_conf_DATA = openrc/conf.d/php-fpm
58 -
59 - nodist_libexec_SCRIPTS = src/php-fpm-launcher
60 -
61 - logrotatedir = $(sysconfdir)/logrotate.d
62 - nodist_logrotate_DATA = src/php-fpm.logrotate
63 -
64 - tmpfilesdir = $(prefix)/lib/tmpfiles.d
65 - dist_tmpfiles_DATA = src/php-fpm.conf
66 -endif
67 -
68 -# The next few rules allow us to replace bindir, libdir, etc.
69 +# This command allows us to replace bindir, libdir, etc.
70 # within our script and conf file. The example is taken
71 # from the autoconf documentation and can be found in the
72 # "Installation Directory Variables" section.
73 -edit = sed -e 's|@BINDIR[@]|$(bindir)|g' \
74 +editgnudirs = sed -e 's|@BINDIR[@]|$(bindir)|g' \
75 -e 's|@LIBDIR[@]|$(libdir)|g' \
76 -e 's|@LIBEXECDIR[@]|$(libexecdir)|g' \
77 -e 's|@LOCALSTATEDIR[@]|$(localstatedir)|g' \
78 -e 's|@SYSCONFDIR[@]|$(sysconfdir)|g'
79 +export editgnudirs
80
81 -
82 -$(nodist_eselect_DATA) $(nodist_apacheconf_DATA) $(nodist_init_SCRIPTS) $(nodist_libexec_SCRIPTS) $(nodist_logrotate_DATA): Makefile
83 - rm -f $@ $@.tmp
84 - srcdir=''; \
85 - test -f ./$@.in || srcdir=$(srcdir)/; \
86 - $(edit) $${srcdir}$@.in > $@.tmp
87 - mv $@.tmp $@
88 -
89 -src/php.eselect: src/php.eselect.in
90 -src/php-fpm-launcher: src/php-fpm-launcher.in
91 -src/php-fpm.logrotate: src/php-fpm.logrotate.in
92 -src/70_mod_php.conf: src/70_mod_php.conf.in
93 -openrc/init.d/php-fpm: openrc/init.d/php-fpm.in
94 +SUBDIRS = src openrc/conf.d openrc/init.d
95
96 diff --git a/configure.ac b/configure.ac
97 index 1b935fb..3246bee 100644
98 --- a/configure.ac
99 +++ b/configure.ac
100 @@ -42,6 +42,13 @@ AC_ARG_WITH(piddir, AC_HELP_STRING([--with-piddir=DIR],
101 AC_SUBST(piddir)
102
103 # List of output files.
104 -AC_CONFIG_FILES([Makefile src/php.eselect.in openrc/init.d/php-fpm.in])
105 +AC_CONFIG_FILES([
106 + Makefile
107 + src/Makefile
108 + src/php.eselect.in
109 + openrc/conf.d/Makefile
110 + openrc/init.d/Makefile
111 + openrc/init.d/php-fpm.in
112 +])
113
114 AC_OUTPUT
115
116 diff --git a/openrc/conf.d/Makefile.am b/openrc/conf.d/Makefile.am
117 new file mode 100644
118 index 0000000..46e3146
119 --- /dev/null
120 +++ b/openrc/conf.d/Makefile.am
121 @@ -0,0 +1,6 @@
122 +EXTRA_DIST = php-fpm
123 +
124 +if FPM
125 + confdir = $(sysconfdir)/conf.d
126 + dist_conf_DATA = php-fpm
127 +endif
128
129 diff --git a/openrc/init.d/Makefile.am b/openrc/init.d/Makefile.am
130 new file mode 100644
131 index 0000000..29d53c7
132 --- /dev/null
133 +++ b/openrc/init.d/Makefile.am
134 @@ -0,0 +1,14 @@
135 +if FPM
136 + initdir = $(sysconfdir)/init.d
137 + nodist_init_SCRIPTS = php-fpm
138 +endif
139 +
140 +# Otherwise these don't get cleaned up by "make distclean"
141 +DISTCLEANFILES = $(nodist_init_SCRIPTS)
142 +
143 +$(nodist_init_SCRIPTS): Makefile
144 + rm -f $@ $@.tmp
145 + $(editgnudirs) $@.in > $@.tmp
146 + mv $@.tmp $@
147 +
148 +php-fpm: php-fpm.in
149
150 diff --git a/src/Makefile.am b/src/Makefile.am
151 new file mode 100644
152 index 0000000..fca452f
153 --- /dev/null
154 +++ b/src/Makefile.am
155 @@ -0,0 +1,41 @@
156 +eselectdir = $(datadir)/eselect/modules
157 +nodist_eselect_DATA = php.eselect
158 +
159 +# Without EXTRA_DIST, these files don't wind up in the tarball.
160 +EXTRA_DIST = 70_mod_php.conf.in \
161 + php-fpm-launcher.in \
162 + php-fpm.logrotate.in
163 +
164 +if APACHE2
165 + # Without these set, we won't try to install the conf file.
166 + apacheconfdir = $(sysconfdir)/apache2/modules.d
167 + nodist_apacheconf_DATA = 70_mod_php.conf
168 +endif
169 +
170 +if FPM
171 + # Same as the APACHE2 conditional.
172 + nodist_libexec_SCRIPTS = php-fpm-launcher
173 +
174 + logrotatedir = $(sysconfdir)/logrotate.d
175 + nodist_logrotate_DATA = php-fpm.logrotate
176 +
177 + tmpfilesdir = $(prefix)/lib/tmpfiles.d
178 + dist_tmpfiles_DATA = php-fpm.conf
179 +endif
180 +
181 +
182 +# Otherwise these don't get cleaned up by "make distclean"
183 +DISTCLEANFILES = $(nodist_eselect_DATA) \
184 + $(nodist_apacheconf_DATA) \
185 + $(nodist_libexec_SCRIPTS) \
186 + $(nodist_logrotate_DATA)
187 +
188 +$(DISTCLEANFILES): Makefile
189 + rm -f $@ $@.tmp
190 + $(editgnudirs) $@.in > $@.tmp
191 + mv $@.tmp $@
192 +
193 +php.eselect: php.eselect.in
194 +php-fpm-launcher: php-fpm-launcher.in
195 +php-fpm.logrotate: php-fpm.logrotate.in
196 +70_mod_php.conf: 70_mod_php.conf.in