@@ -12,18 +12,31 @@ 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
15
- A cross-compiler for macOS x86_64 to macOS arm64 is included; for build consistency the regular OCaml compiler will be for
16
- x86_64 regardless of whether the build machine is Apple Silicon.
15
+ The following cross-compilers have been included:
16
+ - from macOS x86_64 and macOS arm64, and vice versa
17
+ - from Linux x86 to the android armeabi-v7a ABI
18
+ - from Linux x86_64 to either the android arm64-v8a or x86_64 ABI
17
19
18
20
To support cross-compilation, environment variables for compilers like CC and LDFLAGS have no effect on the 'host' ABI.
19
21
The compiler for the 'host' ABI will be detected from conventional locations on the system and (for Visual Studio)
20
22
from configuration stored in the DkML home directory.
21
23
24
+ If you use cross-compilation, you should also install the conf-dkml-cross-toolchain package
25
+ so that your findlib installation recognizes the cross-compilers.
26
+
27
+ For Android compilation, the following opam global or switch variables are needed:
28
+ - (required) ANDROID_NDK. This is the directory containing the Android NDK installation.
29
+ Examples: /opt/downloaded/ndk-23.1.7779620
30
+ - (optional) ANDROID_PLATFORM. The minimum API level for the Android app or library. The default varies based on the version
31
+ of dkml-base-compiler, so it is best to set this. This version the default is 23.
32
+ Confer: https://developer.android.com/ndk/guides/cmake#android_platform.
33
+ Examples: android-23, 23, android-N, android-O_MR1
34
+
22
35
Advanced: Set environment variables like DKML_TARGET_ABI and DKML_COMPILE_* to do cross-compilation from the 'host' ABI
23
36
to a 'target' ABI. Those variables are documented in dkml-runtime-common's crossplatform-functions.sh script.
24
- Search for: autodetect_compiler() {
37
+ Search for: autodetect_compiler()
25
38
26
- Install with something like:
39
+ You can install dkml-base-compiler with something like:
27
40
opam switch create dkml-4.14.2 '--formula="dkml-base-compiler" {>= "4.14.2~" & < "4.15.0~"}'"""
28
41
29
42
authors: ["Diskuv, Inc. <
[email protected] >"]
@@ -200,15 +213,12 @@ install: [
200
213
"--disable-debug-runtime --disable-instrumented-runtime" { !dkml-option-debuginfo:installed }
201
214
# Host architectures
202
215
"-e%{dkml-host-abi:abi}%"
203
- # Target architectures (if cross-compiling; similar to dkml-component-staging-ocamlrun.opam)
204
- "-adarwin_x86_64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { dkml-host-abi:abi != "darwin_x86_64" & dkml-target-abi-darwin_x86_64:installed }
205
- "-adarwin_arm64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { dkml-host-abi:abi != "darwin_arm64" & dkml-target-abi-darwin_arm64:installed }
206
- # TODO: Would be nice to bundle the 3 Android cross-compilers here since they are already supported
207
- # by DkML, but I (jonahbeckford@) doubt there is an Android NDK available on the Opam hosts.
208
- # Confer: https://github.com/diskuv/diskuv-ocaml-ghmirror/runs/4831077050
209
- # Perhaps the Android NDK should just be downloaded via an 'android-option-ndk23' package? That would give control of the NDK version.
210
- # "-aandroid_arm64v8a=vendor/dkml-compiler/env/android-ndk-env-to-ocaml-configure-env.sh;android_arm64v8a=vendor/dkml-compiler/env/android-ndk-env-to-ocaml-configure-env.sh"] { dkml-target-abi-android_arm64v8a:installed }
211
- # "-aandroid_arm32v7a=vendor/dkml-compiler/env/android-ndk-env-to-ocaml-configure-env.sh" { dkml-target-abi-android_arm32v7a:installed }
216
+ # Target architectures
217
+ "-adarwin_x86_64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { dkml-host-abi:abi != "darwin_x86_64" & dkml-target-abi-darwin_x86_64:installed }
218
+ "-adarwin_arm64=vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh" { dkml-host-abi:abi != "darwin_arm64" & dkml-target-abi-darwin_arm64:installed }
219
+ "-aandroid_arm32v7a=vendor/dkml-compiler/env/android-ndk-env-to-ocaml-configure-env.sh" { dkml-target-abi-android_arm32v7a:installed }
220
+ "-aandroid_arm64v8a=vendor/dkml-compiler/env/android-ndk-env-to-ocaml-configure-env.sh" { dkml-target-abi-android_arm64v8a:installed }
221
+ "-aandroid_x86_64=vendor/dkml-compiler/env/android-ndk-env-to-ocaml-configure-env.sh" { dkml-target-abi-android_x86_64:installed }
212
222
"-k" "vendor/dkml-compiler/env/standard-compiler-env-to-ocaml-configure-env.sh"
213
223
]
214
224
0 commit comments