Просмотр исходного кода

dpkg-buildflags: Add GCJFLAGS support

This adds default flags for the GNU Compiler for Java, and the
supported hardened flags. We do not name the variable JFLAGS nor
JAVAFLAGS, to make it very clear these are not flags for javac,
they are only for GCJ; so we use the automake variable name as
existing precedent.

Closes: #708375
Guillem Jover лет назад: 13
Родитель
Сommit
325dd5f210

+ 1 - 0
debian/changelog

@@ -93,6 +93,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Do not set -fstack-protector in the default build flags on arm64 (it's
     not yet supported). Thanks to Matthias Klose <doko@ubuntu.com>.
     Closes: #711936
+  * Add GCJFLAGS support to dpkg-buildflags. Closes: #708375
 
   [ Updated manpages translations ]
   * Fix incorrect translation of "fortify" in French manpage for dpkg-buildflags

+ 3 - 0
man/dpkg-buildflags.1

@@ -169,6 +169,9 @@ Options for the C preprocessor. Default value: empty.
 .B CXXFLAGS
 Options for the C++ compiler. Same as \fBCFLAGS\fP.
 .TP
+.B GCJFLAGS
+Options for the GNU Java compiler (gcj). A subset of \fBCFLAGS\fP.
+.TP
 .B FFLAGS
 Options for the Fortran compiler. Same as \fBCFLAGS\fP.
 .TP

+ 3 - 0
scripts/Dpkg/BuildFlags.pm

@@ -78,6 +78,7 @@ sub load_vendor_defaults {
 	CPPFLAGS => '',
 	CFLAGS   => $default_flags,
 	CXXFLAGS => $default_flags,
+	GCJFLAGS => $default_flags,
 	FFLAGS   => $default_flags,
 	LDFLAGS  => '',
     };
@@ -85,6 +86,7 @@ sub load_vendor_defaults {
 	CPPFLAGS => 'vendor',
 	CFLAGS   => 'vendor',
 	CXXFLAGS => 'vendor',
+	GCJFLAGS => 'vendor',
 	FFLAGS   => 'vendor',
 	LDFLAGS  => 'vendor',
     };
@@ -92,6 +94,7 @@ sub load_vendor_defaults {
 	CPPFLAGS => 0,
 	CFLAGS   => 0,
 	CXXFLAGS => 0,
+	GCJFLAGS => 0,
 	FFLAGS   => 0,
 	LDFLAGS  => 0,
     };

+ 2 - 0
scripts/Dpkg/Vendor/Debian.pm

@@ -151,6 +151,7 @@ sub add_hardening_flags {
     if ($use_feature{pie}) {
 	$flags->append('CFLAGS', '-fPIE');
 	$flags->append('CXXFLAGS', '-fPIE');
+	$flags->append('GCJFLAGS', '-fPIE');
 	$flags->append('LDFLAGS', '-fPIE -pie');
     }
 
@@ -158,6 +159,7 @@ sub add_hardening_flags {
     if ($use_feature{stackprotector}) {
 	$flags->append('CFLAGS', '-fstack-protector --param=ssp-buffer-size=4');
 	$flags->append('CXXFLAGS', '-fstack-protector --param=ssp-buffer-size=4');
+	$flags->append('GCJFLAGS', '-fstack-protector --param=ssp-buffer-size=4');
     }
 
     # Fortify Source

+ 1 - 1
scripts/Dpkg/Vendor/Ubuntu.pm

@@ -97,7 +97,7 @@ sub run_hook {
 	my $flags = shift @params;
 
 	if (debarch_eq(get_host_arch(), 'ppc64')) {
-	    for my $flag (qw(CFLAGS CXXFLAGS FFLAGS)) {
+	    for my $flag (qw(CFLAGS CXXFLAGS GCJFLAGS FFLAGS)) {
 		$flags->set($flag, '-g -O3', 'vendor');
 	    }
 	}

+ 2 - 1
scripts/mk/buildflags.mk

@@ -3,6 +3,7 @@
 # CFLAGS: flags for the C compiler
 # CPPFLAGS: flags for the C preprocessor
 # CXXFLAGS: flags for the C++ compiler
+# GCJFLAGS: flags for the GNU Java compiler
 # FFLAGS: flags for the Fortran compiler
 # LDFLAGS: flags for the linker
 #
@@ -14,7 +15,7 @@
 
 dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
 
-DPKG_BUILDFLAGS_LIST = CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS
+DPKG_BUILDFLAGS_LIST = CFLAGS CPPFLAGS CXXFLAGS GCJFLAGS FFLAGS LDFLAGS
 
 define dpkg_buildflags_export_envvar
 ifdef $(1)