This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b2de67e2c2cd7c595dce3b62b40d50555af69866

The following commit(s) were added to refs/heads/main by this push:
     new b2de67e2c Dpkg::Vendor::Debian: Add time64 feature in the future area
b2de67e2c is described below

commit b2de67e2c2cd7c595dce3b62b40d50555af69866 (HEAD -> main)
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Jan 31 22:07:51 2023 +0100

    Dpkg::Vendor::Debian: Add time64 feature in the future area
    
    This feature (disabled by default) enables 64-bit time on 32-bit
    architectures where their ABI does not define it by default. This
    feature automatically enables the lfs one as it is required by it.
    
    Do not enable time64 for the new 32-bit architectures that already have
    it enabled by default as part of their ABI, that is «arc» and «or1k».
    
    Closes: #1030159
    Based-on-patch-by: Helge Deller <[email protected]>
---
 man/dpkg-buildflags.pod       |  7 +++++++
 scripts/Dpkg/Vendor/Debian.pm | 21 ++++++++++++++++++---
 scripts/t/Dpkg_BuildFlags.t   |  1 +
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/man/dpkg-buildflags.pod b/man/dpkg-buildflags.pod
index e6336228e..2dd7e564b 100644
--- a/man/dpkg-buildflags.pod
+++ b/man/dpkg-buildflags.pod
@@ -347,6 +347,13 @@ Large File Support on 32-bit architectures where their ABI 
does
 not include LFS by default, by adding
 B<-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64> to B<CPPFLAGS>.
 
+=item B<time64>
+
+This setting (since dpkg 1.22.0; disabled by default) enables 64-bit time_t
+support on 32-bit architectures where their ABI does not include it by
+default, by adding B<-D_TIME_BITS=64> to B<CPPFLAGS>.
+This setting automatically enables the B<lfs> feature as it requires it.
+
 =back
 
 =head2 qa
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index d3481fb98..154a6b8dd 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -107,6 +107,7 @@ sub set_build_features {
     my %use_feature = (
         future => {
             lfs => 0,
+            time64 => 0,
         },
         qa => {
             bug => 0,
@@ -164,6 +165,8 @@ sub set_build_features {
 
     my $arch = Dpkg::Arch::get_host_arch();
     my ($abi, $libc, $os, $cpu) = Dpkg::Arch::debarch_to_debtuple($arch);
+    my ($abi_bits, $abi_endian) = Dpkg::Arch::debarch_to_abiattrs($arch);
+    my $cpu_bits = Dpkg::Arch::debarch_to_cpubits($arch);
 
     unless (defined $abi and defined $libc and defined $os and defined $cpu) {
         warning(g_("unknown host architecture '%s'"), $arch);
@@ -172,10 +175,18 @@ sub set_build_features {
 
     ## Area: future
 
-    if ($use_feature{future}{lfs}) {
-        my ($abi_bits, $abi_endian) = Dpkg::Arch::debarch_to_abiattrs($arch);
-        my $cpu_bits = Dpkg::Arch::debarch_to_cpubits($arch);
+    if ($use_feature{future}{time64}) {
+        if (any { $cpu eq $_ } qw(arc or1k) or
+            $abi_bits != 32 or
+            $cpu_bits != 32) {
+            $use_feature{future}{time64} = 0;
+        } else {
+            # On glibc 64-bit time_t support requires LFS.
+            $use_feature{future}{lfs} = 1;
+        }
+    }
 
+    if ($use_feature{future}{lfs}) {
         if ($abi_bits != 32 or $cpu_bits != 32) {
             $use_feature{future}{lfs} = 0;
         }
@@ -339,6 +350,10 @@ sub _add_build_flags {
                        '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
     }
 
+    if ($flags->use_feature('future', 'time64')) {
+        $flags->append('CPPFLAGS', '-D_TIME_BITS=64');
+    }
+
     ## Area: qa
 
     # Warnings that detect actual bugs.
diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t
index c6e0ef8ff..1697d2787 100644
--- a/scripts/t/Dpkg_BuildFlags.t
+++ b/scripts/t/Dpkg_BuildFlags.t
@@ -87,6 +87,7 @@ ok($bf->is_maintainer_modified('DPKGFLAGS'), 'prepend marked 
flag as maint modif
 my %known_features = (
     future => [ qw(
         lfs
+        time64
     ) ],
     hardening => [ qw(
         bindnow

-- 
Dpkg.Org's dpkg

Reply via email to