File reproducible.patch of Package codes_ui
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
--- codes_ui-1.3.0-Source/CMakeLists.txt.orig 2020-04-20 15:24:04.925515776 +0200
+++ codes_ui-1.3.0-Source/CMakeLists.txt 2020-04-20 15:23:24.544582712 +0200
@@ -25,6 +25,12 @@ ecbuild_requires_macro_version( 1.9 )
option( ENABLE_QT_DEBUG "enable Qt debugging messages" OFF )
+ecbuild_add_option( FEATURE BIT_REPRODUCIBLE
+ DESCRIPTION "build bit-reproducible package"
+ DEFAULT ON
+ # Required for Debian, soon the world ...
+)
+
###############################################################################
#C check if it is an exeternal build (outside the metview source)
--- codes_ui-1.3.0-Source/cmake/ecbuild_config.h.in.orig 2019-06-10 10:49:09.000000000 +0200
+++ codes_ui-1.3.0-Source/cmake/ecbuild_config.h.in 2020-04-20 15:27:53.222791651 +0200
@@ -25,14 +25,18 @@
/* config info */
-#define @PNAME@_OS_NAME "@CMAKE_SYSTEM@"
+#define @PNAME@_OS_NAME "linux"
#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 "OBS"
#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@"
@@ -54,9 +58,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@"
-
/* Fortran support */
#if @EC_HAVE_FORTRAN@
--- codes_ui-1.3.0-Source/cmake/ecbuild_print_summary.cmake.orig 2020-04-20 15:30:51.954922912 +0200
+++ codes_ui-1.3.0-Source/cmake/ecbuild_print_summary.cmake 2020-04-20 15:31:21.399603570 +0200
@@ -58,6 +58,9 @@ macro( ecbuild_print_summary )
ecbuild_info( "endiness : Little Endian -- IEEE [${IEEE_LE}]" )
endif()
ecbuild_info( "build type : [${CMAKE_BUILD_TYPE}]" )
+ if ( NOT HAVE_BIT_REPRODUCIBLE )
+ ecbuild_info( "timestamp : [${EC_BUILD_TIMESTAMP}]" )
+ endif()
ecbuild_info( "timestamp : [${EC_BUILD_TIMESTAMP}]" )
ecbuild_info( "install prefix : [${CMAKE_INSTALL_PREFIX}]" )
ecbuild_info( " bin dir : [${${PROJECT_NAME}_FULL_INSTALL_BIN_DIR}]" )
--- codes_ui-1.3.0-Source/cmake/ecbuild_get_date.cmake.orig 2018-06-21 15:06:29.000000000 +0200
+++ codes_ui-1.3.0-Source/cmake/ecbuild_get_date.cmake 2020-04-20 15:34:04.183366886 +0200
@@ -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()
endmacro(ecbuild_get_date)
##############################################################################
@@ -42,11 +46,15 @@ endmacro(ecbuild_get_date)
##############################################################################
macro(ecbuild_get_timestamp RESULT)
+ if (HAVE_BIT_REPRODUCIBLE)
+ ecbuild_info("timestamp 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)