Skip to content

Commit 6f281d7

Browse files
Merge pull request #7267 from douzzer/20240221-reproducible-build-tweaks
20240221-reproducible-build-tweaks
2 parents 162d4dc + 9e4887b commit 6f281d7

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

configure.ac

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,35 @@ then
451451
RANLIB=ranlib
452452
fi
453453
xxx_ranlib_flags=$(${RANLIB} --help 2>&1)
454-
AM_CFLAGS="$AM_CFLAGS -DHAVE_REPRODUCIBLE_BUILD"
454+
455455
AS_CASE([$xxx_ar_flags],[*'use zero for timestamps and uids/gids'*],[AR_FLAGS="Dcr" lt_ar_flags="Dcr"])
456456
AS_CASE([$xxx_ranlib_flags],[*'Use zero for symbol map timestamp'*],[RANLIB="${RANLIB} -D"])
457+
458+
AM_CFLAGS="$AM_CFLAGS -DHAVE_REPRODUCIBLE_BUILD -g0"
459+
460+
# opportunistically use -ffile-prefix-map (added in GCC8 and LLVM10)
461+
462+
if "$CC" -ffile-prefix-map=/tmp=. -x c - -o /dev/null >/dev/null 2>&1 <<' EOF'
463+
#include <stdlib.h>
464+
int main(int argc, char **argv) {
465+
(void)argc; (void)argv; return 0;
466+
}
467+
EOF
468+
then
469+
AM_CFLAGS="$AM_CFLAGS -ffile-prefix-map=\$(abs_top_srcdir)/= -ffile-prefix-map=\$(top_srcdir)/="
470+
fi
471+
472+
# opportunistically use linker option --build-id=none
473+
474+
if "$CC" -Wl,--build-id=none -x c - -o /dev/null >/dev/null 2>&1 <<' EOF'
475+
#include <stdlib.h>
476+
int main(int argc, char **argv) {
477+
(void)argc; (void)argv; return 0;
478+
}
479+
EOF
480+
then
481+
AM_LDFLAGS="$AM_LDFLAGS -Wl,--build-id=none"
482+
fi
457483
fi
458484

459485

0 commit comments

Comments
 (0)