public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/eselect-php:master commit in: src/, /
@ 2015-12-11  1:09 Michael Orlitzky
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Orlitzky @ 2015-12-11  1:09 UTC (permalink / raw
  To: gentoo-commits

commit:     9716aae78b821f26f3b820d838cec65d0b73c408
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 11 01:09:20 2015 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Dec 11 01:09:20 2015 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=9716aae7

Use AC_PROG_MKDIR_P macro/variable instead of "mkdir -p".

 configure.ac       | 1 +
 src/php.eselect.in | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d892d13..aa7bf70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,6 +2,7 @@ AC_INIT([eselect-php], [0.8.1])
 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-xz])
 
 AC_PROG_LN_S
+AC_PROG_MKDIR_P
 AC_PROG_SED
 AC_PATH_PROG(SORT,sort)
 AC_PATH_PROG(UNIQ,uniq)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index aa8ad68..7e918ab 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -227,7 +227,7 @@ write_mod_php_conf() {
 	local conf_dir="${EROOT}"/var/lib/eselect-php
 	local conf_path="${conf_dir}/mod_php.conf"
 
-	mkdir -p "${conf_dir}" || die "failed to create ${conf_dir}"
+	@MKDIR_P@ "${conf_dir}" || die "failed to create ${conf_dir}"
 
 	# Parse the major version (for example "5" or "7") out of the
 	# target name.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/eselect-php:master commit in: src/, /
@ 2016-01-22  3:15 Michael Orlitzky
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Orlitzky @ 2016-01-22  3:15 UTC (permalink / raw
  To: gentoo-commits

commit:     f4a2678217a23ce0db353173f74a556039b5b08d
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 02:12:37 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 02:12:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=f4a26782

Use uppercase @BINDIR@, @LIBDIR@, etc. for autotools substitution.

The last few commits introduced a problem: by passing
php.eselect.in.in through autoconf, we unwittingly replace things like
@bindir@ with ${exec_prefix}. This is because lowercase @bindir@
gets defined for automake and is intended to be based on the other
directory variables like @exec_prefix@. Since we're replacing them
after the fact in the Makefile, this commit avoids the autoconf
mangling by making them all uppercase.

 Makefile.am            |  6 +++---
 src/70_mod_php.conf.in |  2 +-
 src/php.eselect.in.in  | 18 +++++++++---------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9487f1b..1d1132e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,9 +8,9 @@ nodist_apacheconf_DATA = $(srcdir)/src/70_mod_php.conf
 # localstatedir 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' \
-           -e 's|@libdir[@]|$(libdir)|g' \
-           -e 's|@localstatedir[@]|$(localstatedir)|g'
+edit = sed -e 's|@BINDIR[@]|$(bindir)|g' \
+           -e 's|@LIBDIR[@]|$(libdir)|g' \
+           -e 's|@LOCALSTATEDIR[@]|$(localstatedir)|g'
 
 $(nodist_eselect_DATA) $(nodist_apacheconf_DATA): Makefile
 	rm -f $@ $@.tmp

diff --git a/src/70_mod_php.conf.in b/src/70_mod_php.conf.in
index 4b97354..a9d348d 100644
--- a/src/70_mod_php.conf.in
+++ b/src/70_mod_php.conf.in
@@ -4,7 +4,7 @@
 	# php5_module to php7_module so we can't blindly load whatever
 	# is there. Instead we let eselect-php manage a small
 	# configuration file that loads the appropriate module.
-	Include "@localstatedir@/lib/eselect-php/mod_php.conf"
+	Include "@LOCALSTATEDIR@/lib/eselect-php/mod_php.conf"
 
 	# Tell apache that mod_php should handle PHP files.
 	#

diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index e1edb42..d3428bd 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -88,7 +88,7 @@ sapi_active_link_target_dir() {
 	local sapi="${1}"
 	local target="${2}"
 
-	local link_target_dir="@libdir@/${target}/bin"
+	local link_target_dir="@LIBDIR@/${target}/bin"
 	if [[ "${sapi}" == "apache2" ]] ; then
 		link_target_dir+="/../apache2"
 	fi
@@ -116,11 +116,11 @@ sapi_active_link_dir() {
 	local sapi="${1}"
 
 	case "${sapi}" in
-		apache2) echo "@libdir@/apache2/modules" ;;
-		cli)     echo "@bindir@" ;;
-		fpm)     echo "@bindir@" ;;
-		cgi)     echo "@bindir@" ;;
-		phpdbg)  echo "@bindir@" ;;
+		apache2) echo "@LIBDIR@/apache2/modules" ;;
+		cli)     echo "@BINDIR@" ;;
+		fpm)     echo "@BINDIR@" ;;
+		cgi)     echo "@BINDIR@" ;;
+		phpdbg)  echo "@BINDIR@" ;;
 		*)       die "invalid SAPI name: ${sapi}" ;;
 	esac
 }
@@ -198,7 +198,7 @@ cleanup_sapi() {
 	fi
 
 	if [[ "${sapi}" == "apache2" ]] ; then
-		rm -f "@libdir@"/apache2/modules/libphp[57].so \
+		rm -f "@LIBDIR@"/apache2/modules/libphp[57].so \
 		   || die "failed to remove old libphp.so symlink"
 	fi
 
@@ -258,7 +258,7 @@ find_sapi_targets() {
 	esac
 
 	for target in $(find_targets); do
-		local pattern="@libdir@/${target}/${pattern_suffix}"
+		local pattern="@LIBDIR@/${target}/${pattern_suffix}"
 
 		for file in $pattern; do
 			[[ -f "${file}" ]] && echo "${target}"
@@ -313,7 +313,7 @@ get_sapi_active_target() {
 #
 write_mod_php_conf() {
 	local target="${1}"
-	local conf_dir="@localstatedir@/lib/eselect-php"
+	local conf_dir="@LOCALSTATEDIR@/lib/eselect-php"
 	local conf_path="${conf_dir}/mod_php.conf"
 
 	@MKDIR_P@ "${conf_dir}" || die "failed to create ${conf_dir}"


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/eselect-php:master commit in: src/, /
@ 2016-01-22  3:15 Michael Orlitzky
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Orlitzky @ 2016-01-22  3:15 UTC (permalink / raw
  To: gentoo-commits

commit:     79787fcc061362905f0b47a67c922884a27616fc
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 23:53:18 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 23:53:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=79787fcc

Add another layer of indirection to get @bindir@ and friends in the output.

When we create php.eselect from php.eselect.in using autoconf, we
don't have a way to get the full, expanded value of @bindir@,
@libdir@, and the other paths that we need. The autoconf documentation
suggests a workaround for this: add another layer of indirection, and
use the Makefile to substitute those values into the output files.

This commit sets the stage by renaming php.eselect.in to
php.eselect.in.in. The first round of processing by autoconf takes
php.eselect.in.in to php.eselect.in. The Makefile will then generate
php.eselect from php.eselect.in after substituting @bindir@, @libdir@,
and @localstatedir@.

 Makefile.am                               | 19 ++++++++++++++++++-
 configure.ac                              |  2 +-
 src/{php.eselect.in => php.eselect.in.in} |  0
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 330f491..073abf9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,19 @@
 eselectdir = $(datadir)/eselect/modules
-nodist_eselect_DATA = src/php.eselect
+nodist_eselect_DATA = $(srcdir)/src/php.eselect
+
+# The next few rules allow us to replace bindir, libdir, and
+# localstatedir 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' \
+           -e 's|@libdir[@]|$(libdir)|g' \
+           -e 's|@localstatedir[@]|$(localstatedir)|g'
+
+$(nodist_eselect_DATA): Makefile
+	rm -f $@ $@.tmp
+	srcdir=''; \
+	  test -f ./$@.in || srcdir=$(srcdir)/; \
+          $(edit) $${srcdir}$@.in > $@.tmp
+	mv $@.tmp $@
+
+$(srcdir)/src/php.eselect: $(srcdir)/src/php.eselect.in

diff --git a/configure.ac b/configure.ac
index 2f1f609..c118e0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,6 @@ AC_PATH_PROG(SORT,sort)
 AC_PATH_PROG(UNIQ,uniq)
 
 # List of output files.
-AC_CONFIG_FILES([Makefile src/php.eselect])
+AC_CONFIG_FILES([Makefile src/php.eselect.in])
 
 AC_OUTPUT

diff --git a/src/php.eselect.in b/src/php.eselect.in.in
similarity index 100%
rename from src/php.eselect.in
rename to src/php.eselect.in.in


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-22  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11  1:09 [gentoo-commits] proj/eselect-php:master commit in: src/, / Michael Orlitzky
  -- strict thread matches above, loose matches on Subject: below --
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox