[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, next, updated. 0cdbbb2b6077abbea9bc4bc2e9b394bc44de2d64

Arno Töll arno at debian.org
Thu Apr 12 01:10:46 UTC 2012


The following commit has been merged in the next branch:
commit 0cdbbb2b6077abbea9bc4bc2e9b394bc44de2d64
Author: Arno Töll <debian at toell.net>
Date:   Thu Apr 12 00:44:25 2012 +0200

    Fix apxs to Import LDFLAGS from config_vars.mk, just like it is done for
    CFLAGS. Moreover, allow to override LDFLAGS

diff --git a/debian/changelog b/debian/changelog
index d7af688..297e680 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,8 +13,12 @@ apache2 (2.4.1-5) experimental; urgency=low
     particular piece of configuration. That way in can be told under which
     circumstances for example modules should be re-enabled. Thanks to Filip M.
     Nowak who was providing a patch where my changes are built upon.
+  * Fix apxs to import LDFLAGS from config_vars.mk. Moreover, make it possible
+    to override LDFLAGS at compile time by defining LDLAGS in the environment,
+    just like it is possible for CFLAGS. This also means, config_vars.mk now
+    exports hardening build flags by default
 
- -- Arno Töll <arno at debian.org>  Mon, 09 Apr 2012 17:41:05 +0200
+ -- Arno Töll <arno at debian.org>  Thu, 12 Apr 2012 02:55:09 +0200
 
 apache2 (2.4.1-3) experimental; urgency=low
 
diff --git a/debian/patches/customize_apxs.patch b/debian/patches/customize_apxs.patch
index 28e8334..233333c 100644
--- a/debian/patches/customize_apxs.patch
+++ b/debian/patches/customize_apxs.patch
@@ -1,15 +1,23 @@
 Description: Adapt apxs to Debian specific changes
  - Make apxs2 use a2enmod and /etc/apache2/mods-available
  - Make libtool happier
+ - Use LDFLAGS from config_vars.mk, allow to override them
 Forwarded: not-needed
 Author: Stefan Fritsch <sf at debian.org>
 Last-Update: 2012-03-17
 
-diff --git a/support/apxs.in b/support/apxs.in
-index 39ff16c..41bb26b 100644
 --- a/support/apxs.in
 +++ b/support/apxs.in
-@@ -274,6 +274,7 @@ if ($opt_g) {
+@@ -39,6 +39,8 @@
+ my $CFG_SYSCONFDIR = get_vars("sysconfdir");
+ my $CFG_CFLAGS     = join ' ', map { get_vars($_) }
+   qw(SHLTCFLAGS CFLAGS NOTEST_CPPFLAGS EXTRA_CPPFLAGS EXTRA_CFLAGS);
++my $CFG_LDFLAGS    = join ' ', map { get_vars($_) }
++  qw(LDFLAGS NOTEST_LDFLAGS SH_LDFLAGS);
+ my $includedir     = get_vars("includedir");
+ my $CFG_INCLUDEDIR = eval qq("$includedir");
+ my $CFG_CC         = get_vars("CC");
+@@ -274,6 +276,7 @@
      $data =~ s|%TARGET%|$CFG_TARGET|sg;
      $data =~ s|%PREFIX%|$prefix|sg;
      $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg;
@@ -17,7 +25,7 @@ index 39ff16c..41bb26b 100644
  
      my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s);
  
-@@ -426,7 +427,7 @@ if ($opt_c) {
+@@ -426,7 +429,7 @@
          $la =~ s|\.c$|.la|;
          my $o = $s;
          $o =~ s|\.c$|.o|;
@@ -26,16 +34,24 @@ index 39ff16c..41bb26b 100644
          unshift(@objs, $lo);
      }
  
-@@ -466,7 +467,7 @@ if ($opt_c) {
+@@ -448,6 +451,7 @@
+         $opt .= " -l$opt_l";
+     }
+ 
++    my $ldflags = "$CFG_LDFLAGS";
+     if ($opt_p == 1) {
+         
+         my $apr_libs=`$apr_config --cflags --ldflags --link-libtool --libs`;
+@@ -466,7 +470,7 @@
          $opt .= " -rpath $CFG_LIBEXECDIR -module -avoid-version $apr_ldflags";
      }
  
 -    push(@cmds, "$libtool $ltflags --mode=link $CFG_CC -o $dso_file $opt $lo");
-+    push(@cmds, "$libtool $ltflags --mode=link --tag=disable-static $CFG_CC -o $dso_file $opt $lo");
++    push(@cmds, "$libtool $ltflags --mode=link --tag=disable-static $CFG_CC $ldflags -o $dso_file $opt $lo");
  
      #   execute the commands
      &execute_cmds(@cmds);
-@@ -500,7 +501,7 @@ if ($opt_i or $opt_e) {
+@@ -500,7 +504,7 @@
          if ($opt_i) {
  	    push(@cmds, "$installbuilddir/instdso.sh SH_LIBTOOL='" .
                   "$libtool' $f $CFG_LIBEXECDIR");
@@ -44,7 +60,7 @@ index 39ff16c..41bb26b 100644
          }
  
          #   determine module symbolname and filename
-@@ -536,10 +537,11 @@ if ($opt_i or $opt_e) {
+@@ -536,10 +540,11 @@
              $filename = "mod_${name}.c";
          }
          my $dir = $CFG_LIBEXECDIR;
@@ -58,7 +74,7 @@ index 39ff16c..41bb26b 100644
      }
  
      #   execute the commands
-@@ -547,108 +549,35 @@ if ($opt_i or $opt_e) {
+@@ -547,108 +552,35 @@
  
      #   activate module via LoadModule/AddModule directive
      if ($opt_a or $opt_A) {
@@ -72,27 +88,13 @@ index 39ff16c..41bb26b 100644
 -        open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die;
 -        my $content = join('', <FP>);
 -        close(FP);
-+        my $entry;
-+        foreach $entry (@lmd) {
-+            my ($name, $lmd) = @{$entry};
-+            my $filename = "$CFG_SYSCONFDIR/mods-available/$name.load";
-+            if (-f $filename) {
-+                my $cmd = "mv $filename $filename.bak~";
-+                if (system($cmd) != 0) {
-+                    die "'$cmd' failed\n";
-+                }
-+            }
- 
+-
 -        if ($content !~ m|\n#?\s*LoadModule\s+|) {
 -            error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file.");
 -            error("At least one `LoadModule' directive already has to exist.");
 -            exit(1);
 -        }
-+            notice("[preparing module `$name' in $filename]");
-+            open(FP, ">$filename") || die;
-+            print FP "$lmd\n";
-+            close(FP);
- 
+-
 -        my $lmd;
 -        my $c = '';
 -        $c = '#' if ($opt_A);
@@ -116,16 +118,20 @@ index 39ff16c..41bb26b 100644
 -                if ($cntopen == $cntclose) {
 -                    # fine. Last LoadModule is contextless.
 -                    $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|s;
--                }
++        my $entry;
++        foreach $entry (@lmd) {
++            my ($name, $lmd) = @{$entry};
++            my $filename = "$CFG_SYSCONFDIR/mods-available/$name.load";
++            if (-f $filename) {
++                my $cmd = "mv $filename $filename.bak~";
++                if (system($cmd) != 0) {
++                    die "'$cmd' failed\n";
+                 }
 -                elsif ($cntopen < $cntclose) {
 -                    error('Configuration file is not valid. There are sections'
 -                          . ' closed before opened.');
 -                    exit(1);
-+            if ($opt_a) {
-+                my $cmd = "a2enmod $name";
-+                if (system($cmd) != 0) {
-+                    die "'$cmd' failed\n";
-                 }
+-                }
 -                else {
 -                    # put our cmd after the section containing the last
 -                    # LoadModule.
@@ -165,15 +171,25 @@ index 39ff16c..41bb26b 100644
 -                              . 'sections opened and not closed.');
 -                        exit(1);
 -                    }
--                }
++            }
++
++            notice("[preparing module `$name' in $filename]");
++            open(FP, ">$filename") || die;
++            print FP "$lmd\n";
++            close(FP);
++
++            if ($opt_a) {
++                my $cmd = "a2enmod $name";
++                if (system($cmd) != 0) {
++                    die "'$cmd' failed\n";
+                 }
 -            } else {
 -                # replace already existing LoadModule line
 -                $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]");
-+
-         }
+-        }
 -        if (@lmd) {
 -            if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) {
 -                print FP $content;
@@ -183,12 +199,14 @@ index 39ff16c..41bb26b 100644
 -                       "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new");
 -            } else {
 -                notice("unable to open configuration file");
--            }
+             }
 -	}
++
++        }
      }
  }
  
-@@ -668,8 +597,8 @@ __DATA__
+@@ -668,8 +600,8 @@
  ##
  
  builddir=.
diff --git a/debian/rules b/debian/rules
index af7692e..379e876 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,10 +23,18 @@ clean-config-vars:
 	# FIXME: Maybe someone could document here why we actually need to
 	# cleanup some stuff here
 	set -x ; ( cd debian/tmp/usr/share/apache2/build/ ; \
-	grep -v -E '(^|_)(CPP|C)FLAGS' config_vars.mk > tmp_config_vars.mk ; \
-	printf "CPPFLAGS = %s\n" "`grep -E '(^|_)(CPPFLAGS|INCLUDES)' config_vars.mk | cut -d= -f 2- | tr ' ' '\n' | grep -E '^-([DI]|pthread)' | grep -v "PLATFORM" | sort | uniq | tr '\n' ' '`" >> tmp_config_vars.mk ; \
-	printf "CFLAGS = %s\n" "`grep -E '(^|_)(CPPFLAGS|CFLAGS|INCLUDES)' config_vars.mk | cut -d= -f 2- | tr ' ' '\n' | grep -E '^-(D|I/|pthread)' | grep -v "PLATFORM" | sort | uniq | tr '\n' ' '`" >> tmp_config_vars.mk ; \
+	grep -v -E '(^|_)(LD|CPP|C)FLAGS' config_vars.mk > tmp_config_vars.mk ; \
+	printf "CPPFLAGS = %s %s\n" \
+		"`grep -E '(^|_)(CPPFLAGS|INCLUDES)' config_vars.mk | cut -d= -f 2- | tr ' ' '\n' | grep -E '^-([DI]|pthread)' | grep -v "PLATFORM" | sort | uniq | tr '\n' ' '`" \
+		"`echo '$(AP2_CPPFLAGS)' | cut -d= -f 2- | tr ' ' '\n' | grep -E '^-([DI]|pthread)' | grep -v "PLATFORM" | sort | uniq | tr '\n' ' '`" >> tmp_config_vars.mk ; \
+	printf "CFLAGS = %s %s\n" "`grep -E '(^|_)(CPPFLAGS|CFLAGS|INCLUDES)' config_vars.mk | cut -d= -f 2- | tr ' ' '\n' | grep -E '^-(D|I/|pthread)' | grep -v "PLATFORM" | sort | uniq | tr '\n' ' '`" \
+		"`echo '$(AP2_CFLAGS)' | cut -d= -f 2- | tr ' ' '\n' | grep -E '^-([DI]|pthread)' | grep -v "PLATFORM" | sort | uniq | tr '\n' ' '`" >> tmp_config_vars.mk ; \
+	ldflags="`grep -E '(^|_)(LDFLAGS)' config_vars.mk | cut -d= -f 2-` `echo '$(AP2_LDFLAGS)' | cut -d= -f 2-`" ; \
+	printf "LDFLAGS = %s\n" "`echo $$ldflags | tr ' ' '\n' | sort | uniq | tr '\n' ' '`" >> tmp_config_vars.mk ; \
+	printf "SH_LDFLAGS = \n" >> tmp_config_vars.mk ; \
+	printf "LT_LDFLAGS = \n" >> tmp_config_vars.mk ; \
 	printf "NOTEST_CPPFLAGS = \n" >> tmp_config_vars.mk ; \
+	printf "NOTEST_LDFLAGS = \n" >> tmp_config_vars.mk ; \
 	printf "EXTRA_CPPFLAGS = \n" >> tmp_config_vars.mk ; \
 	printf "EXTRA_CFLAGS = \n" >> tmp_config_vars.mk ; \
 	mv tmp_config_vars.mk config_vars.mk ) ;

-- 
Debian packaging for apache2 (Apache HTTPD 2.x)



More information about the Pkg-apache-commits mailing list