...
 
Commits (21)
......@@ -7,7 +7,7 @@
#set -x
version="1.7.3"
version="1.8.0"
# Remember the old IFS value:
oldifs="$IFS"
......@@ -191,7 +191,7 @@ for tool in sed awk ocaml ocamlc uname rm make cat m4 dirname basename; do
fi
done
lib_suffix=`ocamlc -config 2>/dev/null|grep '^ext_lib'|sed 's/ext_lib: //'`
lib_suffix=`ocamlc -config 2>/dev/null|tr -d '\015'|sed -n -e 's/^ext_lib: //p'`
# Check for Cygwin:
......@@ -225,7 +225,7 @@ use_cygpath=0
# Whether we have to translate Unix paths to/from Windows paths.
if [ -z "$system" ]; then
system=`ocamlc -config 2>/dev/null|grep '^system'|sed 's/system: //'`
system=`ocamlc -config 2>/dev/null|tr -d '\015'|sed -n -e 's/^system: //p'`
# This may be
# - mingw or mingw64
# - win32
......@@ -328,7 +328,11 @@ if [ -z "${ocamlfind_config}" ]; then
d="$ocaml_core_bin"
case "$d" in
*/bin)
ocamlfind_config=`dirname "$d"`/etc/findlib.conf
if [ -f `dirname "$d"`/lib/findlib.conf ]; then
ocamlfind_config=`dirname "$d"`/lib/findlib.conf
else
ocamlfind_config=`dirname "$d"`/etc/findlib.conf
fi
;;
*)
ocamlfind_config=/usr/local/etc/findlib.conf
......@@ -514,7 +518,10 @@ fi
# dbm?
if [ -f "${ocaml_core_stdlib}/dbm.cmi" ]; then
if [ -f "${ocaml_sitelib}/dbm/META" ]; then
echo "dbm: package already present"
ldbm=""
elif [ -f "${ocaml_core_stdlib}/dbm.cmi" ]; then
echo "dbm: found"
ldbm="dbm"
else
......@@ -524,8 +531,12 @@ fi
# num?
if [ -f "${ocaml_core_stdlib}/num.cmi" ]; then
echo "num: found"
if [ -f "${ocaml_sitelib}/num/META" ]; then
echo "num: package already present"
lnum=""
numtop=""
elif [ -f "${ocaml_core_stdlib}/num.cmi" ]; then
echo "num: found but not as package"
lnum="num num-top"
numtop="num-top"
else
......@@ -536,7 +547,8 @@ fi
# bytes?
if [ -f "${ocaml_core_stdlib}/bytes.cmi" ]; then
if [ -f "${ocaml_core_stdlib}/bytes.cmi" -o \
-f "${ocaml_core_stdlib}/stdlib__bytes.cmi" ]; then
echo "bytes: found, installing fake library"
lbytes="bytes"
cbytes=0
......@@ -556,10 +568,20 @@ else
lspacetime=""
fi
# graphics?
if [ -f "${ocaml_core_stdlib}/graphics.cmi" ]; then
echo "graphics: found"
lgraphics="graphics"
else
echo "graphics: not found"
lgraphics=""
fi
# Generate the META files now.
l="$ldbm dynlink graphics $lnum str threads unix stdlib bigarray ocamldoc $llabltk $lcamlp4 $lobuild $lcomplibs $lbytes $lspacetime"
l="$ldbm dynlink $lgraphics $lnum str threads unix stdlib bigarray ocamldoc $llabltk $lcamlp4 $lobuild $lcomplibs $lbytes $lspacetime"
for dir in site-lib-src/*; do
# We do not really know if $dir is a directory.
......
......@@ -109,6 +109,22 @@ configuration files, and library routines in detail.</p>
<title>List of Changes</title>
<ul>
<li>
<p><em>1.8.0:</em> Fix reinstallation of "num" for OCaml-4.06.
</p>
<p>Fix build with OCaml-4.07.</p>
<p>The installation of graphics/META is now optional.</p>
<p>Fix "ocamlfind query -d".</p>
<p>The environment variable OCAMLFIND_IGNORE_DUPS_IN is now interpreted
as a list of directories.</p>
<p>Packages for "ocamlfind query" may now be separated by commas, too.</p>
<p>New "warning" property for packages.</p>
<p>Forgetting to pass -thread/-vmthread only prints a warning now,
but doesn't stop the build.</p>
<p>For dealing with case-sensitive filesystems it is now only tried to
match ASCII characters, but not encoding-dependent characters.</p>
</li>
<li>
<p><em>1.7.3:</em> Fix regarding num-top: this library is now also
optional, as num.</p>
......
......@@ -2447,6 +2447,18 @@ error(pkg_q) = "Package p is incompatible with package q"
This also works with subpackages (e.g. <literal>pkg_q.q_sub</literal>).
</para>
</listitem>
<listitem>
<para>If an error is too much, it might be a good idea to
just inform the user about possible problems. In this case
you can emit a warning instead:
</para>
<programlisting>
warning(pkg_q) = "Using package p and q together is a really bad idea"
</programlisting>
</itemizedlist>
<para>Note that such error conditions should only be added if there is
......
......@@ -265,6 +265,14 @@ an error message is printed. The message is the value of the variable.
</para>
</listitem>
<listitem>
<para>
The variable "warning" can be used to signal warnings. When
this variable is applicable, the warning is printed, but the
compilation continues. The message is the value of the variable.
</para>
</listitem>
<listitem>
<para>
The variable "exists_if" can be used to disable subpackages. The
......
......@@ -4,7 +4,7 @@ author: "Gerd Stolpmann <gerd@gerd-stolpmann.de>"
homepage: "http://projects.camlcity.org/projects/findlib.html"
bug-reports: "https://gitlab.camlcity.org/gerd/lib-findlib/issues"
dev-repo: "https://gitlab.camlcity.org/gerd/lib-findlib.git"
version: "1.7.1.git"
version: "1.8.0.git"
build: [
["./configure" "-bindir" bin "-sitelib" lib "-mandir" man "-config" "%{lib}%/findlib.conf" "-no-custom" "-no-topfind" {preinstalled}]
......
......@@ -9,8 +9,8 @@ dnl This file is input of the m4 macro processor.
`browse_interfaces = "'interfaces`"'
`error(-mt) = "Missing -thread or -vmthread switch"'
`error(-mt_vm,-mt_posix) = "Missing -thread or -vmthread switch"'
`warning(-mt) = "Linking problems may arise because of the missing -thread or -vmthread switch"'
`warning(-mt_vm,-mt_posix) = "Linking problems may arise because of the missing -thread or -vmthread switch"'
`package "vm" ('
` # --- Bytecode-only threads:'
......
......@@ -14,7 +14,7 @@ NAME = findlib
# Need compiler-libs since ocaml-4.00
OCAMLC = ocamlc -I +compiler-libs
OCAMLOPT = ocamlopt -I +compiler-libs
OCAMLOPT = ocamlopt -I +compiler-libs -g
OCAMLDEP = ocamldep
OCAMLLEX = ocamllex
#CAMLP4O = camlp4 pa_o.cmo pa_op.cmo pr_o.cmo --
......@@ -102,9 +102,6 @@ topfind.ml: topfind.ml.in
> topfind.ml ; \
fi
topfind.cmo: topfind.cmi
topfind.cmx: topfind.cmi
topfind: topfind_rd$(OCAML_REMOVE_DIRECTORY).p
USE_CYGPATH="$(USE_CYGPATH)"; \
export USE_CYGPATH; \
......@@ -147,7 +144,7 @@ uninstall:
rm -f $(prefix)$(OCAMLFIND_BIN)/ocamlfind$(EXEC_SUFFIX)
depend: *.ml *.mli fl_meta.ml fl_metascanner.ml
depend: *.ml *.mli fl_meta.ml fl_metascanner.ml findlib_config.ml topfind.ml
$(OCAMLDEP) *.ml *.mli >depend
# Some 'make' implementations require that .SUFFIXES must occur before
......
......@@ -26,7 +26,7 @@ let conf_search_path = ref [];;
let conf_command = ref [];;
let conf_stdlib = ref "";;
let conf_ldconf = ref "";;
let conf_ignore_dups_in = ref (None : string option);;
let conf_ignore_dups_in = ref ([] : string list);;
let ocamlc_default = "ocamlc";;
let ocamlopt_default = "ocamlopt";;
......@@ -50,6 +50,7 @@ let init_manually
?(ocamlbrowser_command = ocamlbrowser_default)
?(ocamldoc_command = ocamldoc_default)
?ignore_dups_in
?(ignore_dups_in_list = [])
?(stdlib = Findlib_config.ocaml_stdlib)
?(ldconf = Findlib_config.ocaml_ldconf)
?(config = Findlib_config.config_file)
......@@ -72,7 +73,11 @@ let init_manually
conf_meta_directory := meta_dir;
conf_stdlib := stdlib;
conf_ldconf := ldconf;
conf_ignore_dups_in := ignore_dups_in;
conf_ignore_dups_in :=
( match ignore_dups_in with
| None -> []
| Some d -> [d]
) @ ignore_dups_in_list;
Fl_package_base.init !conf_search_path stdlib !conf_ignore_dups_in;
init_called := true
;;
......@@ -110,7 +115,7 @@ let auto_config_file() =
let init
?env_ocamlpath ?env_ocamlfind_destdir ?env_ocamlfind_metadir
?env_ocamlfind_commands ?env_ocamlfind_ignore_dups_in
?env_camllib ?env_ldconf
?env_ocamlfind_ignore_dups_in_list ?env_camllib ?env_ldconf
?config ?toolchain () =
let config_file =
......@@ -260,12 +265,14 @@ let init
| None ->
try Sys.getenv "OCAMLFIND_LDCONF" with Not_found -> ""
in
let ignore_dups_in =
match env_ocamlfind_ignore_dups_in with
| Some x -> Some x
| None ->
try Some(Sys.getenv "OCAMLFIND_IGNORE_DUPS_IN")
with Not_found -> None in
let ignore_dups_in_list =
match env_ocamlfind_ignore_dups_in, env_ocamlfind_ignore_dups_in_list with
| Some x0, Some l -> x0 :: l
| None, Some l -> l
| Some x0, None -> [x0]
| None, None ->
try Fl_split.path (Sys.getenv "OCAMLFIND_IGNORE_DUPS_IN")
with Not_found -> [] in
let ocamlc, ocamlopt, ocamlcp, ocamloptp, ocamlmklib, ocamlmktop,
ocamldep, ocamlbrowser, ocamldoc,
......@@ -296,7 +303,7 @@ let init
~ocamldep_command: ocamldep
~ocamlbrowser_command: ocamlbrowser
~ocamldoc_command: ocamldoc
?ignore_dups_in
~ignore_dups_in_list
~stdlib: stdlib
~ldconf: ldconf
~config: config_file
......
......@@ -36,6 +36,7 @@ val init :
?env_ocamlfind_metadir: string ->
?env_ocamlfind_commands: string ->
?env_ocamlfind_ignore_dups_in: string ->
?env_ocamlfind_ignore_dups_in_list: string list ->
?env_camllib: string ->
?env_ldconf: string ->
?config: string ->
......@@ -47,7 +48,8 @@ val init :
* function reads the file specified at compile time, but you can also
* pass a different file name in the [config] argument.
* Furthermore, the environment variables OCAMLPATH, OCAMLFIND_DESTDIR,
* OCAMLFIND_COMMANDS, and CAMLLIB are interpreted. By default, the function takes
* OCAMLFIND_COMMANDS, OCAMLFIND_IGNORE_DUPS_IN, and CAMLLIB are interpreted.
* By default, the function takes
* the values found in the environment, but you can pass different values
* using the [env_*] arguments. By setting these values to empty strings
* they are no longer considered.
......@@ -76,6 +78,14 @@ val init :
* the environment variable OCAMLFIND_LDCONF, or if unset or empty, the
* value of the configuration variable [ldconf], or if unset the
* built-in location.
* - The ocamlfind tool doesn't emit warnings about double cmi files
* for the directories listed in OCAMLFIND_IGNORE_DUPS_IN. Since
* findlib-1.8 this variable is interpreted as colon-separated path.
* (Before, only one directory could be given.) If the variable is not
* set there are no exceptions, and the warnings are always printed.
* Note that both the parameters [env_ocamlfind_ignore_dups_in] (a
* single directory) and [env_ocamlfind_ignore_dups_in_list] (a list
* of directories) override the default.
*)
......@@ -90,6 +100,7 @@ val init_manually :
?ocamlbrowser_command: string -> (* default: "ocamlbrowser" *)
?ocamldoc_command: string -> (* default: "ocamldoc" *)
?ignore_dups_in:string -> (* default: None *)
?ignore_dups_in_list:string list -> (* default: [] *)
?stdlib: string -> (* default: taken from Findlib_config *)
?ldconf: string ->
?config: string ->
......@@ -141,9 +152,12 @@ val package_directory : string -> string
val package_meta_file : string -> string
(** Get the absolute path of the META file of the given package *)
val ignore_dups_in : unit -> string option
val ignore_dups_in : unit -> string list
(** If [Some d], duplicate packages below [d] are ignored, and do not
* produce warnings. (Only affects the generation of warnings.)
*
* Since findlib-1.8 this configuration is a list. Before, it was a
* [string option].
*)
val package_property : string list -> string -> string -> string
......
......@@ -51,7 +51,7 @@ let has_prefix s pref =
let ocamlpath = ref [];;
let ocamlstdlib = ref "";;
let conf_ignore_dups_in = ref (None : string option)
let conf_ignore_dups_in = ref ([] : string list)
let store = Fl_metastore.create();;
(* We collect here only nodes, but no relations. First copy [store]
......@@ -451,11 +451,12 @@ let in_report_search_path identify_dir d =
(* Whether package dir d is to be considered for generating reports.
d is sorted out when the ignore_dups_in option is set
*)
match !conf_ignore_dups_in with
| None -> true
| Some id ->
try identify_dir d <> identify_dir id
with _ -> Fl_split.norm_dir d <> Fl_split.norm_dir id
List.for_all
(fun id ->
try identify_dir d <> identify_dir id
with _ -> Fl_split.norm_dir d <> Fl_split.norm_dir id
)
!conf_ignore_dups_in
;;
......
......@@ -25,10 +25,11 @@ type package =
and package_priv
val init : string list -> string -> string option -> unit
val init : string list -> string -> string list -> unit
(** This function must be called before [Fl_package_base] can be used.
* The first string corresponds to the [OCAMLPATH] setting, the second
* string is the location of the standard library.
* string is the location of the standard library. The second is the
* list of directories with ignored duplicate cmi files.
*
* This function is called by {!Findlib.init} and {!Findlib.init_manually},
* so it is already sufficient to initialize the [Findlib] module.
......
......@@ -830,7 +830,7 @@ let query_package () =
"-qo", Arg.Set qo,
" do not print regular output";
]
(fun p -> packages := !packages @ [p])
(fun p -> packages := !packages @ Fl_split.in_words p)
"usage: ocamlfind query [ -predicates <p> | -format <f> |
-long-format | -i-format |
-l-format | -a-format |
......@@ -839,6 +839,7 @@ let query_package () =
-separator <s> |
-descendants | -recursive ] package ...";
ignore(config_file()); (* ensure findlib is initialized *)
try
let predicates1 =
if !pp then
......@@ -1152,6 +1153,18 @@ let ocamlc which () =
(* Add the pkg_<name> predicates: *)
predicates := List.map (fun pkg -> "pkg_" ^ pkg) eff_packages @ !predicates;
(* Check on [warning] directives: *)
List.iter
(fun pkg ->
try
let warning = package_property !predicates pkg "warning" in
prerr_endline("ocamlfind: [WARNING] Package `" ^ pkg ^
"': " ^ warning)
with
Not_found -> ()
)
eff_packages;
(* Check on [error] directives: *)
List.iter
(fun pkg ->
......@@ -1997,6 +2010,17 @@ let meta_pkg meta_name =
close_in f;
failwith ("Cannot parse '" ^ meta_name ^ "': " ^ s)
let char_lowercase_ascii c =
(* Char.lowercase_ascii and String.lowercase_ascii first available in
OCaml-4.03, but we want to support earlier versions too
*)
if (c >= 'A' && c <= 'Z')
then Char.unsafe_chr(Char.code c + 32)
else c
let string_lowercase_ascii =
String.map char_lowercase_ascii
let install_package () =
let destdir = ref (default_location()) in
......@@ -2180,17 +2204,15 @@ let install_package () =
(* FIXME: We have to be careful with case-insensitive filesystems.
Currently, we only check for Win32, but also OS X may have ci
filesystems. So some better check would be nice.
Furthermore, String.lowercase assumes that the encoding of file names is
ISO-8859-1. This is probably plainly wrong.
*)
let lines = read_ldconf !ldconf in
let dlldir_norm = Fl_split.norm_dir dlldir in
let dlldir_norm_lc = String.lowercase dlldir_norm in
let dlldir_norm_lc = string_lowercase_ascii dlldir_norm in
let ci_filesys = (Sys.os_type = "Win32") in
let check_dir d =
let d' = Fl_split.norm_dir d in
(d' = dlldir_norm) ||
(ci_filesys && String.lowercase d' = dlldir_norm_lc) in
(ci_filesys && string_lowercase_ascii d' = dlldir_norm_lc) in
if not (List.exists check_dir lines) then
prerr_endline("ocamlfind: [WARNING] You have installed DLLs but the directory " ^ dlldir_norm ^ " is not mentioned in ld.conf");
end;
......