Install bootstrapped FlexDLL objects to flexdll/

The install-flexdll target now puts the object files for FlexDLL in a
subdirectory flexdll of the Standard Library instead of in the Standard
Library itself.

A configuration tweak means that -I +flexdll is effectively added to all
compiler invocations and also a pseudo-option -L+flexdll to ocamlmklib
calls to Config.mkdll which fixes PR#7373.
master
David Allsopp 2017-01-27 16:08:41 +01:00
parent 614dd0b756
commit 65fd726329
7 changed files with 47 additions and 4 deletions

12
Changes
View File

@ -719,6 +719,18 @@ Next minor version (4.04.1):
- PR#7369: Str.regexp raises "Invalid_argument: index out of bounds"
(Damien Doligez, report by John Whitington)
- PR#7373, GPR#1023: Fix ocamlmklib with bootstrapped FlexDLL. Bootstrapped
FlexDLL objects are now installed to a subdirectory flexdll of the Standard
Library which allows the compilers to pick them up explicitly and also
ocamlmklib to include them without unnecessarily adding the entire Standard
Library.
(David Allsopp)
- PR#7385, GPR#1057: fix incorrect timestamps returned by Unix.stat on Windows
when either TZ is set or system date is in DST.
(David Allsopp, report and initial fix by Nicolás Ojeda Bär, review and
superior implementation suggestion by Xavier Leroy)
- PR#7405, GPR#903: s390x: Fix address of caml_raise_exn in native dynlink modules
(Richard Jones, review by Xavier Leroy)

View File

@ -273,6 +273,7 @@ INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
INSTALL_MANDIR=$(DESTDIR)$(MANDIR)
INSTALL_FLEXDLL=$(INSTALL_LIBDIR)/flexdll
RUNTOP=./byterun/ocamlrun ./ocaml \
-nostdlib -I stdlib \
@ -291,10 +292,14 @@ ifeq "$(UNIX_OR_WIN32)" "win32"
FLEXDLL_SUBMODULE_PRESENT := $(wildcard flexdll/Makefile)
ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" ""
BOOT_FLEXLINK_CMD=
FLEXDLL_DIR=
else
BOOT_FLEXLINK_CMD = FLEXLINK_CMD="../boot/ocamlrun ../flexdll/flexlink.exe"
CAMLOPT := OCAML_FLEXLINK="boot/ocamlrun flexdll/flexlink.exe" $(CAMLOPT)
FLEXDLL_DIR="+flexdll"
endif
else
FLEXDLL_DIR=
endif
# The configuration file
@ -317,6 +322,7 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%EXT_OBJ%%|$(EXT_OBJ)|' \
-e 's|%%FLAMBDA%%|$(FLAMBDA)|' \
-e 's|%%FLEXLINK_FLAGS%%|$(subst \,\\,$(FLEXLINK_FLAGS))|' \
-e 's|%%FLEXDLL_DIR%%|$(FLEXDLL_DIR)|' \
-e 's|%%HOST%%|$(HOST)|' \
-e 's|%%LIBDIR%%|$(LIBDIR)|' \
-e 's|%%LIBUNWIND_AVAILABLE%%|$(LIBUNWIND_AVAILABLE)|' \
@ -583,7 +589,8 @@ install-flexdll:
$(if $(filter-out mingw,$(TOOLCHAIN)),\
flexdll/default$(filter-out _i386,_$(ARCH)).manifest) \
"$(INSTALL_BINDIR)"
cp flexdll/flexdll_*.$(O) "$(INSTALL_LIBDIR)"
$(MKDIR) "$(INSTALL_FLEXDLL)"
cp flexdll/flexdll_*.$(O) "$(INSTALL_FLEXDLL)"
# Installation
.PHONY: install

View File

@ -29,7 +29,9 @@ let init_path ?(dir="") native =
else
!Clflags.include_dirs
in
let dirs = !last_include_dirs @ dirs @ !first_include_dirs in
let dirs =
!last_include_dirs @ dirs @ Config.flexdll_dirs @ !first_include_dirs
in
let exp_dirs =
List.map (Misc.expand_directory Config.standard_library) dirs in
Config.load_path := dir ::

View File

@ -149,7 +149,7 @@ installopt::
# To help building mixed-mode libraries (OCaml + C)
$(call byte_and_opt,ocamlmklib,ocamlmklibconfig.cmo config.cmo \
$(call byte_and_opt,ocamlmklib,ocamlmklibconfig.cmo config.cmo misc.cmo \
ocamlmklib.cmo,)

View File

@ -242,11 +242,27 @@ let transl_path s =
in Bytes.to_string (aux 0)
| _ -> s
let flexdll_dirs =
let dirs =
let expand = Misc.expand_directory Config.standard_library in
List.map expand Config.flexdll_dirs
in
let f dir =
let dir =
if String.contains dir ' ' then
"\"" ^ dir ^ "\""
else
dir
in
"-L" ^ dir
in
List.map f dirs
let build_libs () =
if !c_objs <> [] then begin
if !dynlink then begin
let retcode = command
(Printf.sprintf "%s %s -o %s %s %s %s %s %s"
(Printf.sprintf "%s %s -o %s %s %s %s %s %s %s"
Config.mkdll
(if !debug then "-g" else "")
(prepostfix "dll" !output_c Config.ext_dll)
@ -255,6 +271,7 @@ let build_libs () =
(String.concat " " !ld_opts)
(make_rpath mksharedlibrpath)
(String.concat " " !c_libs)
(String.concat " " flexdll_dirs)
)
in
if retcode <> 0 then if !failsafe then dynlink := false else exit 2

View File

@ -132,6 +132,9 @@ val default_executable_name: string
val systhread_supported : bool
(* Whether the system thread library is implemented *)
val flexdll_dirs : string list
(* Directories needed for the FlexDLL objects *)
val host : string
(* Whether the compiler is a cross-compiler *)

View File

@ -129,6 +129,8 @@ let default_executable_name =
let systhread_supported = %%SYSTHREAD_SUPPORT%%;;
let flexdll_dirs = [%%FLEXDLL_DIR%%];;
let print_config oc =
let p name valu = Printf.fprintf oc "%s: %s\n" name valu in
let p_int name valu = Printf.fprintf oc "%s: %d\n" name valu in