Skip to content

Commit 837c4fc

Browse files
OlegGirkoUdjinM6
authored andcommitted
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 <ol@infoserver.lv>
1 parent 86e6f0d commit 837c4fc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,21 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
203203
BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt${bitcoin_qt_got_major_vers} lrelease${bitcoin_qt_got_major_vers} lrelease], $qt_bin_path)
204204
BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt${bitcoin_qt_got_major_vers} lupdate${bitcoin_qt_got_major_vers} lupdate],$qt_bin_path, yes)
205205
206+
BITCOIN_QT_CHECK([
207+
AC_CACHE_CHECK([whether $RCC accepts --format-version option],
208+
[ac_cv_prog_rcc_accepts_format_version],
209+
[ac_cv_prog_rcc_accepts_format_version=no
210+
echo '<!DOCTYPE RCC><RCC version="1.0"/>' > conftest.qrc
211+
$RCC --format-version 1 conftest.qrc >/dev/null 2>&1 && ac_cv_prog_rcc_accepts_format_version=yes
212+
rm -f conftest.qrc])
213+
if test "$ac_cv_prog_rcc_accepts_format_version" = yes; then
214+
RCCFLAGS="--format-version 1"
215+
else
216+
RCCFLAGS=
217+
fi
218+
AC_SUBST(RCCFLAGS)
219+
])
220+
206221
MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)'
207222
case $host in
208223
*darwin*)

src/Makefile.qt.include

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,12 @@ translate: qt/dashstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) qt
580580
$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
581581
@test -f $(RCC)
582582
@test -f $(@D)/$(<F) || cp -f $< $(@D)
583-
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name dash_locale $(@D)/$(<F) | \
583+
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) $(RCCFLAGS) -name dash_locale $(@D)/$(<F) | \
584584
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
585585

586586
$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_MOVIES) $(PROTOBUF_H)
587587
@test -f $(RCC)
588-
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name dash $< | \
588+
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) $(RCCFLAGS) -name dash $< | \
589589
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
590590

591591
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno

0 commit comments

Comments
 (0)