Package: eccodes / 2.12.0-1

reproducible.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Author: Alastair McKinstry <mckinstry@debian.org>
Description: Make builds bit-reproducible
Last-Updated: 2016-10-27
Forwarded: https://software.ecmwf.int/issues/browse/SUP-1590 

Index: eccodes-2.10.0/CMakeLists.txt
===================================================================
--- eccodes-2.10.0.orig/CMakeLists.txt
+++ eccodes-2.10.0/CMakeLists.txt
@@ -113,6 +113,12 @@ ecbuild_add_option( FEATURE FORTRAN
     # REQUIRED_LANGUAGES Fortran # TODO
 )
 
+ecbuild_add_option( FEATURE BIT_REPRODUCIBLE
+    DESCRIPTION "build bit-reproducible package"
+    DEFAULT ON
+    # Required for Debian, soon the world ...
+)
+
 # TODO Remove this after REQUIRED_LANGUAGES
 if( ENABLE_FORTRAN )
     # will set EC_HAVE_FORTRAN with the result
Index: eccodes-2.10.0/cmake/ecbuild_config.h.in
===================================================================
--- eccodes-2.10.0.orig/cmake/ecbuild_config.h.in
+++ eccodes-2.10.0/cmake/ecbuild_config.h.in
@@ -22,14 +22,18 @@
 
 /* config info */
 
-#define @PNAME@_OS_NAME          "@CMAKE_SYSTEM@"
+#define @PNAME@_OS_NAME          "Debian"
 #define @PNAME@_OS_BITS          @EC_OS_BITS@
 #define @PNAME@_OS_BITS_STR      "@EC_OS_BITS@"
 #define @PNAME@_OS_STR           "@EC_OS_NAME@.@EC_OS_BITS@"
-#define @PNAME@_OS_VERSION       "@CMAKE_SYSTEM_VERSION@"
+#define @PNAME@_OS_VERSION       "Debian"
 #define @PNAME@_SYS_PROCESSOR    "@CMAKE_SYSTEM_PROCESSOR@"
 
-#define @PNAME@_BUILD_TIMESTAMP  "@EC_BUILD_TIMESTAMP@"
+#ifndef HAVE_BIT_REPRODUCIBLE
+   #define @PNAME@_BUILD_TIMESTAMP  "@EC_BUILD_TIMESTAMP@"
+#else
+   #define @PNAME@_BUILD_TIMESTAMP "NO-TIMESTAMP-FOR-BIT_REPRODUCIBLE-BUILD"
+#endif
 #define @PNAME@_BUILD_TYPE       "@CMAKE_BUILD_TYPE@"
 
 #define @PNAME@_C_COMPILER_ID      "@CMAKE_C_COMPILER_ID@"
@@ -51,9 +55,6 @@
 #define @PNAME@_INSTALL_LIB_DIR   "@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@"
 #define @PNAME@_INSTALL_DATA_DIR  "@CMAKE_INSTALL_PREFIX@/@INSTALL_DATA_DIR@"
 
-#define @PNAME@_DEVELOPER_SRC_DIR "@CMAKE_SOURCE_DIR@"
-#define @PNAME@_DEVELOPER_BIN_DIR "@CMAKE_BINARY_DIR@"
-
 #cmakedefine EC_HAVE_FORTRAN
 
 #ifdef EC_HAVE_FORTRAN
Index: eccodes-2.10.0/cmake/ecbuild_print_summary.cmake
===================================================================
--- eccodes-2.10.0.orig/cmake/ecbuild_print_summary.cmake
+++ eccodes-2.10.0/cmake/ecbuild_print_summary.cmake
@@ -57,7 +57,9 @@ macro( ecbuild_print_summary )
       ecbuild_info( "endiness         : Little Endian -- IEEE [${IEEE_LE}]" )
     endif()
     ecbuild_info( "build type       : [${CMAKE_BUILD_TYPE}]" )
-    ecbuild_info( "timestamp        : [${EC_BUILD_TIMESTAMP}]" )
+    if ( NOT HAVE_BIT_REPRODUCIBLE )
+      ecbuild_info( "timestamp        : [${EC_BUILD_TIMESTAMP}]" )
+    endif()
     ecbuild_info( "install prefix   : [${CMAKE_INSTALL_PREFIX}]" )
     ecbuild_info( "  bin dir        : [${${PNAME}_FULL_INSTALL_BIN_DIR}]" )
     ecbuild_info( "  lib dir        : [${${PNAME}_FULL_INSTALL_LIB_DIR}]" )
Index: eccodes-2.10.0/cmake/ecbuild_get_date.cmake
===================================================================
--- eccodes-2.10.0.orig/cmake/ecbuild_get_date.cmake
+++ eccodes-2.10.0/cmake/ecbuild_get_date.cmake
@@ -20,12 +20,16 @@
 ##############################################################################
 
 macro(ecbuild_get_date RESULT)
+  if (HAVE_BIT_REPRODUCIBLE)
+    ecbuild_info("date not included in bit-reproducible builds")
+  else()
     if(UNIX)
         execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
         string(REGEX REPLACE "(..)/(..)/(....).*" "\\3.\\2.\\1" ${RESULT} ${${RESULT}})
     else()
         ecbuild_error("date not implemented")
-    endif()
+      endif()
+  endif()
 endmacro(ecbuild_get_date)
 
 ##############################################################################
@@ -42,11 +46,15 @@ endmacro(ecbuild_get_date)
 ##############################################################################
 
 macro(ecbuild_get_timestamp RESULT)
+  if (HAVE_BIT_REPRODUCIBLE)
+    ecbuild_info("date not included in bit-reproducible builds")
+  else()
     if(UNIX)
         execute_process(COMMAND "date" "+%Y/%m/%d/%H/%M/%S" OUTPUT_VARIABLE _timestamp)
         string(REGEX REPLACE "(....)/(..)/(..)/(..)/(..)/(..).*" "\\1\\2\\3\\4\\5\\6" ${RESULT} ${_timestamp})
     else()
         ecbuild_warn("This is NOT UNIX - timestamp not implemented")
     endif()
+  endif()
 endmacro(ecbuild_get_timestamp)