commit:     d025c67c8e7800b48c0bd6af05677d14e0968887
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  7 08:13:00 2025 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Sat Jun  7 08:13:00 2025 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=d025c67c

Fix apxs patch to properly report target and conf file

The previous patch overwrote the TARGET since this determines the name
of the configuration file, but TARGET is also used to determine the
binary name. This causes dev-lang/php's configure script to fail.

Create a separate variable for the configuration name instead and use
it with a hard-coded name.

Bug: https://bugs.gentoo.org/957142
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>

 2.4/patches/05_apxs_conf_name.patch | 54 ++++++++++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 6 deletions(-)

diff --git a/2.4/patches/05_apxs_conf_name.patch 
b/2.4/patches/05_apxs_conf_name.patch
index 60fe3b0..24096e4 100644
--- a/2.4/patches/05_apxs_conf_name.patch
+++ b/2.4/patches/05_apxs_conf_name.patch
@@ -1,11 +1,53 @@
 --- a/support/apxs.in  2020-03-20 14:00:44.000000000 +0100
-+++ b/support/apxs.in  2025-05-24 11:20:25.632979926 +0200
-@@ -45,7 +45,7 @@
- my $exec_prefix    = get_vars("exec_prefix");
- my $datadir        = get_vars("datadir");
++++ b/support/apxs.in  2025-06-07 10:06:41.194351543 +0200
+@@ -47,6 +47,7 @@
  my $localstatedir  = get_vars("localstatedir");
--my $CFG_TARGET     = get_vars("progname");
-+my $CFG_TARGET     = "httpd";  # get_vars("progname");
+ my $CFG_TARGET     = get_vars("progname");
  my $CFG_SYSCONFDIR = get_vars("sysconfdir");
++my $CFG_CONFFILE   = "httpd.conf";
  my $CFG_CFLAGS     = join ' ', map { get_vars($_) }
    qw(SHLTCFLAGS CFLAGS NOTEST_CPPFLAGS EXTRA_CPPFLAGS EXTRA_CFLAGS);
+ my $CFG_LDFLAGS    = join ' ', map { get_vars($_) }
+@@ -560,17 +561,17 @@
+ 
+     #   activate module via LoadModule/AddModule directive
+     if ($opt_a or $opt_A) {
+-        if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") {
+-            error("Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found");
++        if (not -f "$CFG_SYSCONFDIR/$CFG_CONFFILE") {
++            error("Config file $CFG_SYSCONFDIR/$CFG_CONFFILE not found");
+             exit(1);
+         }
+ 
+-        open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die;
++        open(FP, "<$CFG_SYSCONFDIR/$CFG_CONFFILE") || die;
+         my $content = join('', <FP>);
+         close(FP);
+ 
+         if ($content !~ m|\n#?\s*LoadModule\s+|) {
+-            error("Activation failed for custom 
$CFG_SYSCONFDIR/$CFG_TARGET.conf file.");
++            error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_CONFFILE 
file.");
+             error("At least one `LoadModule' directive already has to 
exist.");
+             exit(1);
+         }
+@@ -649,15 +650,15 @@
+                 $content =~ s|^(.*\n)#?\s*$lmd_re[^\n]*\n|$1$c$lmd\n|s;
+             }
+             $lmd =~ m|LoadModule\s+(.+?)_module.*|;
+-            notice("[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]");
++            notice("[$what module `$1' in $CFG_SYSCONFDIR/$CFG_CONFFILE]");
+         }
+         if (@lmd) {
+-            if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) {
++            if (open(FP, ">$CFG_SYSCONFDIR/$CFG_CONFFILE.new")) {
+                 print FP $content;
+                 close(FP);
+-                system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf 
$CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " .
+-                       "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new 
$CFG_SYSCONFDIR/$CFG_TARGET.conf && " .
+-                       "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new");
++                system("cp $CFG_SYSCONFDIR/$CFG_CONFFILE 
$CFG_SYSCONFDIR/$CFG_CONFFILE.bak && " .
++                       "cp $CFG_SYSCONFDIR/$CFG_CONFFILE.new 
$CFG_SYSCONFDIR/$CFG_CONFFILE && " .
++                       "rm $CFG_SYSCONFDIR/$CFG_CONFFILE.new");
+             } else {
+                 notice("unable to open configuration file");
+             }

Reply via email to