Skip to content

Commit

Permalink
Merge pull request ocaml#6189 from kit-ty-kate/win32-ocaml5
Browse files Browse the repository at this point in the history
Fix Windows builds with OCaml >= 5.0
  • Loading branch information
kit-ty-kate authored Sep 13, 2024
2 parents 291c276 + d35170c commit ba40b36
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 3 deletions.
42 changes: 41 additions & 1 deletion configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,12 @@ AS_CASE([${support_static},${enable_static}],
[no,yes],[AC_MSG_ERROR([--enable-static is not available on this platform (${TARGET}).])],
[*,auto],[enable_static=${default_static}])
AS_IF([test "${enable_static}" = yes],[
echo "(-noautolink -cclib -lunix -cclib -lmccs_stubs -cclib -lmccs_glpk_stubs -cclib -lsha_stubs ${platform_dependent_stuff})" > src/client/linking.sexp
AX_COMPARE_VERSION([$OCAMLVERSION], [lt], [5.0.0],[
unix_lib_name=unix
],[
unix_lib_name=unixnat
])
echo "(-noautolink -cclib -l${unix_lib_name} -cclib -lmccs_stubs -cclib -lmccs_glpk_stubs -cclib -lsha_stubs ${platform_dependent_stuff})" > src/client/linking.sexp
AC_MSG_RESULT([static])
],[
AC_MSG_RESULT([shared])
Expand Down
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ users)
* Bump the vendored opam-0install-cudf to 0.5.0 [#6130 @kit-ty-kate]
* Require opam-0install-cudf >= 0.5.0 [#6130 @kit-ty-kate]
* Bump the vendored mccs to 1.1+18 [#6170 @kit-ty-kate]
* Fix Windows builds with OCaml >= 5.0 [#6189 @kit-ty-kate - fix #6148]

## Infrastructure

Expand Down
2 changes: 1 addition & 1 deletion opam-core.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
homepage: "https://opam.ocaml.org"
bug-reports: "https://github.com/ocaml/opam/issues"
depends: [
"ocaml" {>= "4.08.0" & (os != "win32" | < "5.0")}
"ocaml" {>= "4.08.0"}
"base-unix"
"ocamlgraph"
"re" {>= "1.9.0"}
Expand Down
8 changes: 8 additions & 0 deletions src/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
(rule
(copy opamStubsTypes.ml opamStubsTypes.mli))

(rule
(enabled_if (< %{ocaml_version} "5.0"))
(action (copy# opamStubs.ocaml4.ml opamStubs.win32.ml)))

(rule
(enabled_if (>= %{ocaml_version} "5.0"))
(action (copy# opamStubs.ocaml5.ml opamStubs.win32.ml)))

(rule
(write-file opamCoreConfigDeveloper.ml
"let value = \"%{read-strings:developer}\""))
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions src/core/opamStubs.ocaml5.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(**************************************************************************)
(* *)
(* Copyright 2018 MetaStack Solutions Ltd. *)
(* *)
(* All rights reserved. This file is distributed under the terms of the *)
(* GNU Lesser General Public License version 2.1, with the special *)
(* exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)

include OpamStubsTypes
include OpamWin32Stubs
let getpid () = Int32.to_int (getCurrentProcessID ())

external win_create_process : string -> string -> string option ->
Unix.file_descr -> Unix.file_descr -> Unix.file_descr -> int
= "caml_unix_create_process" "caml_unix_create_process_native"

0 comments on commit ba40b36

Please sign in to comment.