|
| 1 | +opam-version: "2.0" |
| 2 | +synopsis: "OCaml cross-compiler and libraries from the DKML distribution that works with at least Win32 and macOS" |
| 3 | +description: |
| 4 | + """The DKML distribution of the OCaml bytecode and native compiler, Stdlib and the other OCaml libraries (str, unix, bigarray, etc.). |
| 5 | +A cross-compiler for macOS x86_64 to macOS arm64 is included; for build consistency the regular OCaml compiler will be for x86_64 regardless of whether the build machine is Apple Silicon. |
| 6 | +Install with something like: opam switch create dkml-4.12.1 '--formula="dkml-base-compiler" {>= "4.12.1~" & < "4.13.0~"}'""" |
| 7 | + |
| 8 | +authors: ["Diskuv, Inc. < [email protected]>"] |
| 9 | +license: "Apache-2.0" |
| 10 | +homepage: "https://github.com/diskuv/dkml-compiler" |
| 11 | +bug-reports: "https://github.com/diskuv/dkml-compiler/issues" |
| 12 | +depends: [ |
| 13 | + "ocaml" {= "4.12.1" & post} |
| 14 | + |
| 15 | + "base-unix" {post} |
| 16 | + "base-bigarray" {post} |
| 17 | + "base-threads" {post} |
| 18 | +] |
| 19 | +conflict-class: "ocaml-core-compiler" |
| 20 | +flags: [ compiler avoid-version ] |
| 21 | +build: [ |
| 22 | + # OCaml source code |
| 23 | + ["install" "-d" "dl/ocaml/flexdll"] |
| 24 | + ["tar" "xCfz" "dl/ocaml" "dl/ocaml.tar.gz" "--strip-components=1"] |
| 25 | + ["tar" "xCfz" "dl/ocaml/flexdll" "dl/flexdll.tar.gz" "--strip-components=1"] |
| 26 | + |
| 27 | + # Create a DKMLDIR. Its structure mimics a git submodule setup. |
| 28 | + # <dkmldir>/.dkmlroot |
| 29 | + ["install" "-d" "dkmldir"] |
| 30 | + # 4.12.1~v0.4.1 --dkml-semver--> 0.4.1 |
| 31 | + # 4.12.1~v0.4.1~prerel69 --dkml-semver--> 0.4.1-prerel69 |
| 32 | + ["sh" "-c" "printf 'dkml_root_version=%s\\n' '%{version}%' | sed 's/[0-9.]*~v//; s/~/-/' > dkmldir/.dkmlroot"] |
| 33 | + |
| 34 | + # <dkmldir>/vendor/drc/ |
| 35 | + ["install" "-d" "dkmldir/vendor/drc"] |
| 36 | + ["tar" "xCfz" "dkmldir/vendor/drc" "dl/dkml-runtime-common.tar.gz" "--strip-components=1"] |
| 37 | + |
| 38 | + # <dkmldir>/vendor/dkml-compiler/ |
| 39 | + ["install" "-d" "dkmldir/vendor/dkml-compiler/src"] |
| 40 | + ["sh" "-eufc" "tar cCf src/ - . | tar xCf dkmldir/vendor/dkml-compiler/src/ -"] |
| 41 | +] |
| 42 | +install: [ |
| 43 | + # Run r-c-ocaml-1-setup.sh |
| 44 | + [ |
| 45 | + "env" "TOPDIR=dkmldir/vendor/drc/all/emptytop" |
| 46 | + "dkmldir/vendor/dkml-compiler/src/r-c-ocaml-1-setup.sh" |
| 47 | + "-d" "dkmldir" |
| 48 | + "-t" "%{prefix}%" |
| 49 | + "-f" "src-ocaml" |
| 50 | + "-g" "%{_:share}%/mlcross" |
| 51 | + "-v" "dl/ocaml" |
| 52 | + # Host architectures |
| 53 | + "-ewindows_x86_64" { os = "win32" } |
| 54 | + "-elinux_x86_64" { os = "linux" } |
| 55 | + "-edarwin_x86_64" { os = "macos" } |
| 56 | + # Target architectures (if cross-compiling) |
| 57 | + "-adarwin_arm64=vendor/dkml-compiler/src/standard-compiler-env-to-ocaml-configure-env.sh" { os = "macos" } |
| 58 | + # TODO: Would be nice to bundle the 3 Android cross-compilers here since they are already supported |
| 59 | + # by DKML, but I (jonahbeckford@) doubt there is an Android NDK available on the Opam hosts. |
| 60 | + # Confer: https://github.com/diskuv/diskuv-ocaml-ghmirror/runs/4831077050 |
| 61 | + # Perhaps the Android NDK should just be downloaded via an 'android-option-ndk23' package? That would give control of the NDK version. |
| 62 | + # "-aandroid_arm64v8a=vendor/dkml-compiler/src/ci/github-actions-ci-to-ocaml-configure-env.sh;android_x86_64=vendor/dkml-compiler/src/ci/github-actions-ci-to-ocaml-configure-env.sh"] { os = "linux" & !ocaml-option-32bit:installed } |
| 63 | + # "-aandroid_arm32v7a=vendor/dkml-compiler/src/ci/github-actions-ci-to-ocaml-configure-env.sh" { os = "linux" & ocaml-option-32bit:installed } |
| 64 | + "-k" "vendor/dkml-compiler/src/standard-compiler-env-to-ocaml-configure-env.sh" |
| 65 | + ] |
| 66 | + |
| 67 | + # Run r-c-ocaml-2-build_host-noargs.sh |
| 68 | + [ |
| 69 | + "sh" "-eufc" |
| 70 | + """ |
| 71 | + cd '%{prefix}%' |
| 72 | + share/dkml/repro/100co/vendor/dkml-compiler/src/r-c-ocaml-2-build_host-noargs.sh |
| 73 | + """ |
| 74 | + ] |
| 75 | + |
| 76 | + # Run r-c-ocaml-3-build_cross-noargs.sh (typically a no-op unless we are cross-compiling) |
| 77 | + [ |
| 78 | + "sh" "-eufc" |
| 79 | + """ |
| 80 | + cd '%{prefix}%' |
| 81 | + share/dkml/repro/100co/vendor/dkml-compiler/src/r-c-ocaml-3-build_cross-noargs.sh |
| 82 | + """ |
| 83 | + ] |
| 84 | +] |
| 85 | +dev-repo: "git+https://github.com/diskuv/dkml-component-ocamlcompiler.git" |
| 86 | +extra-source "dl/ocaml.tar.gz" { |
| 87 | + src: "https://github.com/ocaml/ocaml/archive/4.12.1.tar.gz" |
| 88 | + checksum: "sha256=f5a48a90557cb47ace7b1590fcab1362a1af38629a218350f69c225c57e96a41" |
| 89 | +} |
| 90 | +extra-source "dl/flexdll.tar.gz" { |
| 91 | + src: "https://github.com/alainfrisch/flexdll/archive/0.39.tar.gz" |
| 92 | + checksum: "sha256=51a6ef2e67ff475c33a76b3dc86401a0f286c9a3339ee8145053ea02d2fb5974" |
| 93 | +} |
| 94 | +extra-source "dl/dkml-runtime-common.tar.gz" { |
| 95 | + src: "https://github.com/diskuv/dkml-runtime-common/archive/refs/tags/v0.4.0.tar.gz" |
| 96 | + checksum: [ |
| 97 | + "sha256=8793c636e14b630722ba59145aa1d895fddbb151de4b7f515cefb8942ec2f917" |
| 98 | + ] |
| 99 | +} |
| 100 | +url { |
| 101 | + src: "https://github.com/diskuv/dkml-compiler/archive/4.12.1-v1.0.0.tar.gz" |
| 102 | + checksum: [ |
| 103 | + "md5=23f798f9ac63bf614de0755b0a5a9751" |
| 104 | + "sha512=3028db4dc6a5fdbe8e47f699985f81e6d18144dab81b1e15eb5623d8bbdb39cca2987f50a9e0096cfe714169b6177fff0f670b57322dec879cfb558dbc1b0134" |
| 105 | + ] |
| 106 | +} |
0 commit comments