Source: re2c Version: 1.2.1-1 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0] we noticed that re2c could not be built reproducibly. This is because it used the current build date in the manual page. Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
--- a/.pc/03_reproducible_build.diff/configure.ac 1969-12-31 16:00:00.000000000 -0800 --- b/.pc/03_reproducible_build.diff/configure.ac 2019-08-13 08:34:19.814927292 -0700 @@ -0,0 +1,140 @@ +AC_INIT([re2c],[1.2.1],[re2c-gene...@lists.sourceforge.net]) +AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip]) +AM_SILENT_RULES([yes]) + + +AC_CONFIG_SRCDIR([src/main.cc]) +AC_CONFIG_HEADERS([config.h]) + + +AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`) +AC_SUBST(PACKAGE_VERSION) +AC_SUBST(PACKAGE_NAME) +AC_SUBST(PACKAGE_TARNAME) +AC_SUBST(PACKAGE_RELEASE, ${PACKAGE_RELEASE:-1}) + + +# without this, --std=c++98 disables POSIX functions on Cygwin +AC_USE_SYSTEM_EXTENSIONS + + +# --enable-debug +AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], + [enable checks and assertions])]) +AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"]) + + +# --enable-docs +AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs], [regenerate manpage])]) +AM_CONDITIONAL([REBUILD_DOCS], [test "x$enable_docs" = "xyes"]) +AM_COND_IF([REBUILD_DOCS], [ + AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], no) + AS_IF([test "x$RST2MAN" = "xno"], [ + AC_MSG_ERROR([need rst2man or rst2man.py for --enable-docs]) + ]) +]) + + +# --enable-libs +AC_ARG_ENABLE([libs], [AS_HELP_STRING([--enable-libs], [build libraries])]) +AM_CONDITIONAL([WITH_LIBS], [test "x$enable_libs" = "xyes"]) +AM_COND_IF([WITH_LIBS], [ + AC_SUBST(LDFLAGS_RE2, []) + AC_LANG_PUSH([C++]) + AC_CHECK_HEADERS([re2/re2.h], [AS_VAR_SET([LDFLAGS_RE2], ["-lre2"])], [], [[]]) + AC_LANG_POP([C++]) +]) + + +# checks for programs +AC_PATH_PROG(BISON, bison, no) +AC_PROG_CC # used in skeleton tests +AC_PROG_CXX +AC_PROG_INSTALL + + +# checks for C++ compiler flags +AC_SUBST(CXXFLAGSDEFAULT, []) +# TRY_CXXFLAG (flag [implied-flags]) +# Iff C++ compiler recognizes 'flag', append 'flag' and 'implied-flags' to CXXFLAGSDEFAULT +# (Second param 'implied-flags' is needed for warning suppressions '-Wno-<warning>': +# GCC warns about unrecognized suppressions options only in presence of other warnings, +# which makes it hard to test for them with autoconf.) +AC_DEFUN([TRY_CXXFLAG], [ + AC_MSG_CHECKING([C++ compiler flag $1]) + AS_VAR_SET([CXXFLAGS_BACKUP], ["$CXXFLAGS"]) + AS_VAR_SET([CXXFLAGS], ["$CXXFLAGS $1"]) + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM()], + [ + AS_VAR_SET([TRY_CXXFLAG_RESULT], [yes]) + AS_VAR_SET([CXXFLAGSDEFAULT], ["$CXXFLAGSDEFAULT $1 $2"]) + ], + [AS_VAR_SET([TRY_CXXFLAG_RESULT], [no])] + ) + AC_LANG_POP([C++]) + AS_VAR_SET([CXXFLAGS], ["$CXXFLAGS_BACKUP"]) + AC_MSG_RESULT([$TRY_CXXFLAG_RESULT]) +]) +TRY_CXXFLAG([-std=c++98]) +TRY_CXXFLAG([-W]) +TRY_CXXFLAG([-Wall]) +TRY_CXXFLAG([-Wextra]) +TRY_CXXFLAG([-Weffc++]) +TRY_CXXFLAG([-pedantic]) +TRY_CXXFLAG([-Wformat=2]) +TRY_CXXFLAG([-Wredundant-decls]) +TRY_CXXFLAG([-Wsuggest-attribute=format]) +TRY_CXXFLAG([-Wconversion]) +TRY_CXXFLAG([-Wsign-conversion]) +TRY_CXXFLAG([-Werror=return-type]) +TRY_CXXFLAG([-O2]) +TRY_CXXFLAG([-Weverything], m4_join([ ], + [-Wno-unknown-warning-option], dnl CLANG eats some GCC options only to warn they are unknown + [-Wno-reserved-id-macro], dnl to allow header guards of the form '_RE2C_PATH_TO_HEADER_BASENAME_' + [-Wno-padded], + [-Wno-old-style-cast], dnl RE2C-generated lexer has lots of C-syle casts because of 're2c:yych:conversion = 1;' + [-Wno-nested-anon-types], + [-Wno-global-constructors] dnl initialization of global constants with std::numeric_limits<...> (mostly for size_t) + [-Wno-shadow-field-in-constructor] dnl using same names in ctor seems more like a feature + [-Wno-undefined-func-template])) dnl explicit specialization to reduce build dependencies + + +# needed by src/c99_stdint.h +# avoid AC_INCLUDES_DEFAULT +AC_CHECK_HEADERS([stdint.h], [], [], [[]]) +# needed for POSIX file API +AC_CHECK_HEADERS([sys/types.h], [], [], [[]]) +AC_CHECK_HEADERS([sys/stat.h], [], [], [[]]) +AC_CHECK_HEADERS([fcntl.h], [], [], [[]]) +AC_CHECK_HEADERS([unistd.h], [], [], [[]]) +AC_CHECK_HEADERS([io.h], [], [], [[]]) # windows POSIX-like API +# list of possible types to use in typedefs +AC_CHECK_SIZEOF([char], [], [[]]) +AC_CHECK_SIZEOF([short], [], [[]]) +AC_CHECK_SIZEOF([int], [], [[]]) +AC_CHECK_SIZEOF([long], [], [[]]) +AC_CHECK_SIZEOF([long long], [], [[]]) +AC_CHECK_SIZEOF([__int64], [], [[]]) +# size of pointers +AC_CHECK_SIZEOF([void *], [], [[]]) +# 64-bit integer constant suffix +AC_CHECK_SIZEOF([0l], [], [[]]) +AC_CHECK_SIZEOF([0ll], [], [[]]) +AC_CHECK_SIZEOF([0i8], [], [[]]) + + +AC_CONFIG_FILES([\ + Makefile \ + doc/manpage.rst \ + doc/help.rst \ +]) +AC_CONFIG_FILES([run_tests.sh], [chmod +x run_tests.sh]) + + +LT_INIT([dlopen win32-dll]) +AC_CONFIG_MACRO_DIRS([m4]) + + +AC_OUTPUT --- a/.pc/applied-patches 2019-08-13 08:14:58.244624533 -0700 --- b/.pc/applied-patches 2019-08-13 08:34:19.810927050 -0700 @@ -1 +1,2 @@ 02_fix_manpage_typos.diff +03_reproducible_build.diff --- a/configure.ac 2019-08-13 08:14:58.124622486 -0700 --- b/configure.ac 2019-08-13 08:37:45.469332719 -0700 @@ -6,8 +6,12 @@ AC_CONFIG_SRCDIR([src/main.cc]) AC_CONFIG_HEADERS([config.h]) - -AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`) +if test -n "$SOURCE_DATE_EPOCH"; then + PACKAGE_DATE=`LC_ALL=C date --utc --date="@$SOURCE_DATE_EPOCH" +'%b %d %Y'` +else + PACKAGE_DATE=`date +'%d %b %Y'` +fi +AC_SUBST(PACKAGE_DATE, $PACKAGE_DATE) AC_SUBST(PACKAGE_VERSION) AC_SUBST(PACKAGE_NAME) AC_SUBST(PACKAGE_TARNAME) --- a/debian/patches/03_reproducible_build.diff 1969-12-31 16:00:00.000000000 -0800 --- b/debian/patches/03_reproducible_build.diff 2019-08-13 08:37:52.237612506 -0700 @@ -0,0 +1,21 @@ +Description: Make the build reproducible +Author: Chris Lamb <la...@debian.org> +Last-Update: 2019-08-13 + +--- re2c-1.2.1.orig/configure.ac ++++ re2c-1.2.1/configure.ac +@@ -6,8 +6,12 @@ AM_SILENT_RULES([yes]) + AC_CONFIG_SRCDIR([src/main.cc]) + AC_CONFIG_HEADERS([config.h]) + +- +-AC_SUBST(PACKAGE_DATE, `date +'%d %b %Y'`) ++if test -n "$SOURCE_DATE_EPOCH"; then ++ PACKAGE_DATE=`LC_ALL=C date --utc --date="@$SOURCE_DATE_EPOCH" +'%b %d %Y'` ++else ++ PACKAGE_DATE=`date +'%d %b %Y'` ++fi ++AC_SUBST(PACKAGE_DATE, $PACKAGE_DATE) + AC_SUBST(PACKAGE_VERSION) + AC_SUBST(PACKAGE_NAME) + AC_SUBST(PACKAGE_TARNAME) --- a/debian/patches/series 2019-08-13 08:14:58.128622554 -0700 --- b/debian/patches/series 2019-08-13 08:33:26.624987469 -0700 @@ -1 +1,2 @@ 02_fix_manpage_typos.diff +03_reproducible_build.diff