forked from ocaml/opam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
320 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
bootstrap | ||
src_ext/jbuilder | ||
tests | ||
tests/packages |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#directory "+compiler-libs";; | ||
#load "ocamlcommon.cma";; | ||
|
||
let p = String.index Sys.ocaml_version '.' in | ||
let ocaml_major = String.sub Sys.ocaml_version 0 p |> int_of_string in | ||
let p = succ p in | ||
let ocaml_minor = String.sub Sys.ocaml_version p (String.index_from Sys.ocaml_version p '.' - p) |> int_of_string in | ||
match Sys.argv.(1) with | ||
| "flags" -> | ||
if ocaml_major > 4 || ocaml_major = 4 && ocaml_minor >= 2 then | ||
Printf.printf "(-safe-string)" | ||
| "compat" -> | ||
if ocaml_major < 4 || ocaml_major = 4 && ocaml_minor < 1 then begin | ||
Printf.eprintf "Unsupported version of OCaml: %d.%02d\n" ocaml_major ocaml_minor; | ||
exit 1 | ||
end else if ocaml_major = 4 && ocaml_minor < 3 then | ||
Printf.printf "4.0%d" ocaml_minor | ||
else | ||
Printf.printf "4.03" | ||
| _ -> | ||
Printf.eprintf "Unrecognised context instruction: %s\n" Sys.argv.(1); | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
let name = Printf.sprintf "@%s@" Sys.argv.(1) in | ||
let value = | ||
let file, magic = | ||
let root = | ||
let rec process acc dir = | ||
let dir' = Filename.dirname dir in | ||
let base = Filename.basename dir in | ||
if dir' = dir then | ||
failwith "Invalid invocation - couldn't locate build root" | ||
else | ||
let acc = Filename.concat acc Filename.parent_dir_name in | ||
if base = "_build" then | ||
acc | ||
else | ||
process acc dir' | ||
in | ||
process "" (Sys.getcwd ()) | ||
in | ||
let file = Filename.concat root "config.status" in | ||
if Sys.file_exists file then | ||
file, Printf.sprintf "S[\"%s\"]=\"" Sys.argv.(1) | ||
else if Sys.argv.(1) = "PACKAGE_VERSION" then | ||
Filename.concat root "configure.ac", "AC_INIT(opam," | ||
else | ||
"", "" | ||
in | ||
if file <> "" then | ||
let c = open_in file in | ||
let magic_l = String.length magic in | ||
(* End_of_file is permitted to leak as the failure of this build step *) | ||
let rec process () = | ||
let line = input_line c in | ||
let line_l = String.length line in | ||
if line_l > magic_l then | ||
if String.sub line 0 magic_l = magic then begin | ||
close_in c; | ||
String.sub line magic_l (line_l - magic_l - 1) | ||
end else | ||
process () | ||
else | ||
process () | ||
in | ||
process () | ||
else | ||
Sys.argv.(2) | ||
in | ||
let cin = open_in Sys.argv.(3) in | ||
let name_l = String.length name in | ||
let rec process () = | ||
match input_line cin with | ||
| exception End_of_file -> | ||
close_in cin | ||
| line -> | ||
begin | ||
try | ||
let idx = String.index line '@' in | ||
let line_l = String.length line in | ||
if line_l > idx + name_l - 1 && String.sub line idx name_l = name then begin | ||
if idx > 0 then | ||
print_string (String.sub line 0 idx); | ||
print_string value; | ||
print_endline (String.sub line (idx + name_l) (line_l - idx - name_l)); | ||
end else | ||
print_endline line | ||
with Not_found -> | ||
print_endline line | ||
end; | ||
process () | ||
in | ||
process () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
(* -*- tuareg -*- *) | ||
|
||
module J = Jbuild_plugin.V1 | ||
|
||
let (sha, version) = | ||
let remove () = | ||
try | ||
Sys.remove "current-git-sha" | ||
with _ -> | ||
() | ||
in | ||
try | ||
let _ = Sys.command "git rev-parse HEAD > current-git-sha" in | ||
let c = open_in "current-git-sha" in | ||
let sha = | ||
try | ||
input_line c | ||
with _ -> | ||
"" | ||
in | ||
close_in c; | ||
remove (); | ||
if sha = "" then | ||
raise Exit | ||
else | ||
(sha, Printf.sprintf "let version = Some \\\"%s\\\"" sha) | ||
with _ -> | ||
remove (); | ||
("", "let version = None") | ||
|
||
let () = Printf.ksprintf J.send {| | ||
(jbuild_version 1) | ||
|
||
(library | ||
((name opam_client) | ||
(public_name opam-client) | ||
(synopsis "OCaml Package Manager client and CLI library") | ||
(modules (:standard \ opamMain)) | ||
(libraries (opam-state opam-solver re.glob cmdliner)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(wrapped false))) | ||
|
||
(executable | ||
((name opamMain) | ||
(public_name opam) | ||
(package opam) | ||
(modules opamMain) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(libraries (opam-client)))) | ||
|
||
(rule | ||
(with-stdout-to opamGitVersion.ml (echo ${read-lines:git-sha-%s}))) | ||
|
||
(rule | ||
(with-stdout-to git-sha-%s (echo "%s"))) | ||
|} sha sha version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(jbuild_version 1) | ||
|
||
(library | ||
((name opam_core) | ||
(public_name opam-core) | ||
(synopsis "OCaml Package Manager core internal stdlib") | ||
(libraries (re ocamlgraph unix bigarray)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(wrapped false))) | ||
|
||
(rule | ||
((targets (ocaml-compat.sexp)) | ||
(deps (../../shell/context_flags.ml)) | ||
(action (with-stdout-to ${@} (run ocaml ../../shell/context_flags.ml compat))))) | ||
|
||
(rule | ||
((targets (opamCompat.ml)) | ||
(deps (opamCompat.ml.4.01 opamCompat.ml.4.02 opamCompat.ml.4.03)) | ||
(action (copy ${@}.${read:ocaml-compat.sexp} ${@})))) | ||
|
||
(rule | ||
((targets (opamCompat.mli)) | ||
(deps (opamCompat.mli.4.01 opamCompat.mli.4.02 opamCompat.mli.4.03)) | ||
(action (copy ${@}.${read:ocaml-compat.sexp} ${@})))) | ||
|
||
(rule | ||
((targets (opamVersion.ml)) | ||
(deps (opamVersion.ml.in ../../shell/subst_var.ml)) | ||
(action (with-stdout-to ${@} (run ocaml ../../shell/subst_var.ml PACKAGE_VERSION "<error>" ${!^}))))) | ||
|
||
(rule | ||
((targets (opamCoreConfig.ml)) | ||
(deps (opamCoreConfig.ml.in ../../shell/subst_var.ml)) | ||
(action (with-stdout-to ${@} (run ocaml ../../shell/subst_var.ml DEVELOPER false ${!^}))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(jbuild_version 1) | ||
|
||
(library | ||
((name opam_format) | ||
(public_name opam-format) | ||
(synopsis "OCaml Package Manager file format handling library") | ||
(libraries (opam-core opam-file-format re.pcre re.posix)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(wrapped false))) | ||
|
||
(ocamllex (opamLineLexer)) | ||
|
||
(rule | ||
(with-stdout-to opamTypes.ml | ||
(progn | ||
(echo "module rec OpamTypes : sig\n") | ||
(cat opamTypes.mli) | ||
(echo "\nend = OpamTypes\ninclude OpamTypes\n")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(jbuild_version 1) | ||
|
||
(rule | ||
((targets (ocaml-flags-standard.sexp)) | ||
(deps (ocaml-flags-standard.sexp.in ../shell/subst_var.ml)) | ||
(action (with-stdout-to ${@} (run ocaml ../shell/subst_var.ml CONF_OCAMLFLAGS "" ${!^}))))) | ||
|
||
(rule | ||
((targets (ocaml-context-flags.sexp)) | ||
(deps (../shell/context_flags.ml)) | ||
(action (with-stdout-to ${@} (run ocaml ../shell/context_flags.ml flags))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(-w +a-4-44-48 -short-paths @CONF_OCAMLFLAGS@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(jbuild_version 1) | ||
|
||
(library | ||
((name opam_repository) | ||
(public_name opam-repository) | ||
(synopsis "OCaml Package Manager remote repository handling library") | ||
(libraries (opam-format)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(wrapped false))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(jbuild_version 1) | ||
|
||
(library | ||
((name opam_solver) | ||
(public_name opam-solver) | ||
(synopsis "OCaml Package Manager solver interaction library") | ||
(libraries (opam-format cudf dose3.algo)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(wrapped false))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(jbuild_version 1) | ||
|
||
(library | ||
((name opam_state) | ||
(public_name opam-state) | ||
(libraries (opam-repository)) | ||
(synopsis "OCaml Package Manager instance management library") | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(wrapped false))) | ||
|
||
(rule | ||
((targets (opamScript.ml)) | ||
(deps (../../shell/crunch.ml complete.sh complete.zsh prompt.sh)) | ||
(action (with-stdout-to ${@} (run ocaml ${!^}))))) | ||
|
||
(rule | ||
(with-stdout-to opamStateTypes.ml | ||
(progn | ||
(echo "[@@@warning \"-a\"]\nmodule rec OpamStateTypes : sig\n") | ||
(cat opamStateTypes.mli) | ||
(echo "\nend = OpamStateTypes\ninclude OpamStateTypes\n")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(jbuild_version 1) | ||
|
||
(executable | ||
((name opam_admin_topstart) | ||
(modules (opam_admin_top opam_admin_topstart)) | ||
(ocamlc_flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp) -linkall)) | ||
(libraries (opam-client opam-file-format compiler-libs.toplevel re.glob)))) | ||
|
||
(install | ||
((section bin) | ||
(package opam-admin) | ||
(files ((opam_admin_topstart.bc as opam-admin.top))))) | ||
|
||
(executable | ||
((name opam_check) | ||
(modules (opam_check)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))) | ||
(libraries (opam-client)))) | ||
|
||
(executable | ||
((name opam_installer) | ||
(package opam) | ||
(public_name opam-installer) | ||
(modules (opam_installer)) | ||
(libraries (opam-state cmdliner)) | ||
(flags (:standard (:include ../ocaml-flags-standard.sexp) (:include ../ocaml-context-flags.sexp))))) |
Oops, something went wrong.