@@ -8,7 +8,7 @@ opam-version: "2.0"
8
8
# - 4.14.0~prerel69 (legacy format) < 4.14.0~v0.4.0 < 4.14.0~v0.4.1~prerel69 < 4.14.0~v0.4.1
9
9
# Confer: Version Ordering in https://opam.ocaml.org/doc/Manual.html#Package-Formulas
10
10
version: "4.14.2~v2.1.2"
11
- synopsis: "OCaml cross-compiler and libraries from the DkML distribution that works with at least Win32 and macOS "
11
+ synopsis: "OCaml cross-compiler and libraries from the DkML distribution. "
12
12
description:
13
13
"""The DkML distribution of the OCaml bytecode and native compiler, Stdlib and the other OCaml libraries (str, unix, bigarray, etc.).
14
14
@@ -25,8 +25,8 @@ Search for: autodetect_compiler() {
25
25
26
26
Install with something like:
27
27
opam switch create dkml-4.14.2 '--formula="dkml-base-compiler" {>= "4.14.2~" & < "4.15.0~"}'"""
28
- maintainer: ["opensource+diskuv-ocaml @support.diskuv.com"]
29
- authors: ["Diskuv, Inc. <opensource+diskuv-ocaml @support.diskuv.com>"]
28
+ maintainer: ["opensource+dkml @support.diskuv.com"]
29
+ authors: ["Diskuv, Inc. <opensource+dkml @support.diskuv.com>"]
30
30
license: "Apache-2.0"
31
31
homepage: "https://github.com/diskuv/dkml-compiler"
32
32
bug-reports: "https://github.com/diskuv/dkml-compiler/issues"
@@ -38,19 +38,36 @@ depends: [
38
38
"base-threads" {post}
39
39
40
40
"dkml-runtime-common-native" {= "2.1.2"}
41
+
42
+ "dkml-host-abi"
43
+ ("dkml-host-abi-darwin_arm64" |
44
+ "dkml-host-abi-darwin_x86_64" |
45
+ "dkml-host-abi-linux_x86_64" |
46
+ "dkml-host-abi-linux_x86" |
47
+ "dkml-host-abi-windows_x86_64" |
48
+ "dkml-host-abi-windows_arm64" |
49
+ "dkml-host-abi-windows_x86")
41
50
]
42
51
depopts: [
43
52
"ocaml-option-32bit"
44
53
"dkml-option-debuginfo"
45
54
"dkml-option-minsize"
55
+ "dkml-target-abi-android_arm64v8a"
56
+ "dkml-target-abi-android_arm32v7a"
57
+ "dkml-target-abi-android_x86_64"
58
+ "dkml-target-abi-android_x86"
59
+ "dkml-target-abi-darwin_arm64"
60
+ "dkml-target-abi-darwin_x86_64"
61
+ "dkml-target-abi-linux_x86_64"
62
+ "dkml-target-abi-linux_x86"
63
+ "dkml-target-abi-windows_x86_64"
64
+ "dkml-target-abi-windows_arm64"
65
+ "dkml-target-abi-windows_x86"
46
66
]
47
67
conflict-class: "ocaml-core-compiler"
48
68
flags: [ compiler avoid-version ]
49
69
available: [
50
- opam-version >= "2.1.0" &
51
- ( (arch = "x86_64" & (os = "linux" | os = "win32" | os = "macos")) |
52
- (arch = "x86_32" & (os = "linux" | os = "win32")) |
53
- (arch = "arm64" & os = "macos") )
70
+ opam-version >= "2.1.0"
54
71
]
55
72
build: [
56
73
# Dump Homebrew, which is needed for reproducible build auditing in drc's crossplatform-functions.sh.
@@ -109,21 +126,21 @@ build: [
109
126
env/standard-compiler-env-to-ocaml-configure-env.sh > \
110
127
dkmldir/vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh
111
128
"""
112
- ] {dkml-option-debuginfo:installed & os = "win32" & arch = "x86_32" }
129
+ ] {dkml-option-debuginfo:installed & dkml-host-abi-windows_x86:installed }
113
130
["sh" "-eufc"
114
131
"""
115
132
sed 's/^INJECT_CFLAGS=$/INJECT_CFLAGS=-Z7/; s/^DEFAULT_AS=$/DEFAULT_AS=ml64/; s/^INJECT_ASFLAGS=$/INJECT_ASFLAGS="-Zd -Zi"/' \
116
133
env/standard-compiler-env-to-ocaml-configure-env.sh > \
117
134
dkmldir/vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh
118
135
"""
119
- ] {dkml-option-debuginfo:installed & os = "win32" & arch = "x86_64" }
136
+ ] {dkml-option-debuginfo:installed & dkml-host-abi-windows_x86_64:installed }
120
137
["sh" "-eufc"
121
138
"""
122
139
sed 's/^INJECT_CFLAGS=$/INJECT_CFLAGS=-Z7/; s/^DEFAULT_AS=$/DEFAULT_AS=armasm64/; s/^INJECT_ASFLAGS=$/INJECT_ASFLAGS="-Zd -Zi"/' \
123
140
env/standard-compiler-env-to-ocaml-configure-env.sh > \
124
141
dkmldir/vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh
125
142
"""
126
- ] {dkml-option-debuginfo:installed & os = "win32" & arch = "arm64" }
143
+ ] {dkml-option-debuginfo:installed & dkml-host-abi-windows_arm64:installed }
127
144
["sh" "-eufc"
128
145
"""
129
146
sed 's/^INJECT_CFLAGS=$/INJECT_CFLAGS="-g -O0"/; s/^INJECT_ASFLAGS=$/INJECT_ASFLAGS="-g -O0"/' \
@@ -142,12 +159,13 @@ build: [
142
159
143
160
# <dkmldir>/vendor/dkml-compiler/bin/bootstrap-ocamlc.opt.exe
144
161
# to speed up compile
145
- ["sh" "scripts/install-ocamlc-opt.sh" "windows_x86" ".exe"] { os = "win32" & (arch = "x86_32" | ocaml-option-32bit:installed) }
146
- ["sh" "scripts/install-ocamlc-opt.sh" "windows_x86_64" ".exe"] { os = "win32" & (arch = "x86_64" & !ocaml-option-32bit:installed) }
147
- ["sh" "scripts/install-ocamlc-opt.sh" "linux_x86" ""] { os = "linux" & (arch = "x86_32" | ocaml-option-32bit:installed) }
148
- ["sh" "scripts/install-ocamlc-opt.sh" "linux_x86_64" ""] { os = "linux" & (arch = "x86_64" & !ocaml-option-32bit:installed) }
149
- ["sh" "scripts/install-ocamlc-opt.sh" "darwin_x86_64" ""] { os = "macos" & arch = "x86_64" }
150
- ["sh" "scripts/install-ocamlc-opt.sh" "darwin_arm64" ""] { os = "macos" & arch = "arm64" }
162
+ ["sh" "scripts/install-ocamlc-opt.sh" "windows_x86" ".exe"] { dkml-host-abi-windows_x86:installed }
163
+ ["sh" "scripts/install-ocamlc-opt.sh" "windows_x86_64" ".exe"] { dkml-host-abi-windows_x86_64:installed }
164
+ ["sh" "scripts/install-ocamlc-opt.sh" "windows_arm64" ".exe"] { dkml-host-abi-windows_arm64:installed }
165
+ ["sh" "scripts/install-ocamlc-opt.sh" "linux_x86" ""] { dkml-host-abi-linux_x86:installed }
166
+ ["sh" "scripts/install-ocamlc-opt.sh" "linux_x86_64" ""] { dkml-host-abi-linux_x86_64:installed }
167
+ ["sh" "scripts/install-ocamlc-opt.sh" "darwin_x86_64" ""] { dkml-host-abi-darwin_x86_64:installed }
168
+ ["sh" "scripts/install-ocamlc-opt.sh" "darwin_arm64" ""] { dkml-host-abi-darwin_arm64:installed }
151
169
]
152
170
install: [
153
171
# Run r-c-ocaml-1-setup.sh
@@ -176,33 +194,16 @@ install: [
176
194
"-n" { !dkml-option-debuginfo:installed }
177
195
"--disable-debug-runtime --disable-instrumented-runtime" { !dkml-option-debuginfo:installed }
178
196
# Host architectures
179
- "-ewindows_x86" { os = "win32" & (arch = "x86_32" | ocaml-option-32bit:installed) }
180
- "-ewindows_x86_64" { os = "win32" & (arch = "x86_64" & !ocaml-option-32bit:installed) }
181
- "-elinux_x86" { os = "linux" & (arch = "x86_32" | ocaml-option-32bit:installed) }
182
- "-elinux_x86_64" { os = "linux" & (arch = "x86_64" & !ocaml-option-32bit:installed) }
183
- "-edarwin_x86_64" { os = "macos" & arch = "x86_64" }
184
- "-edarwin_arm64" { os = "macos" & arch = "arm64" }
197
+ "-e%{dkml-host-abi:abi}%"
185
198
# Target architectures (if cross-compiling; similar to dkml-component-staging-ocamlrun.opam)
186
- # TODO: With the -adarwin_x86_64 configuration below, an Apple Silicon machine will produce an arm64 ocamlopt.opt
187
- # in the staging-files/darwin_arm64 directory,
188
- # and that ocamlopt.opt will create x86_64 OCaml native executables. So that darwin_arm64/bin/ocamlopt.opt will not
189
- # run on an x86_64 machine.
190
- # The -adarwin_arm64 configuration is similar but has one important difference. The config will produce an x86_64
191
- # ocamlopt.opt, in the staging-files/darwin_x86_64 directory, and that ocamlopt.opt will create arm64 OCaml native
192
- # executables. But that darwin_x86_64/bin/ocamlopt.opt _will_ run on almost _all_ Apple Silicon (arm64) machines
193
- # because of Rosetta2. The only major exception is Opam CI has disabled Rosetta2 as of Nov 8, 2022.
194
- # Ideally we would have [-aHOST] and [-aHOST-TARGET]. That is: -adarwin_x86_64, -adarwin_arm64 and
195
- # -adarwin_x86_64-darwin_arm64. But that cross specification has ripple effects that needs time (technical debt) to
196
- # get right. Luckily our build machines are always Apple x86_64 (GitHub Actions and GitLab CI/CD), and even if the
197
- # build machines were Apple Silicon we typically only care about the generated artifacts (the target ABI).
198
- "-adarwin_x86_64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { os = "macos" & arch = "arm64" }
199
- "-adarwin_arm64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { os = "macos" & arch = "x86_64" }
199
+ "-adarwin_x86_64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { dkml-target-abi-darwin_arm64:installed }
200
+ "-adarwin_arm64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { dkml-target-abi-darwin_x86_64:installed }
200
201
# TODO: Would be nice to bundle the 3 Android cross-compilers here since they are already supported
201
202
# by DkML, but I (jonahbeckford@) doubt there is an Android NDK available on the Opam hosts.
202
203
# Confer: https://github.com/diskuv/diskuv-ocaml-ghmirror/runs/4831077050
203
204
# Perhaps the Android NDK should just be downloaded via an 'android-option-ndk23' package? That would give control of the NDK version.
204
- # "-aandroid_arm64v8a=vendor/dkml-compiler/env/github-actions-ci-to-ocaml-configure-env.sh;android_x86_64 =vendor/dkml-compiler/env/github-actions-ci-to-ocaml-configure-env.sh"] { os = "linux" & !ocaml-option-32bit :installed }
205
- # "-aandroid_arm32v7a=vendor/dkml-compiler/env/github-actions-ci-to-ocaml-configure-env.sh" { os = "linux" & ocaml-option-32bit :installed }
205
+ # "-aandroid_arm64v8a=vendor/dkml-compiler/env/github-actions-ci-to-ocaml-configure-env.sh;android_arm64v8a =vendor/dkml-compiler/env/github-actions-ci-to-ocaml-configure-env.sh"] { dkml-target-abi-android_arm64v8a :installed }
206
+ # "-aandroid_arm32v7a=vendor/dkml-compiler/env/github-actions-ci-to-ocaml-configure-env.sh" { dkml-target-abi-android_arm32v7a :installed }
206
207
"-k" "vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh"
207
208
]
208
209
0 commit comments