From 837c4fc5de4bd808542797653ebf318c01a413e6 Mon Sep 17 00:00:00 2001
From: Oleg Girko
Date: Fri, 15 Dec 2017 15:21:44 +0000
Subject: [PATCH] Force rcc to use resource format version 1. (#1784)
Qt 5.8.0 introduced format version 2 for resources embedded into executable,
and now rcc uses this format by default to generate them.
Unfortunately, v2 format includes timestamps for embedded resource files.
Some of resource files (translations) are generated automatically
and have different timestamps for every build.
This means that dash-qt executable is slightly different for every build
because resource data contain different timestamps.
As a result, it makes reproducible build extremely difficult.
Fortunately, Qt 5.9.0 introduced --format-version option for rcc.
This change adds configure check for whether rcc accepts this option
and uses it to force rcc to generate version 1 format data.
Signed-off-by: Oleg Girko
---
build-aux/m4/bitcoin_qt.m4 | 15 +++++++++++++++
src/Makefile.qt.include | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4
index d690a1fade..6ac45fc2f6 100644
--- a/build-aux/m4/bitcoin_qt.m4
+++ b/build-aux/m4/bitcoin_qt.m4
@@ -203,6 +203,21 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt${bitcoin_qt_got_major_vers} lrelease${bitcoin_qt_got_major_vers} lrelease], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt${bitcoin_qt_got_major_vers} lupdate${bitcoin_qt_got_major_vers} lupdate],$qt_bin_path, yes)
+ BITCOIN_QT_CHECK([
+ AC_CACHE_CHECK([whether $RCC accepts --format-version option],
+ [ac_cv_prog_rcc_accepts_format_version],
+ [ac_cv_prog_rcc_accepts_format_version=no
+ echo '' > conftest.qrc
+ $RCC --format-version 1 conftest.qrc >/dev/null 2>&1 && ac_cv_prog_rcc_accepts_format_version=yes
+ rm -f conftest.qrc])
+ if test "$ac_cv_prog_rcc_accepts_format_version" = yes; then
+ RCCFLAGS="--format-version 1"
+ else
+ RCCFLAGS=
+ fi
+ AC_SUBST(RCCFLAGS)
+ ])
+
MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)'
case $host in
*darwin*)
diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include
index ce1acdd4db..fd50a22cfe 100644
--- a/src/Makefile.qt.include
+++ b/src/Makefile.qt.include
@@ -580,12 +580,12 @@ translate: qt/dashstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) qt
$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
@test -f $(RCC)
@test -f $(@D)/$( $@
$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_MOVIES) $(PROTOBUF_H)
@test -f $(RCC)
- $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name dash $< | \
+ $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) $(RCCFLAGS) -name dash $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno