diff --git a/common/environment/setup/git.sh b/common/environment/setup/git.sh
index 58f73494fd0..f4dc28a27cb 100644
--- a/common/environment/setup/git.sh
+++ b/common/environment/setup/git.sh
@@ -1,6 +1,10 @@
 # If XBPS_USE_BUILD_MTIME is enabled in conf file don't continue.
 # only run this, if SOURCE_DATE_EPOCH isn't set.
-if [ -z "$XBPS_USE_BUILD_MTIME" -a -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
+if [ -n "$XBPS_USE_BUILD_MTIME" ]; then
+	unset SOURCE_DATE_EPOCH
+	return 0
+fi
+if [ -z "${SOURCE_DATE_EPOCH}" -a -n "$IN_CHROOT" ]; then
 	if command -v chroot-git &>/dev/null; then
 		GIT_CMD=$(command -v chroot-git)
 	elif command -v git &>/dev/null; then
diff --git a/common/hooks/post-install/07-cleanup-timestamp-macros.sh b/common/hooks/post-install/07-cleanup-timestamp-macros.sh
deleted file mode 100644
index 9e69dc61b0b..00000000000
--- a/common/hooks/post-install/07-cleanup-timestamp-macros.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-# Remove leaked CFLAGS and CXXFLAGS parts which were defined
-# by common/hooks/pre-configure/03-timestamp-macros.sh
-# from shell scripts, perl scripts, package config files etc.
-
-hook() {
-	local f mimetype
-	local strip=" -Wno-builtin-macro-redefined -include${XBPS_BUILDDIR}/\.xbps-.*/timestamp-macros\.h"
-
-	[ -n "$XBPS_USE_BUILD_MTIME" ] && return 0
-	[ -z "$SOURCE_DATE_EPOCH" ] && return 0
-
-	# Clean up shell scripts, perl files, pkgconfig files etc.
-	for f in $(grep -r -l -e "$strip" "$PKGDESTDIR" ); do
-		mimetype=$(file --mime-type "$f" | awk '{ print $2 }')
-		if [ "$mimetype" == "text/plain" -o \
-		     "$mimetype" == "text/x-makefile" -o \
-		     "$mimetype" == "text/x-shellscript" -o \
-		     "$mimetype" == "application/xml" ]; then
-			sed -i "$f" -e "s;$strip;;"
-			msg_warn "Cleaned up ${f#${PKGDESTDIR}} ...\n"
-		else
-			# Unhandled mime-type file contains the $strip string
-			# E.g. binaries containing the build environment as a string
-			msg_warn "Can't clean ${f#${PKGDESTDIR}} (mime-type: $mimetype) ...\n"
-		fi
-	done
-}
diff --git a/common/hooks/pre-configure/03-timestamp-macros.sh b/common/hooks/pre-configure/03-timestamp-macros.sh
deleted file mode 100644
index 9ef05680274..00000000000
--- a/common/hooks/pre-configure/03-timestamp-macros.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# This hook overwrites timestamp macros.
-#
-hook() {
-	local i mcr val macros="$XBPS_STATEDIR/timestamp-macros.h"
-
-	[ -n "$XBPS_USE_BUILD_MTIME" ] && return 0
-	[ -z "$SOURCE_DATE_EPOCH" ] && return 0
-	msg_normal "Creating $macros\n"
-	CFLAGS+=" -Wno-builtin-macro-redefined -include$macros"
-	CXXFLAGS+=" -Wno-builtin-macro-redefined -include$macros"
-	rm -f "$macros"
-	for i in "DATE,%b %d %Y" "TIME,%H:%M:%S" "DATETIME,%b %d %Y %H:%M:%S"; do
-		mcr=${i%%,*}
-		val=$(LC_ALL=C date --date "@$SOURCE_DATE_EPOCH" +"${i#*,}")
-		echo "#undef __${mcr}__" >> "$macros"
-		echo "#define __${mcr}__ \"${val}\"" >> "$macros"
-	done
-}
diff --git a/srcpkgs/cross-aarch64-linux-gnu/files/gcc-spec-env-r1.patch b/srcpkgs/cross-aarch64-linux-gnu/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-aarch64-linux-gnu/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-aarch64-linux-gnu/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-aarch64-linux-gnu/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-aarch64-linux-gnu/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-aarch64-linux-gnu/template b/srcpkgs/cross-aarch64-linux-gnu/template
index 5c6c204cc7c..4c7b44f28f3 100644
--- a/srcpkgs/cross-aarch64-linux-gnu/template
+++ b/srcpkgs/cross-aarch64-linux-gnu/template
@@ -11,7 +11,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=2
+revision=3
 short_desc="GNU Cross toolchain for the ${_triplet} LE target (binutils/gcc/glibc)"
 maintainer="Christian Neukirchen <chneukirchen@gmail.com>"
 homepage="http://www.voidlinux.eu"
@@ -36,10 +36,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 only_for_archs="x86_64"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np0 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -80,10 +80,11 @@ _binutils_build() {
 _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
-	cd ${wrksrc}
-	msg_normal "Building cross gcc bootstrap\n"
+	cd ${wrksrc}/gcc-${_gcc_version}
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
-	cd gcc-${_gcc_version}
+	msg_normal "Building cross gcc bootstrap\n"
 
 	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
 	cd ../gcc-bootstrap
diff --git a/srcpkgs/cross-aarch64-linux-musl/files/gcc-spec-env-r1.patch b/srcpkgs/cross-aarch64-linux-musl/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-aarch64-linux-musl/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-aarch64-linux-musl/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-aarch64-linux-musl/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-aarch64-linux-musl/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-aarch64-linux-musl/template b/srcpkgs/cross-aarch64-linux-musl/template
index ad624d39cac..56ecba5c275 100644
--- a/srcpkgs/cross-aarch64-linux-musl/template
+++ b/srcpkgs/cross-aarch64-linux-musl/template
@@ -11,7 +11,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=1
+revision=2
 short_desc="Cross toolchain for ARM64 LE target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -37,10 +37,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np1 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -69,7 +69,9 @@ _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
 	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-arm-linux-gnueabi/files/gcc-spec-env-r1.patch b/srcpkgs/cross-arm-linux-gnueabi/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-gnueabi/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-gnueabi/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-arm-linux-gnueabi/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-gnueabi/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-gnueabi/template b/srcpkgs/cross-arm-linux-gnueabi/template
index 82a38436169..736fc1b01ab 100644
--- a/srcpkgs/cross-arm-linux-gnueabi/template
+++ b/srcpkgs/cross-arm-linux-gnueabi/template
@@ -39,10 +39,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 only_for_archs="i686 x86_64"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np0 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -84,10 +84,11 @@ _binutils_build() {
 _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
-	cd ${wrksrc}
-	msg_normal "Building cross gcc bootstrap\n"
+	cd ${wrksrc}/gcc-${_gcc_version}
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
-	cd gcc-${_gcc_version}
+	msg_normal "Building cross gcc bootstrap\n"
 
 	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
 	cd ../gcc-bootstrap
diff --git a/srcpkgs/cross-arm-linux-gnueabihf/files/gcc-spec-env-r1.patch b/srcpkgs/cross-arm-linux-gnueabihf/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-gnueabihf/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-gnueabihf/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-arm-linux-gnueabihf/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-gnueabihf/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-gnueabihf/template b/srcpkgs/cross-arm-linux-gnueabihf/template
index caeda3250d2..f38b599cf9e 100644
--- a/srcpkgs/cross-arm-linux-gnueabihf/template
+++ b/srcpkgs/cross-arm-linux-gnueabihf/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=3
+revision=4
 short_desc="GNU Cross toolchain for the ${_triplet} LE target (binutils/gcc/glibc)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -39,10 +39,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 only_for_archs="i686 x86_64"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np0 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -84,10 +84,11 @@ _binutils_build() {
 _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
-	cd ${wrksrc}
-	msg_normal "Building cross gcc bootstrap\n"
+	cd ${wrksrc}/gcc-${_gcc_version}
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
-	cd gcc-${_gcc_version}
+	msg_normal "Building cross gcc bootstrap\n"
 
 	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
 	cd ../gcc-bootstrap
diff --git a/srcpkgs/cross-arm-linux-musleabi/files/gcc-spec-env-r1.patch b/srcpkgs/cross-arm-linux-musleabi/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-musleabi/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-musleabi/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-arm-linux-musleabi/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-musleabi/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-musleabi/template b/srcpkgs/cross-arm-linux-musleabi/template
index 275f4265fbb..5fcc39ba051 100644
--- a/srcpkgs/cross-arm-linux-musleabi/template
+++ b/srcpkgs/cross-arm-linux-musleabi/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=1
+revision=2
 short_desc="Cross toolchain for ARMv5 TE target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -41,7 +41,7 @@ _apply_patch() {
 	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i ${2}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -71,6 +71,8 @@ _gcc_bootstrap() {
 
 	cd ${wrksrc}/gcc-${_gcc_version}
 	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-arm-linux-musleabihf/files/gcc-spec-env-r1.patch b/srcpkgs/cross-arm-linux-musleabihf/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-musleabihf/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-musleabihf/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-arm-linux-musleabihf/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-arm-linux-musleabihf/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-arm-linux-musleabihf/template b/srcpkgs/cross-arm-linux-musleabihf/template
index 76367a9d824..8665bfbac8d 100644
--- a/srcpkgs/cross-arm-linux-musleabihf/template
+++ b/srcpkgs/cross-arm-linux-musleabihf/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=1
+revision=2
 short_desc="Cross toolchain for ARMv6 LE Hard Float target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -41,7 +41,7 @@ _apply_patch() {
 	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i ${2}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -71,6 +71,8 @@ _gcc_bootstrap() {
 
 	cd ${wrksrc}/gcc-${_gcc_version}
 	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-armv7l-linux-gnueabihf/files/gcc-spec-env-r1.patch b/srcpkgs/cross-armv7l-linux-gnueabihf/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-armv7l-linux-gnueabihf/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-armv7l-linux-gnueabihf/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-armv7l-linux-gnueabihf/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-armv7l-linux-gnueabihf/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-armv7l-linux-gnueabihf/template b/srcpkgs/cross-armv7l-linux-gnueabihf/template
index 976b6bcf042..98462d3c1ab 100644
--- a/srcpkgs/cross-armv7l-linux-gnueabihf/template
+++ b/srcpkgs/cross-armv7l-linux-gnueabihf/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=2
+revision=3
 short_desc="GNU Cross toolchain for the ${_triplet} LE target (binutils/gcc/glibc)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -39,10 +39,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 only_for_archs="i686 x86_64"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np0 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -84,10 +84,11 @@ _binutils_build() {
 _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
-	cd ${wrksrc}
-	msg_normal "Building cross gcc bootstrap\n"
+	cd ${wrksrc}/gcc-${_gcc_version}
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
-	cd gcc-${_gcc_version}
+	msg_normal "Building cross gcc bootstrap\n"
 
 	[ ! -d ../gcc-bootstrap ] && mkdir ../gcc-bootstrap
 	cd ../gcc-bootstrap
diff --git a/srcpkgs/cross-armv7l-linux-musleabihf/files/gcc-spec-env-r1.patch b/srcpkgs/cross-armv7l-linux-musleabihf/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-armv7l-linux-musleabihf/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-armv7l-linux-musleabihf/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-armv7l-linux-musleabihf/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-armv7l-linux-musleabihf/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-armv7l-linux-musleabihf/template b/srcpkgs/cross-armv7l-linux-musleabihf/template
index e54953bc730..68b81bf88f0 100644
--- a/srcpkgs/cross-armv7l-linux-musleabihf/template
+++ b/srcpkgs/cross-armv7l-linux-musleabihf/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=1
+revision=2
 short_desc="Cross toolchain for ARMv7 LE Hard Float target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -41,7 +41,7 @@ _apply_patch() {
 	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i ${2}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -71,6 +71,8 @@ _gcc_bootstrap() {
 
 	cd ${wrksrc}/gcc-${_gcc_version}
 	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-i686-linux-musl/files/gcc-spec-env-r1.patch b/srcpkgs/cross-i686-linux-musl/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-i686-linux-musl/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-i686-linux-musl/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-i686-linux-musl/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-i686-linux-musl/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-i686-linux-musl/template b/srcpkgs/cross-i686-linux-musl/template
index d67cc12c790..45d6adda8fa 100644
--- a/srcpkgs/cross-i686-linux-musl/template
+++ b/srcpkgs/cross-i686-linux-musl/template
@@ -11,7 +11,7 @@ _archflags="-march=i686"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=1
+revision=2
 short_desc="Cross toolchain for i686 target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -40,7 +40,7 @@ _apply_patch() {
 	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i ${2}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -71,6 +71,8 @@ _gcc_bootstrap() {
 
 	cd ${wrksrc}/gcc-${_gcc_version}
 	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-i686-pc-linux-gnu/files/gcc-spec-env-r1.patch b/srcpkgs/cross-i686-pc-linux-gnu/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-i686-pc-linux-gnu/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-i686-pc-linux-gnu/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-i686-pc-linux-gnu/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-i686-pc-linux-gnu/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-i686-pc-linux-gnu/template b/srcpkgs/cross-i686-pc-linux-gnu/template
index e3776b61dbc..a9743f6e8ef 100644
--- a/srcpkgs/cross-i686-pc-linux-gnu/template
+++ b/srcpkgs/cross-i686-pc-linux-gnu/template
@@ -11,7 +11,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=2
+revision=3
 short_desc="GNU Cross toolchain for the ${_triplet} target (binutils/gcc/glibc)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -37,10 +37,10 @@ depends="${pkgname}-libc-${version}_${revision}"
 nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np0 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -70,6 +70,8 @@ _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
 	cd ${wrksrc}/gcc-${_gcc_version}
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-mips-linux-musl/files/gcc-spec-env-r1.patch b/srcpkgs/cross-mips-linux-musl/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-mips-linux-musl/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-mips-linux-musl/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-mips-linux-musl/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-mips-linux-musl/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-mips-linux-musl/template b/srcpkgs/cross-mips-linux-musl/template
index 97b311944a1..e2b8c951ba1 100644
--- a/srcpkgs/cross-mips-linux-musl/template
+++ b/srcpkgs/cross-mips-linux-musl/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=2
+revision=3
 short_desc="Cross toolchain for MIPS32r2 BE softfloat target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -38,10 +38,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np1 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -70,7 +70,9 @@ _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
 	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-mipsel-linux-musl/files/gcc-spec-env-r1.patch b/srcpkgs/cross-mipsel-linux-musl/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-mipsel-linux-musl/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-mipsel-linux-musl/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-mipsel-linux-musl/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-mipsel-linux-musl/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-mipsel-linux-musl/template b/srcpkgs/cross-mipsel-linux-musl/template
index 270d6cb3703..6f9788ea388 100644
--- a/srcpkgs/cross-mipsel-linux-musl/template
+++ b/srcpkgs/cross-mipsel-linux-musl/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=2
+revision=3
 short_desc="Cross toolchain for MIPS32r2 LE softfloat target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -38,10 +38,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np1 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -70,7 +70,9 @@ _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
 	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-mipsel-linux-muslhf/files/gcc-spec-env-r1.patch b/srcpkgs/cross-mipsel-linux-muslhf/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-mipsel-linux-muslhf/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-mipsel-linux-muslhf/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-mipsel-linux-muslhf/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-mipsel-linux-muslhf/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-mipsel-linux-muslhf/template b/srcpkgs/cross-mipsel-linux-muslhf/template
index 39788fa11c6..58488cf4dbc 100644
--- a/srcpkgs/cross-mipsel-linux-muslhf/template
+++ b/srcpkgs/cross-mipsel-linux-muslhf/template
@@ -12,7 +12,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=2
+revision=3
 short_desc="Cross toolchain for MIPS32r2 LE hardfloat target (musl)"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -38,10 +38,10 @@ nostrip_files="libgcc.a libgcov.a libgcc_eh.a"
 depends="${pkgname}-libc-${version}_${revision}"
 
 _apply_patch() {
-	local pname="$(basename $1)"
+	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -Np1 -i ${1}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -70,7 +70,9 @@ _gcc_bootstrap() {
 	[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
 
 	cd ${wrksrc}/gcc-${_gcc_version}
-	_apply_patch ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/cross-x86_64-linux-musl/files/gcc-spec-env-r1.patch b/srcpkgs/cross-x86_64-linux-musl/files/gcc-spec-env-r1.patch
new file mode 120000
index 00000000000..8dd149359e2
--- /dev/null
+++ b/srcpkgs/cross-x86_64-linux-musl/files/gcc-spec-env-r1.patch
@@ -0,0 +1 @@
+../../gcc/patches/gcc-spec-env-r1.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-x86_64-linux-musl/files/libcpp-source_date_epoch.patch b/srcpkgs/cross-x86_64-linux-musl/files/libcpp-source_date_epoch.patch
new file mode 120000
index 00000000000..e1d4856827d
--- /dev/null
+++ b/srcpkgs/cross-x86_64-linux-musl/files/libcpp-source_date_epoch.patch
@@ -0,0 +1 @@
+../../gcc/patches/libcpp-source_date_epoch.patch
\ No newline at end of file
diff --git a/srcpkgs/cross-x86_64-linux-musl/template b/srcpkgs/cross-x86_64-linux-musl/template
index ca61a06aeb3..58ae19da34d 100644
--- a/srcpkgs/cross-x86_64-linux-musl/template
+++ b/srcpkgs/cross-x86_64-linux-musl/template
@@ -10,7 +10,7 @@ _sysroot="/usr/${_triplet}"
 
 pkgname=cross-${_triplet}
 version=0.21
-revision=1
+revision=2
 short_desc="Cross toolchain for x86_64 with musl"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://www.voidlinux.eu"
@@ -39,7 +39,7 @@ _apply_patch() {
 	local args="$1" pname="$(basename $2)"
 
 	if [ ! -f ".${pname}_done" ]; then
-		patch -N $args -i ${2}
+		patch -N $args -i $2
 		touch .${pname}_done
 	fi
 }
@@ -70,6 +70,8 @@ _gcc_bootstrap() {
 
 	cd ${wrksrc}/gcc-${_gcc_version}
 	_apply_patch -p1 ${FILESDIR}/gcc-4.9.2-musl.diff
+	_apply_patch -p0 ${FILESDIR}/libcpp-source_date_epoch.patch
+	_apply_patch -p0 ${FILESDIR}/gcc-spec-env-r1.patch
 
 	msg_normal "Building cross gcc bootstrap\n"
 
diff --git a/srcpkgs/gcc/patches/gcc-spec-env-r1.patch b/srcpkgs/gcc/patches/gcc-spec-env-r1.patch
new file mode 100644
index 00000000000..3eb0141dad6
--- /dev/null
+++ b/srcpkgs/gcc/patches/gcc-spec-env-r1.patch
@@ -0,0 +1,87 @@
+2013-08-22  Magnus Granberg <zorry@gentoo.org>
+
+	* gcc/gcc.c (main): Add support for external spec file via the GCC_SPECS env var
+	and move the process of the user specifed specs.
+
+    This allows us to easily control pie/ssp defaults with gcc-config profiles.
+    Original patch by Rob Holland
+    Extended to support multiple entries separated by ':' by Kevin F. Quinn
+    Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+    Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by Magnus Granberg
+
+--- gcc/gcc.c	2013-02-05 16:55:31.000000000 +0100
++++ gcc/gcc.c	2013-07-26 02:32:14.625089864 +0200
+@@ -6427,6 +6428,48 @@ main (int argc, char **argv)
+     do_option_spec (option_default_specs[i].name,
+ 		    option_default_specs[i].spec);
+ 
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++  /* Add specs listed in GCC_SPECS.  Note; in the process of separating
++   * each spec listed, the string is overwritten at token boundaries
++   * (':') with '\0', an effect of strtok_r().
++   */
++  specs_file = getenv ("GCC_SPECS");
++  if (specs_file && (strlen(specs_file) > 0))
++    {
++      char *spec, *saveptr;
++      for (spec=strtok_r(specs_file,":",&saveptr);
++           spec!=NULL;
++           spec=strtok_r(NULL,":",&saveptr))
++        {
++          struct user_specs *user = (struct user_specs *)
++            xmalloc (sizeof (struct user_specs));
++          user->next = (struct user_specs *) 0;
++          user->filename = spec;
++          if (user_specs_tail)
++            user_specs_tail->next = user;
++          else
++            user_specs_head = user;
++          user_specs_tail = user;
++        }
++    }
++#endif
++  /* Process any user specified specs in the order given on the command
++   *     line.  */
++  for (uptr = user_specs_head; uptr; uptr = uptr->next)
++    {
++      char *filename = find_a_file (&startfile_prefixes, uptr->filename,
++        R_OK, true);
++      read_specs (filename ? filename : uptr->filename, false, true);
++    }
++  /* Process any user self specs.  */
++  {
++    struct spec_list *sl;
++    for (sl = specs; sl; sl = sl->next)
++      if (sl->name_len == sizeof "self_spec" - 1
++          && !strcmp (sl->name, "self_spec"))
++        do_self_spec (*sl->ptr_spec);
++  }
++
+   /* Process DRIVER_SELF_SPECS, adding any new options to the end
+      of the command line.  */
+ 
+@@ -6535,24 +6578,6 @@ main (int argc, char **argv)
+ 			      PREFIX_PRIORITY_LAST, 0, 1);
+     }
+ 
+-  /* Process any user specified specs in the order given on the command
+-     line.  */
+-  for (uptr = user_specs_head; uptr; uptr = uptr->next)
+-    {
+-      char *filename = find_a_file (&startfile_prefixes, uptr->filename,
+-				    R_OK, true);
+-      read_specs (filename ? filename : uptr->filename, false, true);
+-    }
+-
+-  /* Process any user self specs.  */
+-  {
+-    struct spec_list *sl;
+-    for (sl = specs; sl; sl = sl->next)
+-      if (sl->name_len == sizeof "self_spec" - 1
+-	  && !strcmp (sl->name, "self_spec"))
+-	do_self_spec (*sl->ptr_spec);
+-  }
+-
+   if (compare_debug)
+     {
+       enum save_temps save;
diff --git a/srcpkgs/gcc/patches/libcpp-source_date_epoch.patch b/srcpkgs/gcc/patches/libcpp-source_date_epoch.patch
new file mode 100644
index 00000000000..7265900fc4a
--- /dev/null
+++ b/srcpkgs/gcc/patches/libcpp-source_date_epoch.patch
@@ -0,0 +1,60 @@
+Based on https://gcc.gnu.org/ml/gcc-patches/2015-06/txtLtaPOCTgpq.txt
+
+Support for deterministic builds with externally defined
+values for the macros __DATE__, __TIME__ and __DATETIME__.
+
+If the environment variable SOURCE_DATE_EPOCH is defined,
+use its value instead of the time(2) return value as
+seconds since the Epoch.
+
+Use strtoll() to convert SOURCE_DATE_EPOCH just in case
+time_t is some day promoted to a 64 bit value.
+
+--- libcpp/macro.c
++++ libcpp/macro.c
+@@ -349,14 +349,38 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
+ 	     slow on some systems.  */
+ 	  time_t tt;
+ 	  struct tm *tb = NULL;
++	  char *source_date_epoch;
+ 
+-	  /* (time_t) -1 is a legitimate value for "number of seconds
+-	     since the Epoch", so we have to do a little dance to
+-	     distinguish that from a genuine error.  */
+-	  errno = 0;
+-	  tt = time(NULL);
+-	  if (tt != (time_t)-1 || errno == 0)
+-	    tb = localtime (&tt);
++	  /* Allow the date and time to be set externally by an exported
++	     environment variable to enable reproducible builds. */
++	  source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
++	  if (source_date_epoch)
++	    {
++	      errno = 0;
++	      tt = (time_t) strtoll (source_date_epoch, NULL, 10);
++	      if (errno == 0)
++	        {
++		  tb = gmtime (&tt);
++		  if (tb == NULL)
++		    cpp_error (pfile, CPP_DL_ERROR,
++			       "SOURCE_DATE_EPOCH=\"%s\" is not a valid date",
++			       source_date_epoch);
++	        }
++	      else
++		cpp_error (pfile, CPP_DL_ERROR,
++			   "SOURCE_DATE_EPOCH=\"%s\" is not a valid number",
++			   source_date_epoch);
++	    }
++	  else
++	    {
++	    /* (time_t) -1 is a legitimate value for "number of seconds
++	       since the Epoch", so we have to do a little dance to
++	       distinguish that from a genuine error.  */
++	    errno = 0;
++	    tt = time(NULL);
++	    if (tt != (time_t)-1 || errno == 0)
++	      tb = localtime (&tt);
++	  }
+ 
+ 	  if (tb)
+ 	    {
diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template
index 6d95d225f31..624acda9732 100644
--- a/srcpkgs/gcc/template
+++ b/srcpkgs/gcc/template
@@ -2,7 +2,7 @@
 pkgname=gcc
 _majorver=4.9
 version=${_majorver}.3
-revision=3
+revision=4
 short_desc="The GNU C Compiler"
 maintainer="Juan RP <xtraeme@voidlinux.eu>"
 homepage="http://gcc.gnu.org"