Package: dpkg
Severity: important
Tags: lfs, hppa
Version: 1.21.17
Tags: hppa, patch, ftbfs

This is a follow-up for #1020335 regarding "enabling LFS by default on hppa 
arch".

It's unfeasable to try to fix every package which fails on
hppa due to missing large file support. The problem is, that failures happen
undeterministic and silently at runtime which makes it often really hard to
find the real cause and in summary wastes a lot of developer time.

The attached patch is trivial and enables LFS by default for the hppa arch only.
Guillem, would you mind applying the attached patch?

Testing:

$ dpkg-buildflags --get CPPFLAGS
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2

$ DEB_BUILD_MAINT_OPTIONS="future=+lfs" dpkg-buildflags --get CPPFLAGS
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wdate-time -D_FORTIFY_SOURCE=2

$ DEB_BUILD_MAINT_OPTIONS="future=-lfs" dpkg-buildflags --get CPPFLAGS
-Wdate-time -D_FORTIFY_SOURCE=2

That way, we *just* need to mark those packages which shouldn't be built with 
LFS with:
DEB_BUILD_MAINT_OPTIONS="future=-lfs"
This is much easier to handle than the other way around.
I expect the number of packages which need this flag disabled is minimal.

Thanks,
Helge
diff -up ./scripts/Dpkg/Vendor/Debian.pm.org ./scripts/Dpkg/Vendor/Debian.pm
--- ./scripts/Dpkg/Vendor/Debian.pm.org	2022-12-21 11:07:11.032960709 +0000
+++ ./scripts/Dpkg/Vendor/Debian.pm	2022-12-21 13:47:24.308936916 +0000
@@ -96,6 +96,16 @@ sub run_hook {
 sub _add_build_flags {
     my ($self, $flags) = @_;
 
+    require Dpkg::Arch;
+
+    my $arch = Dpkg::Arch::get_host_arch();
+    my ($abi, $libc, $os, $cpu) = Dpkg::Arch::debarch_to_debtuple($arch);
+
+    unless (defined $abi and defined $libc and defined $os and defined $cpu) {
+        warning(g_("unknown host architecture '%s'"), $arch);
+        ($abi, $os, $cpu) = ('', '', '');
+    }
+
     # Default feature states.
     my %use_feature = (
         future => {
@@ -138,6 +148,11 @@ sub _add_build_flags {
         },
     );
 
+    # enable LFS for hppa by default, disable with "future=-lfs"
+    if ($cpu =~ /^(?:hppa)$/) {
+	$use_feature{future}{lfs} = 1;
+    }
+
     ## Setup
 
     require Dpkg::BuildOptions;
@@ -151,16 +166,6 @@ sub _add_build_flags {
         $opts_maint->parse_features($area, $use_feature{$area});
     }
 
-    require Dpkg::Arch;
-
-    my $arch = Dpkg::Arch::get_host_arch();
-    my ($abi, $libc, $os, $cpu) = Dpkg::Arch::debarch_to_debtuple($arch);
-
-    unless (defined $abi and defined $libc and defined $os and defined $cpu) {
-        warning(g_("unknown host architecture '%s'"), $arch);
-        ($abi, $os, $cpu) = ('', '', '');
-    }
-
     ## Global defaults
 
     my @compile_flags = qw(

Reply via email to