Merge #13732: Depends: Fix Qt's rcc determinism
6b5506a286
Fix Qt's rcc determinism for depends/gitian (Fuzzbawls)
Pull request description:
With the update to Qt 5.9 having been merged, Qt's `rcc` tool now embeds a file's last modified time in it's output. Since the build system generates temporary files for all locale translations (`*.qm` files) at build time, the resulting `qrc_bitcoin_locale.cpp` file was always being generated in a non-deterministic way.
This is a backport of https://bugreports.qt.io/browse/QTBUG-62511, which is included in Qt versions 5.11+, that allows for an environment variable (`QT_RCC_SOURCE_DATE_OVERRIDE`) to override the behavior described above. This environment variable is in turn set in the gitian descriptors, as that is where determinism is vital for release purposes.
Prior to this, the `qt_libbitcoinqt_a-qrc_bitcoin_locale.o` object file (included into `libbitcoinqt.a`) was returning a different `sha256sum` for each and every build, regardless of file contents change, thus breaking determinism in the resulting binaries.
This should fix #13731
Tree-SHA512: 174017e41f9afc3950ef54a9419de81577ec900db9aec3c78ccd3d879c6aecaaeb944fde0615b933f43e6ca9d7898a27ec071cdd0b91cb772755a3012de96725
This commit is contained in:
commit
e8ffec69f7
5 changed files with 21 additions and 1 deletions
|
@ -43,6 +43,7 @@ script: |
|
||||||
HOST_LDFLAGS=-static-libstdc++
|
HOST_LDFLAGS=-static-libstdc++
|
||||||
|
|
||||||
export QT_RCC_TEST=1
|
export QT_RCC_TEST=1
|
||||||
|
export QT_RCC_SOURCE_DATE_OVERRIDE=1
|
||||||
export GZIP="-9n"
|
export GZIP="-9n"
|
||||||
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
||||||
export TZ="UTC"
|
export TZ="UTC"
|
||||||
|
|
|
@ -40,6 +40,7 @@ script: |
|
||||||
FAKETIME_PROGS="ar ranlib date dmg genisoimage"
|
FAKETIME_PROGS="ar ranlib date dmg genisoimage"
|
||||||
|
|
||||||
export QT_RCC_TEST=1
|
export QT_RCC_TEST=1
|
||||||
|
export QT_RCC_SOURCE_DATE_OVERRIDE=1
|
||||||
export GZIP="-9n"
|
export GZIP="-9n"
|
||||||
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
||||||
export TZ="UTC"
|
export TZ="UTC"
|
||||||
|
|
|
@ -36,6 +36,7 @@ script: |
|
||||||
HOST_CXXFLAGS="-O2 -g"
|
HOST_CXXFLAGS="-O2 -g"
|
||||||
|
|
||||||
export QT_RCC_TEST=1
|
export QT_RCC_TEST=1
|
||||||
|
export QT_RCC_SOURCE_DATE_OVERRIDE=1
|
||||||
export GZIP="-9n"
|
export GZIP="-9n"
|
||||||
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
|
||||||
export TZ="UTC"
|
export TZ="UTC"
|
||||||
|
|
|
@ -8,7 +8,7 @@ $(package)_dependencies=openssl zlib
|
||||||
$(package)_linux_dependencies=freetype fontconfig libxcb libX11 xproto libXext
|
$(package)_linux_dependencies=freetype fontconfig libxcb libX11 xproto libXext
|
||||||
$(package)_build_subdir=qtbase
|
$(package)_build_subdir=qtbase
|
||||||
$(package)_qt_libs=corelib network widgets gui plugins testlib
|
$(package)_qt_libs=corelib network widgets gui plugins testlib
|
||||||
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch
|
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch
|
||||||
|
|
||||||
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
|
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
|
||||||
$(package)_qttranslations_sha256_hash=9822084f8e2d2939ba39f4af4c0c2320e45d5996762a9423f833055607604ed8
|
$(package)_qttranslations_sha256_hash=9822084f8e2d2939ba39f4af4c0c2320e45d5996762a9423f833055607604ed8
|
||||||
|
@ -94,6 +94,7 @@ $(package)_config_opts_i686_linux = -xplatform linux-g++-32
|
||||||
$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64
|
$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64
|
||||||
$(package)_config_opts_mingw32 = -no-opengl -xplatform win32-g++ -device-option CROSS_COMPILE="$(host)-"
|
$(package)_config_opts_mingw32 = -no-opengl -xplatform win32-g++ -device-option CROSS_COMPILE="$(host)-"
|
||||||
$(package)_build_env = QT_RCC_TEST=1
|
$(package)_build_env = QT_RCC_TEST=1
|
||||||
|
$(package)_build_env += QT_RCC_SOURCE_DATE_OVERRIDE=1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_fetch_cmds
|
define $(package)_fetch_cmds
|
||||||
|
@ -133,6 +134,7 @@ define $(package)_preprocess_cmds
|
||||||
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch &&\
|
patch -p1 -i $($(package)_patch_dir)/fix_qt_pkgconfig.patch &&\
|
||||||
patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\
|
patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\
|
||||||
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\
|
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\
|
||||||
|
patch -p1 -i $($(package)_patch_dir)/fix_rcc_determinism.patch &&\
|
||||||
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
||||||
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
||||||
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
||||||
|
|
15
depends/patches/qt/fix_rcc_determinism.patch
Normal file
15
depends/patches/qt/fix_rcc_determinism.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
--- old/qtbase/src/tools/rcc/rcc.cpp
|
||||||
|
+++ new/qtbase/src/tools/rcc/rcc.cpp
|
||||||
|
@@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
|
||||||
|
if (lib.formatVersion() >= 2) {
|
||||||
|
// last modified time stamp
|
||||||
|
const QDateTime lastModified = m_fileInfo.lastModified();
|
||||||
|
- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
|
||||||
|
+ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0);
|
||||||
|
+ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong();
|
||||||
|
+ if (sourceDate != 0)
|
||||||
|
+ lastmod = sourceDate;
|
||||||
|
+ lib.writeNumber8(lastmod);
|
||||||
|
if (text || pass1)
|
||||||
|
lib.writeChar('\n');
|
||||||
|
}
|
Loading…
Reference in a new issue