summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuro Bystricky <juro.bystricky@intel.com>2017-06-05 14:33:40 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2017-08-17 04:12:30 +0200
commit3bf135d60c7e1d210281b904be8e869839594abd (patch)
tree2b119581e6e206fb4f5f75362d6458dec2020b31
parent0f94340197970ab5f6f610f2b00750522e3d89b8 (diff)
downloadopenembedded-core-contrib-3bf135d60c7e1d210281b904be8e869839594abd.tar.gz
openembedded-core-contrib-3bf135d60c7e1d210281b904be8e869839594abd.tar.bz2
openembedded-core-contrib-3bf135d60c7e1d210281b904be8e869839594abd.zip
nspr: improve binary reproducibility
Use SOURCE_DATE_EPOCH (if available) to define SH_NOW and SH_DATE. These values are used as build time/date. Rather than patching the sources to support SOURCE_DATE_EPOCH, we pass SH_NOW and SH_DATE to the Makefile. These two variables were originally initialized in the Makefile, so they can be overridden via "make" command line arguments. Care is taken to initialize the passed variables in correct format. Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-rw-r--r--meta/recipes-support/nspr/nspr_4.16.bb18
1 files changed, 12 insertions, 6 deletions
diff --git a/meta/recipes-support/nspr/nspr_4.16.bb b/meta/recipes-support/nspr/nspr_4.16.bb
index a634afbf75..e79d9046c3 100644
--- a/meta/recipes-support/nspr/nspr_4.16.bb
+++ b/meta/recipes-support/nspr/nspr_4.16.bb
@@ -153,12 +153,18 @@ inherit autotools
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
-do_compile_prepend() {
- oe_runmake CROSS_COMPILE=1 CFLAGS="-DXP_UNIX" LDFLAGS="" CC=gcc -C config export
-}
-
-do_compile_append() {
- oe_runmake -C pr/tests
+do_compile(){
+ oe_runmake CROSS_COMPILE=1 CFLAGS="-DXP_UNIX" LDFLAGS="" CC=gcc -C config export
+
+ if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then
+ BUILD_DATE=`date -u -d "@${SOURCE_DATE_EPOCH}" +'%Y-%m-%d %T'`
+ BUILD_TIME="${SOURCE_DATE_EPOCH}000000"
+ oe_runmake "SH_NOW=${BUILD_TIME}" "SH_DATE=${BUILD_DATE}"
+ else
+ oe_runmake
+ fi
+
+ oe_runmake -C pr/tests
}
do_install_append() {