[build] record last modified date of --help data inside ./configure

Summary: This will be needed to generate man pages with an accurate date.

Reviewed By: jberdine, mbouaziz

Differential Revision: D4937498

fbshipit-source-id: b5ebd31
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent f232e3bd8d
commit 15b8f80e18

1
.gitignore vendored

@ -50,6 +50,7 @@ duplicates.txt
/aclocal.m4
/autom4te.cache
/config.status
/m4/__GENERATED__*.m4
/configure
/Makefile.autoconf
/.buckversion

@ -86,6 +86,7 @@ endif
.PHONY: all
all: infer
ifeq ($(IS_INFER_RELEASE),no)
configure: configure.ac $(wildcard m4/*.m4)
# rerun ./autogen.sh in case of failure as the failure may be due to needing to rerun
# ./configure
@ -99,6 +100,7 @@ Makefile.autoconf: configure Makefile.autoconf.in
./configure $(shell ./config.status --config || true),\
./configure $(shell ./config.status --config || true))) || \
./configure $(shell ./config.status --config || true)
endif
.PHONY: fb-setup
fb-setup:

@ -26,6 +26,7 @@ ENABLE_OCAMLOPT_CUSTOM_CC = @ENABLE_OCAMLOPT_CUSTOM_CC@
ENABLE_OCAML_BINANNOT = @ENABLE_OCAML_BINANNOT@
exec_prefix = @exec_prefix@
INFER_MAJOR = @INFER_MAJOR@
INFER_MAN_LAST_MODIFIED = @INFER_MAN_LAST_MODIFIED@
INFER_MINOR = @INFER_MINOR@
INFER_PATCH = @INFER_PATCH@
INSTALL = @INSTALL@

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
@ -9,6 +9,11 @@
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# make sure we run from the root of the repo
pushd "$SCRIPT_DIR" > /dev/null
# try to pull submodules if we are in a git repo
# might fail if git is not installed (how did you even checkout the
# repo in the first place?)
@ -20,6 +25,35 @@ else
echo 'no git repository detected; not updating git submodules'
fi
# We need to record the date that the documentation was last modified to put in our man
# pages. Unfortunately that information is only available reliably from `git`, which we don't have
# access to from other distributions of the infer source code, for instance our source
# releases. However, we do distribute the "configure" script in that case, so the idea is to bake
# this date inside "configure" so that it's available at build time. We do that by generating an m4
# macro that hardcodes the date we compute in this script for "configure" to find.
MAN_LAST_MODIFIED_M4=m4/__GENERATED__ac_check_infer_man_last_modified.m4
printf 'generating %s' "$MAN_LAST_MODIFIED_M4... "
if test -d '.git' ; then
# date at which the man pages were last modified, to record in the manpages themselves
MAN_FILES=(
infer/src/base/CommandLineOption.ml
infer/src/base/Config.ml
)
MAN_DATE=$(git log -n 1 --pretty=format:%cd --date=short -- "${MAN_FILES[@]}")
INFER_MAN_LAST_MODIFIED=${INFER_MAN_LAST_MODIFIED:-$MAN_DATE}
else
echo 'no git repository detected; setting last modified date to today'
# best effort: get today's date
INFER_MAN_LAST_MODIFIED=${INFER_MAN_LAST_MODIFIED:-$(date +%Y-%m-%d)}
fi
printf "AC_DEFUN([AC_CHECK_INFER_MAN_LAST_MODIFIED],\n" > "$MAN_LAST_MODIFIED_M4"
printf "[INFER_MAN_LAST_MODIFIED=%s\n" "$INFER_MAN_LAST_MODIFIED" >> "$MAN_LAST_MODIFIED_M4"
printf " AC_SUBST([INFER_MAN_LAST_MODIFIED])\n" >> "$MAN_LAST_MODIFIED_M4"
printf "])\n" >> "$MAN_LAST_MODIFIED_M4"
printf 'done\n'
# older versions of `autoreconf` only support including macros via acinclude.m4
ACINCLUDE="acinclude.m4"
printf "generating $ACINCLUDE..."
cat m4/*.m4 > "$ACINCLUDE"

@ -314,6 +314,8 @@ if test "$BREW" != "no"; then
fi
fi
AC_CHECK_INFER_MAN_LAST_MODIFIED()
AC_CONFIG_FILES([
Makefile.autoconf
])

@ -394,6 +394,7 @@ base/Version.ml: base/Version.ml.in $(MAKEFILE_LIST)
-e "s|@BUILD_C_ANALYZERS[@]|$(BUILD_C_ANALYZERS)|g" \
-e "s|@BUILD_JAVA_ANALYZERS[@]|$(BUILD_JAVA_ANALYZERS)|g" \
-e "s|@XCODE_SELECT[@]|$(XCODE_SELECT)|g" \
-e "s|@INFER_MAN_LAST_MODIFIED[@]|$(INFER_MAN_LAST_MODIFIED)|g" \
$< > "$$TMPFILE"; \
cat "$$TMPFILE" > $@; \
$(REMOVE) "$$TMPFILE"

@ -37,3 +37,5 @@ let versionJson = String.concat ~sep:"\n" [
let clang_enabled = is_yes "@BUILD_C_ANALYZERS@"
let java_enabled = is_yes "@BUILD_JAVA_ANALYZERS@"
let xcode_enabled = is_not_no "@XCODE_SELECT@"
let man_pages_last_modify_date = "@INFER_MAN_LAST_MODIFIED@"

@ -16,3 +16,5 @@ val versionJson : string
val clang_enabled : bool
val java_enabled : bool
val xcode_enabled : bool
val man_pages_last_modify_date : string

Loading…
Cancel
Save