Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows builds with OCaml >= 5.0 #6189

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -109,6 +109,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"
Loading