build: skip $(IFLEXDIR) in mk_shell_and_ocamlbuild_config.sh.

(Patch by Adrien Nader!)

On Windows, IFLEXDIR is defined as -I"$(FLEXDIR)". The new
mk_shell_and_ocamlbuild_config script outputs:
  echo IFLEXDIR="\"$(IFLEXDIR)\""

However, becauses $(IFLEXDIR) contains quotation marks, this becomes:
  echo IFLEXDIR="\"-I"$(FLEXDIR)"\""

This unquotes $(FLEXDIR) and breaks the program.

Simply exclude IFLEXDIR from the variables that are handled by the
script. This is actually what the previous scripts were doing: the
exclude list was .*FLEXDIR and matched both IFLEXDIR and FLEXDIR while
the one I made only had \<FLEXDIR\> in it.

I've tried to handle it but there are at least three competing languages
and quoting rules: makefile (both gnu make and several bsd makes), shell
script and ocaml.
There's no human way to do string processing given the portability
constraints: both gnu make and pmake (and its descendants) have powerful
string processing functions but they're not the same.
The only sane way would be to store the configuration in a more evolved
language that is portable, has arrays and powerful string handling
routines in standard like C or awk. From there it would be possible to
output make, shell script and OCaml code easily.

One day. Maybe.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14171 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Wojciech Meyer 2013-09-21 10:24:34 +00:00
parent b414d57b0e
commit 49a8d15728
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh -eu
#!/bin/sh -eux
# Generate config.sh and myocamlbuild_config.ml from config/Makefile.
#
@ -23,7 +23,7 @@ main() {
local list_variables='/[^#].*=/ s/\([^ \t:=]\{1,\}\).*=.*$/\1/ p'
# Variables we don't want to retrieve.
local exclude='^#|\<CAML(C|OPT)_BIN\>|\<(MKLIB|SYSLIB|FLEXDIR|^SET_LD_PATH)\>'
local exclude='^#|\<CAML(C|OPT)_BIN\>|\<(MKLIB|SYSLIB|FLEXDIR|IFLEXDIR|^SET_LD_PATH)\>'
# Some variables in the config have a value that is shell script and has to be
# evaluated to make sense for the outputs.