Skip to content
Browse files

Merge branch 'master' of github.com:OCamlPro/opam

  • Loading branch information...
2 parents 210a9b1 + 3f55f70 commit 864df3e24f3788067b1d581f85f65cfc0623cd4f @tuong tuong committed Jul 26, 2012
Showing with 59 additions and 38 deletions.
  1. +2 −0 src/globals.ml
  2. +4 −3 src/repo/curl/misc.ml
  3. +16 −12 src/run.ml
  4. +4 −3 src/scripts/opam_mk_repo.ml
  5. +33 −20 src_ext/Makefile
View
2 src/globals.ml
@@ -81,6 +81,7 @@ type os =
| Darwin
| Linux
| FreeBSD
+ | OpenBSD
| Cygwin
| Win32
| Unix
@@ -91,6 +92,7 @@ let os = match Sys.os_type with
| "Darwin" -> Darwin
| "Linux" -> Linux
| "FreeBSD" -> FreeBSD
+ | "OpenBSD" -> OpenBSD
| _ -> Unix
end
| "Win32" -> Win32
View
7 src/repo/curl/misc.ml
@@ -39,9 +39,10 @@ module FileUrl = struct
end
let raw_wget str =
- match Globals.os with
- | Globals.Darwin -> [ "curl"; "--insecure" ; "-OL"; str ]
- | _ -> [ "wget"; "--no-check-certificate" ; str ]
+ let open Globals in
+ match os with
+ | Darwin | FreeBSD | OpenBSD -> [ "curl"; "--insecure"; "-OL"; str ]
+ | _ -> [ "wget"; "--no-check-certificate" ; str ]
let wget remote_file =
raw_wget (Filename.to_string remote_file)
View
28 src/run.ml
@@ -272,7 +272,7 @@ let is_archive file =
let extract o_tmp_dir file dst =
log "untar %s" file;
- let files = read_command_output [ "tar" ; "tf" ; file ] in
+ let files = read_command_output [ "tar" ; "ztf" ; file ] in
log "%s contains %d files: %s" file (List.length files) (String.concat ", " files);
let f_tmp tmp_dir =
let err =
@@ -384,18 +384,22 @@ let ocamlc_where () =
(* Only used by the compiler switch stuff *)
let download src dst =
- let cmd = match Globals.os with
- | Globals.Darwin -> [ "curl"; "--insecure" ; "-OL"; src ]
- | _ -> [ "wget"; "--no-check-certificate" ; src ] in
create_tmp_dir (fun tmp_dir ->
- let e = in_dir tmp_dir (fun () -> command cmd) in
- let tmp_file = tmp_dir / Filename.basename src in
- if e = 0 then
- if Filename.check_suffix src "tar.gz"
- || Filename.check_suffix src "tar.bz2" then
- extract (Some tmp_dir) tmp_file dst
- else
- copy tmp_file (dst / Filename.basename src))
+ let cmd =
+ let open Globals in
+ match os with
+ | Darwin | OpenBSD | FreeBSD -> [ "curl"; "--insecure" ; "-OL"; src ]
+ | _ -> [ "wget"; "--no-check-certificate"; src ] in
+ mkdir tmp_dir;
+ let e = in_dir tmp_dir (fun () -> command cmd) in
+ let tmp_file = tmp_dir / Filename.basename src in
+ if e = 0 then
+ if Filename.check_suffix src "tar.gz"
+ || Filename.check_suffix src "tar.bz2" then
+ extract (Some tmp_dir) tmp_file dst
+ else
+ copy tmp_file (dst / Filename.basename src)
+ )
let extract = extract None
View
7 src/scripts/opam_mk_repo.ml
@@ -74,9 +74,10 @@ let tmp_dir nv =
Dirname.of_string tmp_dir0 / NV.to_string nv
let wget src =
- match Globals.os with
- | Globals.Darwin -> [ "curl"; "--insecure" ; "-OL"; src ]
- | _ -> [ "wget"; "--no-check-certificate"; src ]
+ let open Globals in
+ match os with
+ | Darwin | FreeBSD | OpenBSD -> [ "curl"; "--insecure" ; "-OL"; src ]
+ | _ -> [ "wget"; "--no-check-certificate"; src ]
let archive_name src =
let name = F.basename src in
View
53 src_ext/Makefile
@@ -1,47 +1,60 @@
-OS = $(shell uname -s)
-ifeq ($(OS),Darwin)
-WGET ?= ftp
-else
-WGET ?= wget -qN
-endif
+FETCH ?= curl -OL
all: clone depends.ocp
depends.ocp: depends.ocp.boot
cp $< $@
-clone: cudf extlib ocaml-re ocamlgraph dose ocaml-arg
+clone: cudf.stamp extlib.stamp ocaml-re.stamp ocamlgraph.stamp dose.stamp ocaml-arg.stamp
-cudf:
- $(WGET) http://www.ocamlpro.com/pub/cudf.tar.gz
+cudf.tar.gz:
+ $(FETCH) http://www.ocamlpro.com/pub/cudf.tar.gz
+
+extlib-1.5.2.tar.gz:
+ $(FETCH) http://ocaml-extlib.googlecode.com/files/extlib-1.5.2.tar.gz
+ @touch $@
+
+cudf.stamp: cudf.tar.gz
tar xfz cudf.tar.gz
+ @touch $@
+
+dose.tar.gz:
+ $(FETCH) http://www.ocamlpro.com/pub/dose.tar.gz
+
+ocaml-arg.tar.gz:
+ $(FETCH) http://www.ocamlpro.com/pub/ocaml-arg.tar.gz
+
+ocamlgraph-1.8.1.tar.gz:
+ $(FETCH) http://ocamlgraph.lri.fr/download/ocamlgraph-1.8.1.tar.gz
+
+ocaml-re.tar.gz:
+ $(FETCH) http://www.ocamlpro.com/pub/ocaml-re.tar.gz
-extlib:
- $(WGET) http://ocaml-extlib.googlecode.com/files/extlib-1.5.2.tar.gz
+extlib.stamp: extlib-1.5.2.tar.gz
tar xfz extlib-1.5.2.tar.gz
mv extlib-1.5.2 extlib
+ @touch $@
-dose:
- $(WGET) http://www.ocamlpro.com/pub/dose.tar.gz
+dose.stamp: dose.tar.gz
tar xfz dose.tar.gz
+ @touch $@
-ocaml-arg:
- $(WGET) http://www.ocamlpro.com/pub/ocaml-arg.tar.gz
+ocaml-arg.stamp: ocaml-arg.tar.gz
tar xfz ocaml-arg.tar.gz
-ocamlgraph:
- $(WGET) http://ocamlgraph.lri.fr/download/ocamlgraph-1.8.1.tar.gz
+ocamlgraph.stamp: ocamlgraph-1.8.1.tar.gz
tar xfz ocamlgraph-1.8.1.tar.gz
mv ocamlgraph-1.8.1 ocamlgraph
+ @touch $@
-ocaml-re:
- $(WGET) http://www.ocamlpro.com/pub/ocaml-re.tar.gz
+ocaml-re.stamp: ocaml-re.tar.gz
tar xfz ocaml-re.tar.gz
+ @touch $@
clean:
rm -rf *~
distclean: clean
rm -rf cudf extlib ocaml-re ocamlgraph dose ocaml-arg
rm -f depends.ocp
- rm -rf *.tar.gz
+ rm -f *.tar.gz *.stamp

0 comments on commit 864df3e

Please sign in to comment.
Something went wrong with that request. Please try again.