summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile5
-rw-r--r--tools/dumpobj.ml15
-rw-r--r--tools/make-opcodes.Mac14
-rwxr-xr-xtools/make-package-macosx110
-rw-r--r--tools/ocamlmklib.mlp20
-rw-r--r--tools/ocamlprof.ml22
6 files changed, 139 insertions, 47 deletions
diff --git a/tools/Makefile b/tools/Makefile
index f9d3343514..8024944146 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -23,7 +23,7 @@ INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \
COMPFLAGS= -warn-error A $(INCLUDES)
LINKFLAGS=$(INCLUDES)
-all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib scrapelabels addlabels
+all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib scrapelabels addlabels
opt.opt: ocamldep.opt
@@ -97,6 +97,7 @@ clean::
rm -f ocamlmklib
ocamlmklib.ml: ocamlmklib.mlp ../config/Makefile
+ echo '(* THIS FILE IS GENERATED FROM ocamlmklib.mlp *)' >ocamlmklib.ml
sed -e "s|%%BINDIR%%|$(BINDIR)|" \
-e "s|%%SUPPORTS_SHARED_LIBRARIES%%|$(SUPPORTS_SHARED_LIBRARIES)|" \
-e "s|%%MKSHAREDLIB%%|$(MKSHAREDLIB)|" \
@@ -104,7 +105,7 @@ ocamlmklib.ml: ocamlmklib.mlp ../config/Makefile
-e "s|%%NATIVECCRPATH%%|$(NATIVECCRPATH)|" \
-e "s|%%MKSHAREDLIBRPATH%%|$(MKSHAREDLIBRPATH)|" \
-e "s|%%RANLIB%%|$(RANLIB)|" \
- ocamlmklib.mlp > ocamlmklib.ml
+ ocamlmklib.mlp >> ocamlmklib.ml
beforedepend:: ocamlmklib.ml
diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml
index 4605b765ad..a362c91a10 100644
--- a/tools/dumpobj.ml
+++ b/tools/dumpobj.ml
@@ -234,6 +234,7 @@ type shape =
| Uint_Primitive
| Switch
| Closurerec
+ | Pubmet
;;
let op_shapes = [
@@ -368,6 +369,8 @@ let op_shapes = [
opOFFSETREF, Sint;
opISINT, Nothing;
opGETMETHOD, Nothing;
+ opGETDYNMET, Nothing;
+ opGETPUBMET, Pubmet;
opBEQ, Sint_Disp;
opBNEQ, Sint_Disp;
opBLTINT, Sint_Disp;
@@ -436,6 +439,10 @@ let print_instr ic =
print_string ", ";
print_int (orig + inputu ic);
done;
+ | Pubmet
+ -> let tag = inputs ic in
+ let cache = inputu ic in
+ print_int tag
| Nothing -> ()
with Not_found -> print_string "(unknown arguments)"
end;
@@ -522,13 +529,17 @@ let dump_exe ic =
let main() =
for i = 1 to Array.length Sys.argv - 1 do
- let ic = open_in_bin Sys.argv.(i) in
+ let filnam = Sys.argv.(i) in
+ let ic = open_in_bin filnam in
+ if i>1 then print_newline ();
+ printf "## start of ocaml dump of %S\n%!" filnam;
begin try
objfile := false; dump_exe ic
with Bytesections.Bad_magic_number ->
objfile := true; seek_in ic 0; dump_obj (Sys.argv.(i)) ic
end;
- close_in ic
+ close_in ic;
+ printf "## end of ocaml dump of %S\n%!" filnam;
done;
exit 0
diff --git a/tools/make-opcodes.Mac b/tools/make-opcodes.Mac
deleted file mode 100644
index 0d13822973..0000000000
--- a/tools/make-opcodes.Mac
+++ /dev/null
@@ -1,14 +0,0 @@
-set echo 0
-exit 1 if {#} != 2
-
-catenate "{1}" >"{2}"
-open -t "{2}"
-replace ¥:/¥ / 'let op' "{2}"
-set i 0
-loop
- replace /,[ ¶n]+/ " = {i}¶nlet op" "{2}" || break
- evaluate i += 1
-end
-replace /¥[Â ]/:° " = {i}¶n" "{2}"
-
-close -y "{2}"
diff --git a/tools/make-package-macosx b/tools/make-package-macosx
index 8f574d9c0c..557084cad8 100755
--- a/tools/make-package-macosx
+++ b/tools/make-package-macosx
@@ -15,21 +15,101 @@
# $Id$
cd package-macosx
-rm -rf ocaml.pkg ocaml-rw.dmg ocaml.dmg
-
-cat >ocaml.info <<EOF
- Title Objective Caml
- Version 3.06
- Description This package installs Objective Caml version 3.06
- DefaultLocation /
- Relocatable no
- NeedsAuthorization yes
- Application no
- InstallOnly no
- DisableStop no
+rm -rf ocaml.pkg ocaml-rw.dmg
+
+VERSION=`sed -n -e '/ocaml_version/s/.*"\([^"]*\)".*/\1/p' ../stdlib/sys.ml`
+VERSION_MAJOR=`sed -n -e '/ocaml_version/s/.*"\([0-9]*\)\..*/\1/p' \
+ ../stdlib/sys.ml`
+VERSION_MINOR=`sed -n -e '/ocaml_version/s/.*"[0-9]*\.\([0-9]*\)[.+].*/\1/p' \
+ ../stdlib/sys.ml`
+
+# Worked in 10.2:
+
+# cat >ocaml.info <<EOF
+# Title Objective Caml
+# Version ${VERSION}
+# Description This package installs Objective Caml version ${VERSION}
+# DefaultLocation /
+# Relocatable no
+# NeedsAuthorization yes
+# Application no
+# InstallOnly no
+# DisableStop no
+# EOF
+#package root ocaml.info
+
+cat >Description.plist <<EOF
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>IFPkgDescriptionDeleteWarning</key>
+ <string></string>
+ <key>IFPkgDescriptionDescription</key>
+ <string>The Objective Caml compiler and tools</string>
+ <key>IFPkgDescriptionTitle</key>
+ <string>Objective Caml</string>
+ <key>IFPkgDescriptionVersion</key>
+ <string>${VERSION}</string>
+ </dict>
+ </plist>
+EOF
+
+cat >Info.plist <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleGetInfoString</key>
+ <string>Objective Caml ${VERSION}</string>
+ <key>CFBundleIdentifier</key>
+ <string>fr.inria.ocaml</string>
+ <key>CFBundleName</key>
+ <string>Objective Caml</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${VERSION}</string>
+ <key>IFMajorVersion</key>
+ <integer>${VERSION_MAJOR}</integer>
+ <key>IFMinorVersion</key>
+ <integer>${VERSION_MINOR}</integer>
+ <key>IFPkgFlagAllowBackRev</key>
+ <true/>
+ <key>IFPkgFlagAuthorizationAction</key>
+ <string>AdminAuthorization</string>
+ <key>IFPkgFlagDefaultLocation</key>
+ <string>/</string>
+ <key>IFPkgFlagInstallFat</key>
+ <false/>
+ <key>IFPkgFlagIsRequired</key>
+ <false/>
+ <key>IFPkgFlagRelocatable</key>
+ <false/>
+ <key>IFPkgFlagRestartAction</key>
+ <string>NoRestart</string>
+ <key>IFPkgFlagRootVolumeOnly</key>
+ <true/>
+ <key>IFPkgFlagUpdateInstalledLanguages</key>
+ <false/>
+ <key>IFPkgFormatVersion</key>
+ <real>0.10000000149011612</real>
+</dict>
+</plist>
+EOF
+
+mkdir -p resources
+
+# stop here -> |
+cat >resources/ReadMe.txt <<EOF
+This package installs Objective Caml version ${VERSION}.
+You need Mac OS X 10.3 (panther), with X11 and the
+XCode tools installed.
EOF
-package root ocaml.info
+/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \
+ -build -p "`pwd`/ocaml.pkg" -f "`pwd`/root" -i "`pwd`/Info.plist" \
+ -d "`pwd`/Description.plist" -r "`pwd`/resources"
size=`du -s ocaml.pkg | cut -f 1`
size=`expr $size + 8192`
@@ -42,6 +122,7 @@ hdiutil detach $name
name=`hdid ocaml-rw.dmg | grep Apple_HFS | cut -d ' ' -f 1`
if test -d '/Volumes/Objective Caml'; then
ditto -rsrcFork ocaml.pkg "/Volumes/Objective Caml/ocaml.pkg"
+ cp resources/ReadMe.txt "/Volumes/Objective Caml/"
else
echo 'Unable to mount the disk image as "/Volumes/Objective Caml"' >&2
exit 3
@@ -49,4 +130,5 @@ fi
open "/Volumes/Objective Caml"
hdiutil detach $name
-hdiutil convert ocaml-rw.dmg -format UDZO -o ocaml.dmg
+rm -rf "ocaml-${VERSION}.dmg"
+hdiutil convert ocaml-rw.dmg -format UDZO -o "ocaml${VERSION}.dmg"
diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.mlp
index 27eecccbc3..a97ba47a52 100644
--- a/tools/ocamlmklib.mlp
+++ b/tools/ocamlmklib.mlp
@@ -184,13 +184,19 @@ let make_rpath_ccopt flag =
let prefix_list pref l =
List.map (fun s -> pref ^ s) l
+let prepostfix pre name post =
+ let base = Filename.basename name in
+ let dir = Filename.dirname name in
+ Filename.concat dir (pre ^ base ^ post)
+;;
+
let build_libs () =
if !c_objs <> [] then begin
if !dynlink then begin
let retcode = command
- (sprintf "%s dll%s.so %s %s %s %s %s"
+ (sprintf "%s %s %s %s %s %s %s"
mksharedlib
- !output_c
+ (prepostfix "dll" !output_c ".so")
(String.concat " " !c_objs)
(String.concat " " !c_opts)
(String.concat " " !ld_opts)
@@ -198,15 +204,15 @@ let build_libs () =
(String.concat " " !c_libs)) in
if retcode <> 0 then if !failsafe then dynlink := false else exit 2
end;
- safe_remove ("lib" ^ !output_c ^ ".a");
+ safe_remove (prepostfix "lib" !output_c ".a");
scommand
- (sprintf "ar rc lib%s.a %s"
- !output_c
+ (sprintf "ar rc %s %s"
+ (prepostfix "lib" !output_c ".a")
(String.concat " " !c_objs));
scommand
- (sprintf "%s lib%s.a"
+ (sprintf "%s %s"
ranlib
- !output_c)
+ (prepostfix "lib" !output_c ".a"))
end;
if !bytecode_objs <> [] then
scommand
diff --git a/tools/ocamlprof.ml b/tools/ocamlprof.ml
index abc61ce39f..10c3c57459 100644
--- a/tools/ocamlprof.ml
+++ b/tools/ocamlprof.ml
@@ -21,8 +21,9 @@ open Location
open Misc
open Parsetree
-(* User programs must not use identifiers that start with this prefix. *)
-let idprefix = "__ocaml_prof";;
+(* User programs must not use identifiers that start with these prefixes. *)
+let idprefix = "__ocaml_prof_";;
+let modprefix = "OCAML__prof_";;
(* Errors specific to the profiler *)
@@ -87,8 +88,10 @@ let add_incr_counter modul (kind,pos) =
| Close -> fprintf !outchan ")";
| Open ->
fprintf !outchan
- "(%s_cnt_%s_.(%d) <- Pervasives.succ %s_cnt_%s_.(%d); "
- idprefix modul !prof_counter idprefix modul !prof_counter;
+ "(%sArray.set %s_cnt %d \
+ (%sPervasives.succ (%sArray.get %s_cnt %d)); "
+ modprefix idprefix !prof_counter
+ modprefix modprefix idprefix !prof_counter;
incr prof_counter;
;;
@@ -127,12 +130,14 @@ let pos_len = ref 0
let init_rewrite modes mod_name =
cur_point := 0;
if !instr_mode then begin
- fprintf !outchan "let %s_cnt_%s_ = Array.create 0000000" idprefix mod_name;
+ fprintf !outchan "module %sArray = Array;; " modprefix;
+ fprintf !outchan "module %sPervasives = Pervasives;; " modprefix;
+ fprintf !outchan "let %s_cnt = Array.create 0000000" idprefix;
pos_len := pos_out !outchan;
fprintf !outchan
" 0;; Profiling.counters := \
- (\"%s\", (\"%s\", %s_cnt_%s_)) :: !Profiling.counters;; "
- mod_name modes idprefix mod_name
+ (\"%s\", (\"%s\", %s_cnt)) :: !Profiling.counters;; "
+ mod_name modes idprefix;
end
let final_rewrite add_function =
@@ -178,7 +183,7 @@ and rw_exp iflag sexp =
rewrite_exp iflag sbody
| Pexp_function (_, _, caselist) ->
- if !instr_fun && not sexp.pexp_loc.loc_ghost then
+ if !instr_fun then
rewrite_function iflag caselist
else
rewrite_patlexp_list iflag caselist
@@ -414,6 +419,7 @@ let process_intf_file filename = null_rewrite filename;;
let process_impl_file filename =
let modname = Filename.basename(Filename.chop_extension filename) in
+ (* FIXME should let modname = String.capitalize modname *)
if !instr_mode then begin
(* Instrumentation mode *)
set_flags !modes;