Skip to content

Commit ede984c

Browse files
authored
Merge pull request ocaml#22481 from jonahbeckford/release-dkml-component-staging-ocamlrun-4.12.1-v1.0.2
[new release] dkml-component-staging-ocamlrun and dkml-component-offline-ocamlrun (4.12.1~v1.0.2)
2 parents 229829f + 25b3d91 commit ede984c

File tree

2 files changed

+254
-0
lines changed
  • packages
    • dkml-component-offline-ocamlrun/dkml-component-offline-ocamlrun.4.12.1~v1.0.2
    • dkml-component-staging-ocamlrun/dkml-component-staging-ocamlrun.4.12.1~v1.0.2

2 files changed

+254
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
opam-version: "2.0"
2+
synopsis: "DKML staging component for ocamlrun"
3+
description:
4+
"Standalone distribution of OCaml in <share>/staging-files containing just ocamlrun, the OCaml Stdlib and the other OCaml libraries (str, unix, bigarray, etc.)"
5+
maintainer: ["[email protected]"]
6+
authors: ["Diskuv, Inc. <[email protected]>"]
7+
license: "Apache-2.0"
8+
homepage: "https://github.com/diskuv/dkml-component-ocamlrun"
9+
bug-reports: "https://github.com/diskuv/dkml-component-ocamlrun/issues"
10+
depends: [
11+
"dune" {>= "2.9"}
12+
"dkml-install" {>= "0.2.0"}
13+
"dkml-component-staging-ocamlrun" {= version}
14+
"diskuvbox" {>= "0.1.0"}
15+
"odoc" {with-doc}
16+
]
17+
build: [
18+
["dune" "subst"] {dev}
19+
[
20+
"dune"
21+
"build"
22+
"-p"
23+
name
24+
"-j"
25+
jobs
26+
"--promote-install-files=false"
27+
"@install"
28+
"@runtest" {with-test}
29+
"@doc" {with-doc}
30+
]
31+
["dune" "install" "-p" name "--create-install-files" name]
32+
]
33+
dev-repo: "git+https://github.com/diskuv/dkml-component-ocamlrun.git"
34+
url {
35+
src:
36+
"https://github.com/diskuv/dkml-component-ocamlrun/releases/download/4.12.1-v1.0.2/dkml-component-staging-ocamlrun-4.12.1.v1.0.2.tbz"
37+
checksum: [
38+
"sha256=957c0117f17eb8cceef2ac696ec3b9b550fae38409fa5422186e9314a5717042"
39+
"sha512=0230cdc7cd66db0f59be5152324f0f9b5a2c5ecf00ca082998efb968f8ecd4c2ce5e9e8c56749e186038fee00ab295c0c2fb3f69dc6927044b73419ec350a3d8"
40+
]
41+
}
42+
x-commit-hash: "49033ffc7026cc4dcf4c81f0522b48766ced272f"
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
opam-version: "2.0"
2+
synopsis: "DKML staging component for ocamlrun"
3+
description:
4+
"Standalone distribution of OCaml in <share>/staging-files containing just ocamlrun, the OCaml Stdlib and the other OCaml libraries (str, unix, bigarray, etc.)"
5+
maintainer: ["[email protected]"]
6+
authors: ["Diskuv, Inc. <[email protected]>"]
7+
license: "Apache-2.0"
8+
homepage: "https://github.com/diskuv/dkml-component-ocamlrun"
9+
bug-reports: "https://github.com/diskuv/dkml-component-ocamlrun/issues"
10+
depends: [
11+
"dune" {>= "2.9"}
12+
"dkml-install" {>= "0.2.0"}
13+
"odoc" {with-doc}
14+
]
15+
dev-repo: "git+https://github.com/diskuv/dkml-component-ocamlrun.git"
16+
available: [ os = "macos" | (os = "linux" & (arch = "x86_32" | arch = "x86_64")) | os = "win32" ]
17+
build: [
18+
# Homebrew's bundle tap, needed for reproducible build auditing in drc's crossplatform-functions.sh.
19+
["sh" "src/opamtime/brewbundle.sh"] {os = "macos"}
20+
21+
# OCaml source code
22+
["install" "-d" "dl/ocaml/flexdll"]
23+
["tar" "xCfz" "dl/ocaml" "dl/ocaml.tar.gz" "--strip-components=1"]
24+
["tar" "xCfz" "dl/ocaml/flexdll" "dl/flexdll.tar.gz" "--strip-components=1"]
25+
26+
# Create a DKMLDIR. Its structure mimics a git submodule setup.
27+
# <dkmldir>/vendor/drc/
28+
["install" "-d" "dkmldir/vendor/drc"]
29+
["tar" "xCfz" "dkmldir/vendor/drc" "dl/dkml-runtime-common.tar.gz" "--strip-components=1"]
30+
# <dkmldir>/.dkmlroot
31+
["install" "dkmldir/vendor/drc/.template.dkmlroot" "dkmldir/.dkmlroot"]
32+
33+
# <dkmldir>/vendor/dkml-compiler/
34+
["install" "-d" "dkmldir/vendor/dkml-compiler/src"]
35+
["tar" "xCfz" "dkmldir/vendor/dkml-compiler" "dl/dkml-compiler.tar.gz" "--strip-components=1"]
36+
37+
# Developers:
38+
# Uncomment to test your own scripts
39+
#[ "diskuvbox" "copy-file" "r-c-ocaml-1-setup.sh" "dkmldir/vendor/dkml-compiler/src/r-c-ocaml-1-setup.sh" ]
40+
41+
# --------------
42+
# Build component and .api library
43+
# --------------
44+
45+
["dune" "subst"] {dev}
46+
[
47+
"dune"
48+
"build"
49+
"-p"
50+
name
51+
"-j"
52+
jobs
53+
"--promote-install-files=false"
54+
"@install"
55+
"@runtest" {with-test}
56+
"@doc" {with-doc}
57+
]
58+
["dune" "install" "-p" name "--create-install-files" name]
59+
]
60+
install: [
61+
# --------------
62+
# First pass
63+
# --------------
64+
65+
# [0] Avoid permission denied copying onto read-only files
66+
[
67+
"sh" "-eufxc" """
68+
if [ -e '%{_:share}%/staging-files' ]; then
69+
chmod -R u+w '%{_:share}%/staging-files'
70+
rm -rf '%{_:share}%/staging-files'
71+
fi
72+
"""
73+
]
74+
75+
# [1] Run r-c-ocaml-1-setup.sh
76+
[
77+
"env" "TOPDIR=dkmldir/vendor/drc/all/emptytop"
78+
"DKML_REPRODUCIBLE_SYSTEM_BREWFILE=%{_:build}%/Brewfile"
79+
"dkmldir/vendor/dkml-compiler/src/r-c-ocaml-1-setup.sh"
80+
"-d" "dkmldir"
81+
"-f" "src/ocaml-1"
82+
"-k" "vendor/dkml-compiler/src/standard-compiler-env-to-ocaml-configure-env.sh"
83+
"-v" "dl/ocaml"
84+
# Host-compile into staging-files/<host-abi>
85+
"-t" "%{_:share}%/staging-files"
86+
"-pwindows_x86_64" { os = "win32" }
87+
"-plinux_x86" { os = "linux" & arch = "x86_32" }
88+
"-plinux_x86_64" { os = "linux" & arch = "x86_64" }
89+
"-pdarwin_x86_64" { os = "macos" & arch = "x86_64" }
90+
"-pdarwin_arm64" { os = "macos" & arch = "arm64" }
91+
# ABIs
92+
"-ewindows_x86_64" { os = "win32" }
93+
"-elinux_x86" { os = "linux" & arch = "x86_32" }
94+
"-elinux_x86_64" { os = "linux" & arch = "x86_64" }
95+
"-edarwin_x86_64" { os = "macos" & arch = "x86_64" }
96+
"-edarwin_arm64" { os = "macos" & arch = "arm64" }
97+
# Cross-compile into staging-files/<cross-abi>
98+
"-g" "."
99+
# Target architectures (if cross-compiling)
100+
# TODO: With the -adarwin_x86_64 configuration below, an Apple Silicon machine will produce an arm64 ocamlopt.opt
101+
# in the staging-files/darwin_arm64 directory,
102+
# and that ocamlopt.opt will create x86_64 OCaml native executables. So that darwin_arm64/bin/ocamlopt.opt will not
103+
# run on an x86_64 machine.
104+
# The -adarwin_arm64 configuration is similar but has one important difference. The config will produce an x86_64
105+
# ocamlopt.opt, in the staging-files/darwin_x86_64 directory, and that ocamlopt.opt will create arm64 OCaml native
106+
# executables. But that darwin_x86_64/bin/ocamlopt.opt _will_ run on almost _all_ Apple Silicon (arm64) machines
107+
# because of Rosetta2. The only major exception is Opam CI has disabled Rosetta2 as of Nov 8, 2022.
108+
# Ideally we would have [-aHOST] and [-aHOST-TARGET]. That is: -adarwin_x86_64, -adarwin_arm64 and
109+
# -adarwin_x86_64-darwin_arm64. But that cross specification has ripple effects that needs time (technical debt) to
110+
# get right. Luckily our build machines are always Apple x86_64 (GitHub Actions and GitLab CI/CD), and even if the
111+
# build machines were Apple Silicon we typically only care about the generated artifacts (the target ABI).
112+
"-adarwin_x86_64=vendor/dkml-compiler/src/standard-compiler-env-to-ocaml-configure-env.sh" { os = "macos" & arch = "arm64" }
113+
"-adarwin_arm64=vendor/dkml-compiler/src/standard-compiler-env-to-ocaml-configure-env.sh" { os = "macos" & arch = "x86_64" }
114+
# For any non cross-compiling platforms we save time and space by
115+
# only building the runtime.
116+
"-r" { os = "win32" | (os = "linux" & (arch = "x86_32" | arch = "x86_64")) }
117+
]
118+
119+
# [1] Run r-c-ocaml-2-build_host-noargs.sh
120+
[
121+
"sh" "-eufc"
122+
"cd '%{_:share}%/staging-files' && echo 1 - host && share/dkml/repro/100co/vendor/dkml-compiler/src/r-c-ocaml-2-build_host-noargs.sh"
123+
]
124+
125+
# [1] Run r-c-ocaml-3-build_cross-noargs.sh if cross-compiling,
126+
# which will place its output into staging-files/<cross-abi>
127+
# (confer: "-g" "%{_:share}%/staging-files")
128+
[
129+
"sh" "-eufc"
130+
"cd '%{_:share}%/staging-files' && echo 1 - cross && share/dkml/repro/100co/vendor/dkml-compiler/src/r-c-ocaml-3-build_cross-noargs.sh"
131+
] { os = "macos" }
132+
133+
# --------------
134+
# Second pass
135+
# For platforms that can do multiple _host_ ABIs _without_ cross-compiling.
136+
# * MSVC can trivially do 32-bit and 64-bit without cross-compiling.
137+
# * Most often Linux can as well as long as `gcc -m32` is configured.
138+
# However for ease of use in GitHub Actions we expect Linux 32-bit and
139+
# Linux 64-bit to be done with different Opam switches.
140+
# --------------
141+
142+
# [2] Run r-c-ocaml-1-setup.sh
143+
[
144+
"env" "TOPDIR=dkmldir/vendor/drc/all/emptytop"
145+
"DKML_REPRODUCIBLE_SYSTEM_BREWFILE=%{_:build}%/Brewfile"
146+
"dkmldir/vendor/dkml-compiler/src/r-c-ocaml-1-setup.sh"
147+
"-d" "dkmldir"
148+
"-f" "src/ocaml-2"
149+
"-r" # Build runtime only
150+
"-k" "vendor/dkml-compiler/src/standard-compiler-env-to-ocaml-configure-env.sh"
151+
"-v" "dl/ocaml"
152+
# Host-compile into staging-files/<host-abi>
153+
"-t" "%{_:share}%/staging-files"
154+
"-pwindows_x86" { os = "win32" }
155+
# ABIs
156+
"-ewindows_x86" { os = "win32" }
157+
] { !(os = "macos") & !(os = "linux") }
158+
159+
# [2] Run r-c-ocaml-2-build_host-noargs.sh
160+
[
161+
"sh" "-eufc"
162+
"cd '%{_:share}%/staging-files' && echo 2 - host && share/dkml/repro/100co/vendor/dkml-compiler/src/r-c-ocaml-2-build_host-noargs.sh"
163+
] { !(os = "macos") & !(os = "linux") }
164+
165+
# --------------
166+
# Clean build files
167+
# --------------
168+
169+
[ "rm" "-rf" "%{_:share}%/staging-files/share" ]
170+
[ "rm" "-rf" "%{_:share}%/staging-files/src" ]
171+
]
172+
extra-source "dl/ocaml.tar.gz" {
173+
src: "https://github.com/ocaml/ocaml/archive/4.12.1.tar.gz"
174+
checksum: "sha256=f5a48a90557cb47ace7b1590fcab1362a1af38629a218350f69c225c57e96a41"
175+
}
176+
extra-source "dl/flexdll.tar.gz" {
177+
src: "https://github.com/alainfrisch/flexdll/archive/0.39.tar.gz"
178+
checksum: "sha256=51a6ef2e67ff475c33a76b3dc86401a0f286c9a3339ee8145053ea02d2fb5974"
179+
}
180+
extra-source "dl/homebrew-bundle.tar.gz" {
181+
src: "https://github.com/Homebrew/homebrew-bundle/archive/4756e4c4cf95485c5ea4da27375946c1dac2c71d.tar.gz"
182+
checksum: [
183+
"sha256=10c024ca7871cea36b4c27b2601971d3fa6cba6f37855613baf0026d0f555e76"
184+
]
185+
}
186+
extra-source "dl/dkml-compiler.tar.gz" {
187+
src: "https://github.com/diskuv/dkml-compiler/releases/download/4.12.1-v1.0.0/src.tar.gz"
188+
checksum: [
189+
"sha256=8beda92f97cde6d4a55a836ca6dc9f860bb5f1a6b765b80be4594943288571cf"
190+
]
191+
}
192+
extra-source "dl/dkml-runtime-common.tar.gz" {
193+
src: "https://github.com/diskuv/dkml-runtime-common/archive/refs/tags/v1.0.1.tar.gz"
194+
checksum: [
195+
"sha256=35a88827e3e02665a6ed5abf1c1aa457fbb3c2a78ff61c4211d24bec8d8b757d"
196+
]
197+
}
198+
extra-source "dl/dkml-runtime-distribution.tar.gz" {
199+
src: "https://github.com/diskuv/dkml-runtime-distribution/archive/refs/tags/v1.0.1.tar.gz"
200+
checksum: [
201+
"sha256=ffbdf2624e1fee38be7a218f497be9f660a4758e1ed5abf2ce937e0100e8d004"
202+
]
203+
}
204+
url {
205+
src:
206+
"https://github.com/diskuv/dkml-component-ocamlrun/releases/download/4.12.1-v1.0.2/dkml-component-staging-ocamlrun-4.12.1.v1.0.2.tbz"
207+
checksum: [
208+
"sha256=957c0117f17eb8cceef2ac696ec3b9b550fae38409fa5422186e9314a5717042"
209+
"sha512=0230cdc7cd66db0f59be5152324f0f9b5a2c5ecf00ca082998efb968f8ecd4c2ce5e9e8c56749e186038fee00ab295c0c2fb3f69dc6927044b73419ec350a3d8"
210+
]
211+
}
212+
x-commit-hash: "49033ffc7026cc4dcf4c81f0522b48766ced272f"

0 commit comments

Comments
 (0)