Skip to content

Commit 3945808

Browse files
committed
1 parent 61fbd64 commit 3945808

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

dkml-base-compiler.opam

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ opam-version: "2.0"
88
# - 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
99
# Confer: Version Ordering in https://opam.ocaml.org/doc/Manual.html#Package-Formulas
1010
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."
1212
description:
1313
"""The DkML distribution of the OCaml bytecode and native compiler, Stdlib and the other OCaml libraries (str, unix, bigarray, etc.).
1414

@@ -25,8 +25,8 @@ Search for: autodetect_compiler() {
2525

2626
Install with something like:
2727
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>"]
3030
license: "Apache-2.0"
3131
homepage: "https://github.com/diskuv/dkml-compiler"
3232
bug-reports: "https://github.com/diskuv/dkml-compiler/issues"
@@ -38,19 +38,36 @@ depends: [
3838
"base-threads" {post}
3939

4040
"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")
4150
]
4251
depopts: [
4352
"ocaml-option-32bit"
4453
"dkml-option-debuginfo"
4554
"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"
4666
]
4767
conflict-class: "ocaml-core-compiler"
4868
flags: [ compiler avoid-version ]
4969
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"
5471
]
5572
build: [
5673
# Dump Homebrew, which is needed for reproducible build auditing in drc's crossplatform-functions.sh.
@@ -109,21 +126,21 @@ build: [
109126
env/standard-compiler-env-to-ocaml-configure-env.sh > \
110127
dkmldir/vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh
111128
"""
112-
] {dkml-option-debuginfo:installed & os = "win32" & arch = "x86_32"}
129+
] {dkml-option-debuginfo:installed & dkml-host-abi-windows_x86:installed}
113130
["sh" "-eufc"
114131
"""
115132
sed 's/^INJECT_CFLAGS=$/INJECT_CFLAGS=-Z7/; s/^DEFAULT_AS=$/DEFAULT_AS=ml64/; s/^INJECT_ASFLAGS=$/INJECT_ASFLAGS="-Zd -Zi"/' \
116133
env/standard-compiler-env-to-ocaml-configure-env.sh > \
117134
dkmldir/vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh
118135
"""
119-
] {dkml-option-debuginfo:installed & os = "win32" & arch = "x86_64"}
136+
] {dkml-option-debuginfo:installed & dkml-host-abi-windows_x86_64:installed}
120137
["sh" "-eufc"
121138
"""
122139
sed 's/^INJECT_CFLAGS=$/INJECT_CFLAGS=-Z7/; s/^DEFAULT_AS=$/DEFAULT_AS=armasm64/; s/^INJECT_ASFLAGS=$/INJECT_ASFLAGS="-Zd -Zi"/' \
123140
env/standard-compiler-env-to-ocaml-configure-env.sh > \
124141
dkmldir/vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh
125142
"""
126-
] {dkml-option-debuginfo:installed & os = "win32" & arch = "arm64"}
143+
] {dkml-option-debuginfo:installed & dkml-host-abi-windows_arm64:installed}
127144
["sh" "-eufc"
128145
"""
129146
sed 's/^INJECT_CFLAGS=$/INJECT_CFLAGS="-g -O0"/; s/^INJECT_ASFLAGS=$/INJECT_ASFLAGS="-g -O0"/' \
@@ -142,12 +159,13 @@ build: [
142159

143160
# <dkmldir>/vendor/dkml-compiler/bin/bootstrap-ocamlc.opt.exe
144161
# 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 }
151169
]
152170
install: [
153171
# Run r-c-ocaml-1-setup.sh
@@ -176,33 +194,16 @@ install: [
176194
"-n" { !dkml-option-debuginfo:installed }
177195
"--disable-debug-runtime --disable-instrumented-runtime" { !dkml-option-debuginfo:installed }
178196
# 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}%"
185198
# 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 }
200201
# TODO: Would be nice to bundle the 3 Android cross-compilers here since they are already supported
201202
# by DkML, but I (jonahbeckford@) doubt there is an Android NDK available on the Opam hosts.
202203
# Confer: https://github.com/diskuv/diskuv-ocaml-ghmirror/runs/4831077050
203204
# 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 }
206207
"-k" "vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh"
207208
]
208209

0 commit comments

Comments
 (0)