aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorletouzey2009-03-30 19:33:48 +0000
committerletouzey2009-03-30 19:33:48 +0000
commit99c8916342ce6b13661aa1076b4e8444c6e97cb6 (patch)
tree6878df5bce33231322e192d13ed6ebad0afa4111
parent5bfa026830cffd52d2246170380756c23017ba85 (diff)
Fix the fix script for ocamlopt -shared in MacOS 10.5 (remarks by Hugo)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12041 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--Makefile.build2
-rwxr-xr-xdev/ocamlopt_shared_os5fix.sh14
-rw-r--r--myocamlbuild.ml9
3 files changed, 16 insertions, 9 deletions
diff --git a/Makefile.build b/Makefile.build
index 36fdbfdb0f..d8531e88f6 100644
--- a/Makefile.build
+++ b/Makefile.build
@@ -837,7 +837,7 @@ endif
%.cmxs: %.cmxa
$(SHOW)'OCAMLOPT -shared -o $@'
ifeq ($(HASNATDYNLINK),os5fixme)
- $(HIDE)dev/ocamlopt_shared_os5fix.sh $(OCAMLOPT) $@ $<
+ $(HIDE)dev/ocamlopt_shared_os5fix.sh '$(OCAMLOPT)' $@
else
$(HIDE)$(OCAMLOPT) -linkall -shared -o $@ $<
endif
diff --git a/dev/ocamlopt_shared_os5fix.sh b/dev/ocamlopt_shared_os5fix.sh
index db4cb159c4..6782d2fa07 100755
--- a/dev/ocamlopt_shared_os5fix.sh
+++ b/dev/ocamlopt_shared_os5fix.sh
@@ -4,9 +4,15 @@
OCAMLOPT=$1
CMXS=$2
-CMXA=$3
-$OCAMLOPT -dstartup -linkall -shared -o $CMXS $CMXA
+DIR=`dirname $CMXS`
+BASE=`basename $CMXS .cmxs`
+CMXA=$DIR/$BASE.cmxa
+ARC=$DIR/$BASE.a
+# we assume that all object files are at the same place than the rest
+OBJS=`ar t $ARC | sed -e "s|^|$DIR/|"`
+
+"$OCAMLOPT" -dstartup -linkall -shared -o $CMXS $CMXA
# Fix1: add a dummy instruction before the caml generic functions
# Fix2: make all caml generic functions private
rm -f $CMXS $CMXS.startup.fixed.s
@@ -18,6 +24,6 @@ cat $CMXS.startup.s | sed \
> $CMXS.startup.fixed.s
# Recompile fixed startup code
as -o $CMXS.startup.o $CMXS.startup.fixed.s
-# Build fixed .cmxs (assume plugins are on directory base and include all files)
-ld -bundle -flat_namespace -undefined warning -read_only_relocs suppress -o $CMXS `dirname $CMXS`/*.o
+# Build fixed .cmxs (assume all object files are at the same place)
+ld -bundle -flat_namespace -undefined warning -read_only_relocs suppress -o $CMXS $OBJS
rm $CMXS.startup.o $CMXS.startup.s $CMXS.startup.fixed.s \ No newline at end of file
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index b38c175bbf..a16a5e0928 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -386,10 +386,11 @@ let extra_rules () = begin
rule ".cmxa.cmxs" ~prod:"%.cmxs" ~dep:"%.cmxa"
(fun env _ ->
- let prog = if os5fix then
- [A"../dev/ocamlopt_shared_os5fix.sh"; !Options.ocamlopt]
- else [!Options.ocamlopt;A"-linkall";A"-shared";A"-o"]
- in Cmd (S (prog@[P (env "%.cmxs"); P (env "%.cmxa")])));
+ let cmxs = P (env "%.cmxs") and cmxa = P (env "%.cmxa") in
+ if os5fix then
+ Cmd (S [A"../dev/ocamlopt_shared_os5fix.sh"; !Options.ocamlopt; cmxs])
+ else
+ Cmd (S [!Options.ocamlopt;A"-linkall";A"-shared";A"-o";cmxs;cmxa]));
(** Generation of NMake.v from NMake_gen.ml *)