Procházet zdrojové kódy

dpkg-buildflags: implement --export=configure

The goal is to make it easy to set compilation flags on a ./configure
command line for example like this:
./configure $(shell dpkg-buildflags --export=configure)

The output thus looks like this:
CFLAGS="-g -O2" CPPFLAGS="" CXXFLAGS="-g -O2" FFLAGS="-g -O2" LDFLAGS=""
Raphaël Hertzog před 15 roky
rodič
revize
250f99b073
3 změnil soubory, kde provedl 13 přidání a 4 odebrání
  1. 3 0
      debian/changelog
  2. 3 1
      man/dpkg-buildflags.1
  3. 7 3
      scripts/dpkg-buildflags.pl

+ 3 - 0
debian/changelog

@@ -90,6 +90,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
     LP: #797839
     LP: #797839
     And it fails before installing the automatic patch in debian/patches/
     And it fails before installing the automatic patch in debian/patches/
     Closes: #615899
     Closes: #615899
+  * dpkg-buildflags now supports "--export=configure" to output compilation
+    flags on a single line with double quotes as delimiter of the various
+    values.
 
 
   [ Guillem Jover ]
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520

+ 3 - 1
man/dpkg-buildflags.1

@@ -50,7 +50,9 @@ information about them.
 .BI \-\-export= format
 .BI \-\-export= format
 Print to standard output shell (if \fIformat\fP is \fBsh\fP) or make
 Print to standard output shell (if \fIformat\fP is \fBsh\fP) or make
 (if \fIformat\fP is \fBmake\fP) commands that can be used to export
 (if \fIformat\fP is \fBmake\fP) commands that can be used to export
-all the compilation flags in the environment. If the \fIformat\fP value is not
+all the compilation flags in the environment. If \fIformat\fP is
+\fBconfigure\fP then the output can be used on a \fB./configure\fP
+command-line. If the \fIformat\fP value is not
 given, \fBsh\fP is assumed. Only compilation flags starting with an
 given, \fBsh\fP is assumed. Only compilation flags starting with an
 upper case character are included, others are assumed to not be suitable
 upper case character are included, others are assumed to not be suitable
 for the environment.
 for the environment.

+ 7 - 3
scripts/dpkg-buildflags.pl

@@ -48,8 +48,10 @@ Actions:
   --origin <flag>    output the origin of the flag to stdout:
   --origin <flag>    output the origin of the flag to stdout:
                      value is one of vendor, system, user, env.
                      value is one of vendor, system, user, env.
   --list             output a list of the flags supported by the current vendor.
   --list             output a list of the flags supported by the current vendor.
-  --export=(sh|make) output commands to be executed in shell or make that export
-                     all the compilation flags as environment variables.
+  --export=(sh|make|configure)
+                     output something convenient to import the
+                     compilation flags in a shell script, in make,
+                     or on a ./configure command line.
   --dump             output all compilation flags with their values
   --dump             output all compilation flags with their values
   --help             show this help message.
   --help             show this help message.
   --version          show the version.
   --version          show the version.
@@ -66,7 +68,7 @@ while (@ARGV) {
         $action = $1;
         $action = $1;
         $param = shift(@ARGV);
         $param = shift(@ARGV);
 	usageerr(_g("%s needs a parameter"), $_) unless defined $param;
 	usageerr(_g("%s needs a parameter"), $_) unless defined $param;
-    } elsif (m/^--export(?:=(sh|make))?$/) {
+    } elsif (m/^--export(?:=(sh|make|configure))?$/) {
         usageerr(_g("two commands specified: --%s and --%s"), "export", $action)
         usageerr(_g("two commands specified: --%s and --%s"), "export", $action)
             if defined($action);
             if defined($action);
         my $type = $1 || "sh";
         my $type = $1 || "sh";
@@ -124,6 +126,8 @@ if ($action eq "get") {
 	} elsif ($export_type eq "make") {
 	} elsif ($export_type eq "make") {
 	    $value =~ s/\$/\$\$/g;
 	    $value =~ s/\$/\$\$/g;
 	    print "export $flag := $value\n";
 	    print "export $flag := $value\n";
+	} elsif ($export_type eq "configure") {
+	    print "$flag=\"$value\" ";
 	}
 	}
     }
     }
     exit(0);
     exit(0);