Source: codeblocks
Version: 13.12+dfsg-4
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that codeblocks could not be built reproducibly.

The attached patch replaces the preprocessor macros __DATE__ and
__TIME__ with BUILD_DATE and BUILD_TIME, respectively, which can be
set deterministically using SOURCE_DATE_EPOCH [2] in debian/rules like
so:

--- a/debian/rules
+++ b/debian/rules
@@ -12,7 +12,9 @@
 export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
 # Disable WXDEBUG checks, which wx3.0 defaults to enabling but were off by
 # default in wx2.8, to address issues such as #736368.
-export DEB_CPPFLAGS_MAINT_APPEND=-DNDEBUG
+export DEB_CPPFLAGS_MAINT_APPEND=-DNDEBUG \
+       -DBUILD_DATE="\"\\\"`date -u -d @$(SOURCE_DATE_EPOCH) +%Y-%m-%d`\\\"\"" 
\
+       -DBUILD_TIME="\"\\\"`date -u -d @$(SOURCE_DATE_EPOCH) +%T`\\\"\""
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk

Regards,
Fabian Wolff

[1] https://wiki.debian.org/ReproducibleBuilds
[2] https://reproducible-builds.org/specs/source-date-epoch/
--- a/src/plugins/contrib/wxSmithSTC/stedit/src/stedlgs.cpp
+++ b/src/plugins/contrib/wxSmithSTC/stedit/src/stedlgs.cpp
@@ -2854,7 +2854,7 @@
             #else
                 wxT("Scintilla 1.70"),
             #endif
-                wxString::FromAscii(__DATE__).wx_str(), // no need to show time
+                wxString::FromAscii(BUILD_DATE).wx_str(), // no need to show time
                 buildStr.wx_str()
                 );
 
--- a/src/sdk/cbexception.cpp
+++ b/src/sdk/cbexception.cpp
@@ -44,7 +44,7 @@
                  "build: %s %s)"),
                File.c_str(), Line, Message.c_str(),
                ConfigManager::GetRevisionNumber(), gccvers.c_str(),
-               wxT(__DATE__), wxT(__TIME__));
+               wxT(BUILD_DATE), wxT(BUILD_TIME));
     if (safe)
         wxSafeShowMessage(title, err);
     else
--- a/src/sdk/configmanager.cpp
+++ b/src/sdk/configmanager.cpp
@@ -259,12 +259,12 @@
 #ifndef __GNUC__
     info.Printf(_T( " application info:\n"
                     "\t svn_revision:\t%u\n"
-                    "\t build_date:\t%s, %s "), ConfigManager::GetRevisionNumber(), wxT(__DATE__), wxT(__TIME__));
+                    "\t build_date:\t%s, %s "), ConfigManager::GetRevisionNumber(), wxT(BUILD_DATE), wxT(BUILD_TIME));
 #else
     info.Printf(_T( " application info:\n"
                     "\t svn_revision:\t%u\n"
                     "\t build_date:\t%s, %s\n"
-                    "\t gcc_version:\t%d.%d.%d "), ConfigManager::GetRevisionNumber(), wxT(__DATE__), wxT(__TIME__),
+                    "\t gcc_version:\t%d.%d.%d "), ConfigManager::GetRevisionNumber(), wxT(BUILD_DATE), wxT(BUILD_TIME),
                 __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
 #endif
 
--- a/src/src/appglobals.cpp
+++ b/src/src/appglobals.cpp
@@ -63,8 +63,8 @@
     const wxString bit_type              = wxT(" - 32 bit");
 #endif
 
-    const wxString AppBuildTimestamp     = (  wxString(wxT(__DATE__)) + wxT(", ")
-                                            + wxT(__TIME__) + wxT(" - wx")
+    const wxString AppBuildTimestamp     = (  wxString(wxT(BUILD_DATE)) + wxT(", ")
+                                            + wxT(BUILD_TIME) + wxT(" - wx")
                                             + wxString(wxT(wxVERSION_NUM_DOT_STRING))
                                             + wxT(" (") + AppPlatform + wxT(", ")
                                             + AppWXAnsiUnicode + wxT(")") + bit_type );
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to