-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR #13523: [envars] honor file "coq_environment.txt"
Reviewed-by: MSoegtropIMC Reviewed-by: Zimmi48 Ack-by: ejgallego Ack-by: herbelin Ack-by: ppedrot
- Loading branch information
Showing
6 changed files
with
122 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
export COQBIN=$BIN | ||
export PATH=$COQBIN:$PATH | ||
|
||
TMP=`mktemp -d` | ||
cd $TMP | ||
|
||
cat > coq_environment.txt <<EOT | ||
# we override COQLIB because we can | ||
COQLIB="$TMP/overridden" # bla bla | ||
OCAMLFIND="$TMP/overridden" | ||
FOOBAR="one more" | ||
EOT | ||
|
||
cp $BIN/coqc . | ||
cp $BIN/coq_makefile . | ||
mkdir -p overridden/tools/ | ||
cp $COQLIB/tools/CoqMakefile.in overridden/tools/ | ||
|
||
unset COQLIB | ||
N=`./coqc -config | grep COQLIB | grep /overridden | wc -l` | ||
if [ $N -ne 1 ]; then | ||
echo COQLIB not overridden by coq_environment | ||
coqc -config | ||
exit 1 | ||
fi | ||
N=`./coqc -config | grep OCAMLFIND | grep /overridden | wc -l` | ||
if [ $N -ne 1 ]; then | ||
echo OCAMLFIND not overridden by coq_environment | ||
coqc -config | ||
exit 1 | ||
fi | ||
./coq_makefile -o CoqMakefile -R . foo > /dev/null | ||
N=`grep COQMF_OCAMLFIND CoqMakefile.conf | grep /overridden | wc -l` | ||
if [ $N -ne 1 ]; then | ||
echo COQMF_OCAMLFIND not overridden by coq_environment | ||
cat CoqMakefile.conf | ||
exit 1 | ||
fi | ||
|
||
export COQLIB="/overridden2" | ||
N=`./coqc -config | grep COQLIB | grep /overridden2 | wc -l` | ||
if [ $N -ne 1 ]; then | ||
echo COQLIB not overridden by COQLIB when coq_environment present | ||
coqc -config | ||
exit 1 | ||
fi | ||
|
||
rm -rf $TMP | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
open Arg | ||
|
||
let quoted = ref false | ||
let trailing_slash = ref false | ||
|
||
let arguments = [ | ||
"-quoted",Set quoted, "Quote path"; | ||
"-trailing-slash",Set trailing_slash, "End the path with a /"; | ||
] | ||
let subject = ref None | ||
let set_subject x = | ||
if !subject <> None then | ||
failwith "only one path"; | ||
subject := Some x | ||
|
||
let _ = | ||
let quoted = Sys.argv.(1) = "-quoted" in | ||
let ch_dir = Sys.argv.(if quoted then 2 else 1) in | ||
Sys.chdir ch_dir; | ||
Arg.parse arguments set_subject "Usage:"; | ||
let subject = | ||
match !subject with | ||
| None -> failwith "no path given"; | ||
| Some x -> x in | ||
Sys.chdir subject; | ||
let dir = Sys.getcwd () in | ||
let dir = if quoted then Filename.quote dir else dir in | ||
let dir = if !trailing_slash then dir ^ "/" else dir in | ||
let dir = if !quoted then Filename.quote dir else dir in | ||
Format.printf "%s%!" dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters