]> jfr.im git - irc/atheme/atheme.git/commitdiff
Add an option to strip build date for reproducible builds
authorMax Teufel <redacted>
Sat, 30 Apr 2016 06:30:59 +0000 (08:30 +0200)
committerMax Teufel <redacted>
Sat, 30 Apr 2016 06:30:59 +0000 (08:30 +0200)
Fixes #473

configure
configure.ac
include/sysconf.h.in
libathemecore/ptasks.c
modules/operserv/uptime.c

index 7955be90904b891937e3bb69ba209488f1d44b78..0f4928ad5a03cc50e8c17c6f881aef60272e65c5 100755 (executable)
--- a/configure
+++ b/configure
@@ -774,6 +774,7 @@ with_cracklib
 with_ldap
 with_perl
 enable_fhs_paths
+enable_reproducible_builds
 enable_large_net
 enable_contrib
 enable_ssl
@@ -1415,6 +1416,8 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-nls           do not use Native Language Support
   --enable-fhs-paths      Use more FHS-like pathnames (for packagers).
+  --enable-reproducible-builds
+                          Enable reproducible builds.
   --enable-large-net      Enable large network support.
   --enable-contrib        Enable contrib modules.
   --disable-ssl           don't use OpenSSL to provide more SASL mechanisms
@@ -8049,6 +8052,29 @@ $as_echo "$FHSPATHS" >&6; }
 LOCALEDIR='${datadir}/locale'
 
 
+REPRODUCIBLEBUILDS="no"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if you want reproducible builds" >&5
+$as_echo_n "checking if you want reproducible builds... " >&6; }
+# Check whether --enable-reproducible-builds was given.
+if test "${enable_reproducible_builds+set}" = set; then :
+  enableval=$enable_reproducible_builds;
+  case "$enableval" in
+  yes)
+    REPRODUCIBLEBUILDS="yes"
+
+$as_echo "#define REPRODUCIBLE_BUILDS 1" >>confdefs.h
+
+    ;;
+  no)
+    REPRODUCIBLEBUILDS="no"
+    ;;
+  esac
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $REPRODUCIBLEBUILDS" >&5
+$as_echo "$REPRODUCIBLEBUILDS" >&6; }
+
 LARGENET="no"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if you want large network support" >&5
 $as_echo_n "checking if you want large network support... " >&6; }
@@ -11491,6 +11517,7 @@ Configuration:
        Logfile directory    : ${LOGDIR}
        Data directory       : ${DATADIR}
        PID directory        : ${RUNDIR}
+       Reproducible builds  : ${REPRODUCIBLEBUILDS}
        Large network support: ${LARGENET}
        OpenSSL SASL support : ${SSL}
        Contrib modules      : ${CONTRIB}
index caa13490877620d71f599d4763a2a14d00c57759..f8e3ad8cabc086cc02fdca75399b88cc20a9c928 100644 (file)
@@ -211,6 +211,23 @@ dnl gettext
 LOCALEDIR='${datadir}/locale'
 AC_SUBST(LOCALEDIR)
 
+REPRODUCIBLEBUILDS="no"
+AC_MSG_CHECKING(if you want reproducible builds)
+AC_ARG_ENABLE(reproducible-builds,
+AC_HELP_STRING([--enable-reproducible-builds],[ Enable reproducible builds.]),
+[
+  case "$enableval" in
+  yes)
+    REPRODUCIBLEBUILDS="yes"
+    AC_DEFINE([REPRODUCIBLE_BUILDS], 1, [Uncomment to enable reproducible builds.])
+    ;;
+  no)
+    REPRODUCIBLEBUILDS="no"
+    ;;
+  esac
+])
+AC_MSG_RESULT($REPRODUCIBLEBUILDS)
+
 LARGENET="no"
 AC_MSG_CHECKING(if you want large network support)
 AC_ARG_ENABLE(large-net,
@@ -439,6 +456,7 @@ Configuration:
        Logfile directory    : ${LOGDIR}
        Data directory       : ${DATADIR}
        PID directory        : ${RUNDIR}
+       Reproducible builds  : ${REPRODUCIBLEBUILDS}
        Large network support: ${LARGENET}
        OpenSSL SASL support : ${SSL}
        Contrib modules      : ${CONTRIB}
index 849b2496a82e72cc8eda51fe0000d2e828006d12..09f4a5c3afd587bd4e7fcfc7e21be3a3383ced0c 100644 (file)
 /* Define to 1 if you have the `__va_copy' function or macro. */
 #undef HAVE___VA_COPY
 
+/* Uncomment to enable reproducible builds. */
+#undef REPRODUCIBLE_BUILDS
+
 /* Uncomment to enable large network support. */
 #undef LARGE_NETWORK
 
index 95e7beebd454d51e4b19f0b9824b88e12338249e..72f90a4ac4284b8daa9b46b5325884212c50fd39 100644 (file)
@@ -44,8 +44,13 @@ void handle_info(user_t *u)
 int get_version_string(char *buf, size_t bufsize)
 {
        const crypt_impl_t *ci = crypt_get_default_provider();
+#ifdef REPRODUCIBLE_BUILDS
+       return snprintf(buf, bufsize, "%s. %s %s :%s [%s] [enc:%s]",
+               PACKAGE_STRING, me.name, revision, get_conf_opts(), ircd->ircdname, ci->id);
+#else
        return snprintf(buf, bufsize, "%s. %s %s :%s [%s] [enc:%s] Build Date: %s",
                PACKAGE_STRING, me.name, revision, get_conf_opts(), ircd->ircdname, ci->id, __DATE__);
+#endif
 }
 
 void handle_version(user_t *u)
index caa16d8abd5dd609c7795b1a4b8f3dd1f8aa237c..9d5ed7ade61f041fef508cee6aa7d969fa450747 100644 (file)
@@ -33,7 +33,11 @@ static void os_cmd_uptime(sourceinfo_t *si, int parc, char *parv[])
 {
        logcommand(si, CMDLOG_GET, "UPTIME");
 
+#ifdef REPRODUCIBLE_BUILDS
+       command_success_nodata(si, "%s [%s]", PACKAGE_STRING, revision);
+#else
         command_success_nodata(si, "%s [%s] Build Date: %s", PACKAGE_STRING, revision, __DATE__);
+#endif
         command_success_nodata(si, _("Services have been up for %s"), timediff(CURRTIME - me.start));
        command_success_nodata(si, _("Current PID: %d"), getpid());
         command_success_nodata(si, _("Registered accounts: %d"), cnt.myuser);