Skip to content

Commit c1f8192

Browse files
committed
Rework Cygwin package list needed for opam and OCaml for Windows
mingw images also don't need msvs-tools.
1 parent a6eefe6 commit c1f8192

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

src-opam/opam.ml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -431,22 +431,24 @@ let windows_mingw_opam2 ?win10_revision ?winget ?(labels = []) ?arch
431431
install_winget ?win10_revision ?winget version
432432
in
433433
let opams_image =
434+
let packages =
435+
(* dra27: we only need g++ in the "builder" image so that
436+
opam-putenv gets built properly and so that opam is built
437+
with the internal solver as well *)
438+
"mingw64-x86_64-gcc-g++" :: "mingw64-i686-gcc-g++"
439+
:: Windows.Cygwin.mingw_packages
440+
in
434441
Windows.header ~alias:"opam-builder" ?win10_revision ~version ()
435442
@@ Windows.sanitize_reg_path ()
436-
@@ Windows.Cygwin.(
437-
install_cygwin
438-
~extra:
439-
("git" :: "patch" :: "mingw64-x86_64-gcc-g++"
440-
:: "mingw64-i686-gcc-g++" :: mingw_packages)
441-
())
443+
@@ Windows.Cygwin.install_cygwin ~extra:packages ()
442444
@@ install_opams_windows opam_master_hash opam_branches
443445
in
444446
(* 2022-10-12: Docker Engine 20.10.18 on Windows fails copying
445447
C:\cygwin64, so we cannot build Cygwin in a separate image. *)
446448
let ocaml_for_windows =
447-
let extra = Windows.Cygwin.mingw_packages in
448-
let extra, pkgs = Windows.Cygwin.ocaml_for_windows_packages ~extra () in
449-
Windows.Cygwin.install_cygwin ~msvs_tools:true ~extra () @@ pkgs
449+
let packages, setup = Windows.Cygwin.install_ocaml_for_windows () in
450+
let packages = Windows.Cygwin.mingw_packages @ packages in
451+
Windows.Cygwin.install_cygwin ~extra:packages () @@ setup
450452
in
451453
parser_directive (`Escape '`')
452454
@@ comment "Autogenerated by OCaml-Dockerfile scripts"
@@ -483,17 +485,18 @@ let windows_msvc_opam2 ?win10_revision ?winget ?(labels = []) ~opam_hashes
483485
(* 2022-10-12: Docker Engine 20.10.18 on Windows fails copying
484486
C:\cygwin64, so we cannot build Cygwin in a separate image. *)
485487
let ocaml_for_windows =
486-
let extra, vs_build_tools =
488+
let packages, vs_build_tools =
487489
( Windows.Cygwin.msvc_packages,
488490
Windows.install_visual_studio_build_tools
489491
[
490492
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64";
491493
"Microsoft.VisualStudio.Component.Windows10SDK.18362";
492494
] )
493495
in
494-
let extra, pkgs = Windows.Cygwin.ocaml_for_windows_packages ~extra () in
495-
Windows.Cygwin.install_cygwin ~msvs_tools:true ~extra ()
496-
@@ vs_build_tools @@ pkgs
496+
let ofw_packages, ofw_setup = Windows.Cygwin.install_ocaml_for_windows () in
497+
Windows.Cygwin.install_cygwin ~msvs_tools:true
498+
~extra:(packages @ ofw_packages) ()
499+
@@ vs_build_tools @@ ofw_setup
497500
in
498501
parser_directive (`Escape '`')
499502
@@ comment "Autogenerated by OCaml-Dockerfile scripts"

src-opam/windows.ml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,24 @@ module Cygwin = struct
249249
"flexdll=" ^ flexdll_version;
250250
]
251251

252-
let mingw_packages = [ "make"; "diffutils"; "mingw64-x86_64-gcc-core" ]
253-
let msvc_packages = [ "make"; "diffutils" ]
252+
let mingw_packages =
253+
[ "make"; "diffutils"; "patch"; "mingw64-x86_64-gcc-core"; "git" ]
254254

255-
let ocaml_for_windows_packages ?cyg ?(extra = []) ?(version = "0.0.0.2") () =
255+
let msvc_packages = [ "make"; "diffutils"; "patch"; "git" ]
256+
257+
let install_ocaml_for_windows ?cyg ?(version = "0.0.0.2") () =
256258
let packages =
257-
"make" :: "diffutils" :: "mingw64-x86_64-gcc-g++" :: "vim" :: "git"
258-
:: "curl" :: "rsync" :: "unzip" :: "patch" :: "m4" :: extra
259+
[
260+
"rsync";
261+
"patch";
262+
"diffutils";
263+
"curl";
264+
"make";
265+
"unzip";
266+
"git";
267+
"m4";
268+
"perl";
269+
]
259270
in
260271
let t =
261272
add

src-opam/windows.mli

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ module Cygwin : sig
122122
(** [msvc_packages] is the list of base development tools for the
123123
Caml MSVC port. *)
124124

125-
val ocaml_for_windows_packages :
126-
?cyg:cyg -> ?extra:string list -> ?version:string -> unit -> string list * t
127-
(** [ocaml_for_windows_packages ?extra ()] returns the list of
128-
Cygwin packages dependencies, and the installation instructions.
129-
Extra packages may also be optionally supplied via [extra].
125+
val install_ocaml_for_windows :
126+
?cyg:cyg -> ?version:string -> unit -> string list * t
127+
(** [install_ocaml_for_windows ()] returns the list of Cygwin
128+
packages dependencies, and the installation instructions for
129+
OCaml for Windows.
130130
@see <https://fdopen.github.io/opam-repository-mingw/> *)
131131

132132
val run_sh : ?cyg:cyg -> ('a, unit, string, t) format4 -> 'a

0 commit comments

Comments
 (0)