From 7cfc4e5146be5666419451bdd516f1f3f264d24a Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Sun, 25 Jan 2015 14:42:51 +0100 Subject: Imported Upstream version 8.5~beta1+dfsg --- tools/update-require | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100755 tools/update-require (limited to 'tools/update-require') diff --git a/tools/update-require b/tools/update-require new file mode 100755 index 00000000..cc9a27b8 --- /dev/null +++ b/tools/update-require @@ -0,0 +1,103 @@ +#!/bin/sh + +# This script fully qualifies all the 'Require' statements of the given +# targets (or the current directory if none). +# +# It assumes that all the prerequisites are already installed. The +# install location is found using the COQLIB, COQC, COQBIN variables if +# set, 'coqc' otherwise. +# +# Option --exclude can be used to ignore a given user contribution. In +# particular, it can be used to ignore the current set of files if it +# happens to be already installed. +# +# Option --stdlib can be used to also qualify the files from the standard +# library. + +if test ! "$COQLIB"; then + if test ${COQBIN##*/}; then COQBIN=$COQBIN/; fi + if test ! "$COQC"; then COQC=`which ${COQBIN}coqc`; fi + COQLIB=`"$COQC" -where` +fi + +stdlib=no +exclude="" + +scan_dir () { + (cd $1 ; find $3 -name '*.vo' | + sed -e "s,^./,$2,;s,\([^./]*\)/,\1.,g;s,\([^.]*\).vo,\1,") +} + +scan_all_dir () { + if test $stdlib = yes; then + scan_dir "$COQLIB/theories" "Coq." + scan_dir "$COQLIB/plugins" "Coq." + fi + scan_dir "$COQLIB/user-contrib" "" "$exclude" +} + +create_script () { + echo "BEGIN {" + scan_all_dir | + while read file ; do + echo $file | sed -e "s,\(.*\)[.]\([^.]*\), t[\"\2\"] = \"\1.\2\"," + done + cat <&2 + exit 1;; + *) + dir="$dir $1";; + esac + shift +done + +script=`tempfile` +create_script > $script +find $dir -name '*.v' | +while read file; do + mv $file $file.bak + awk -f $script $file.bak > $file +done -- cgit v1.2.3