-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from MSoegtropIMC/fix-lablgtk-windows
Opam: fix new lablgtk versions on Windows
- Loading branch information
Showing
6 changed files
with
281 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...gtk3/lablgtk3.3.1.2/files/0001-Add-function-channel_of_descr_socket-windows-has-dif.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
From 7073b2644dacc8d43f1a0059d2166506fd46407f Mon Sep 17 00:00:00 2001 | ||
From: Michael Soegtrop <7895506+MSoegtropIMC@users.noreply.github.com> | ||
Date: Sat, 4 Jul 2020 21:31:23 +0200 | ||
Subject: [PATCH] Add function channel_of_descr_socket (windows has different | ||
handles for sockets and files) | ||
|
||
--- | ||
src/glib.ml | 2 ++ | ||
src/glib.mli | 1 + | ||
src/ml_glib.c | 18 +++++++++++++++++- | ||
3 files changed, 20 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/glib.ml b/src/glib.ml | ||
index 87bb4986..369ece6b 100644 | ||
--- a/src/glib.ml | ||
+++ b/src/glib.ml | ||
@@ -72,6 +72,8 @@ module Io = struct | ||
type id | ||
external channel_of_descr : Unix.file_descr -> channel | ||
= "ml_g_io_channel_unix_new" | ||
+ external channel_of_descr_socket : Unix.file_descr -> channel | ||
+ = "ml_g_io_channel_unix_new_socket" | ||
external remove : id -> unit = "ml_g_source_remove" | ||
external add_watch : | ||
cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id | ||
diff --git a/src/glib.mli b/src/glib.mli | ||
index 999bec12..92b0edd3 100644 | ||
--- a/src/glib.mli | ||
+++ b/src/glib.mli | ||
@@ -75,6 +75,7 @@ module Io : sig | ||
type condition = [ `ERR | `HUP | `IN | `NVAL | `OUT | `PRI] | ||
type id | ||
val channel_of_descr : Unix.file_descr -> channel | ||
+ val channel_of_descr_socket : Unix.file_descr -> channel | ||
val add_watch : | ||
cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id | ||
val remove : id -> unit | ||
diff --git a/src/ml_glib.c b/src/ml_glib.c | ||
index 070cd66d..db9c8332 100644 | ||
--- a/src/ml_glib.c | ||
+++ b/src/ml_glib.c | ||
@@ -25,6 +25,8 @@ | ||
#include <string.h> | ||
#include <locale.h> | ||
#ifdef _WIN32 | ||
+/* to kill a #warning: include winsock2.h before windows.h */ | ||
+#include <winsock2.h> | ||
#include "win32.h" | ||
#include <wtypes.h> | ||
#include <io.h> | ||
@@ -38,6 +40,11 @@ | ||
#include <caml/callback.h> | ||
#include <caml/threads.h> | ||
|
||
+#ifdef _WIN32 | ||
+/* for Socket_val */ | ||
+#include <caml/unixsupport.h> | ||
+#endif | ||
+ | ||
#include "wrappers.h" | ||
#include "ml_glib.h" | ||
#include "glib_tags.h" | ||
@@ -326,14 +333,23 @@ Make_Val_final_pointer_ext (GIOChannel, _noref, Ignore, g_io_channel_unref, 20) | ||
|
||
#ifndef _WIN32 | ||
ML_1 (g_io_channel_unix_new, Int_val, Val_GIOChannel_noref) | ||
+CAMLprim value ml_g_io_channel_unix_new_socket (value arg1) { | ||
+ return Val_GIOChannel_noref (g_io_channel_unix_new (Int_val (arg1))); | ||
+} | ||
|
||
#else | ||
CAMLprim value ml_g_io_channel_unix_new(value wh) | ||
{ | ||
return Val_GIOChannel_noref | ||
- (g_io_channel_unix_new | ||
+ (g_io_channel_win32_new_fd | ||
(_open_osfhandle((long)*(HANDLE*)Data_custom_val(wh), O_BINARY))); | ||
} | ||
+ | ||
+CAMLprim value ml_g_io_channel_unix_new_socket(value wh) | ||
+{ | ||
+ return Val_GIOChannel_noref | ||
+ (g_io_channel_win32_new_socket(Socket_val(wh))); | ||
+} | ||
#endif | ||
|
||
static gboolean ml_g_io_channel_watch(GIOChannel *s, GIOCondition c, | ||
-- | ||
2.27.0 | ||
|
8 changes: 8 additions & 0 deletions
8
opam/opam-repository/packages/lablgtk3/lablgtk3.3.1.2/files/dune-project.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
diff --git a/dune-project b/dune-project | ||
index 389cd199..da00e4e1 100644 | ||
--- a/dune-project | ||
+++ b/dune-project | ||
@@ -1,2 +1,3 @@ | ||
(lang dune 1.8) | ||
(name lablgtk3) | ||
+(version 3.1.2) |
44 changes: 44 additions & 0 deletions
44
opam/opam-repository/packages/lablgtk3/lablgtk3.3.1.2/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
opam-version: "2.0" | ||
|
||
synopsis: "OCaml interface to GTK+3" | ||
description: """ | ||
OCaml interface to GTK+3 | ||
|
||
See https://garrigue.github.io/lablgtk/ for more information. | ||
""" | ||
|
||
maintainer: "garrigue@math.nagoya-u.ac.jp" | ||
authors: ["Jacques Garrigue et al., Nagoya University"] | ||
homepage: "https://github.com/garrigue/lablgtk" | ||
bug-reports: "https://github.com/garrigue/lablgtk/issues" | ||
dev-repo: "git+https://github.com/garrigue/lablgtk.git" | ||
license: "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception" | ||
doc: "https://garrigue.github.io/lablgtk/lablgtk3" | ||
|
||
depends: [ | ||
"ocaml" { >= "4.09.0" } | ||
"dune" { >= "1.8.0" } | ||
"cairo2" { >= "0.6" } | ||
"conf-gtk3" { build & >= "18" } | ||
] | ||
conflicts: [ | ||
"base-domains" | ||
] | ||
patches: [ | ||
"dune-project.patch" | ||
"0001-Add-function-channel_of_descr_socket-windows-has-dif.patch" | ||
] | ||
|
||
build: [ | ||
[ "dune" "build" "-p" name "-j" jobs ] | ||
] | ||
run-test: [ | ||
["dune" "build" "-p" name "-j" jobs "examples/buttons.exe"] | ||
] | ||
url { | ||
src: | ||
"https://github.com/garrigue/lablgtk/archive/3.1.2.tar.gz" | ||
checksum: [ | ||
"md5=e991d9419a722fc513f4b4878e8c2cbe" | ||
] | ||
} |
90 changes: 90 additions & 0 deletions
90
...gtk3/lablgtk3.3.1.3/files/0001-Add-function-channel_of_descr_socket-windows-has-dif.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
From 7073b2644dacc8d43f1a0059d2166506fd46407f Mon Sep 17 00:00:00 2001 | ||
From: Michael Soegtrop <7895506+MSoegtropIMC@users.noreply.github.com> | ||
Date: Sat, 4 Jul 2020 21:31:23 +0200 | ||
Subject: [PATCH] Add function channel_of_descr_socket (windows has different | ||
handles for sockets and files) | ||
|
||
--- | ||
src/glib.ml | 2 ++ | ||
src/glib.mli | 1 + | ||
src/ml_glib.c | 18 +++++++++++++++++- | ||
3 files changed, 20 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/glib.ml b/src/glib.ml | ||
index 87bb4986..369ece6b 100644 | ||
--- a/src/glib.ml | ||
+++ b/src/glib.ml | ||
@@ -72,6 +72,8 @@ module Io = struct | ||
type id | ||
external channel_of_descr : Unix.file_descr -> channel | ||
= "ml_g_io_channel_unix_new" | ||
+ external channel_of_descr_socket : Unix.file_descr -> channel | ||
+ = "ml_g_io_channel_unix_new_socket" | ||
external remove : id -> unit = "ml_g_source_remove" | ||
external add_watch : | ||
cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id | ||
diff --git a/src/glib.mli b/src/glib.mli | ||
index 999bec12..92b0edd3 100644 | ||
--- a/src/glib.mli | ||
+++ b/src/glib.mli | ||
@@ -75,6 +75,7 @@ module Io : sig | ||
type condition = [ `ERR | `HUP | `IN | `NVAL | `OUT | `PRI] | ||
type id | ||
val channel_of_descr : Unix.file_descr -> channel | ||
+ val channel_of_descr_socket : Unix.file_descr -> channel | ||
val add_watch : | ||
cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id | ||
val remove : id -> unit | ||
diff --git a/src/ml_glib.c b/src/ml_glib.c | ||
index 070cd66d..db9c8332 100644 | ||
--- a/src/ml_glib.c | ||
+++ b/src/ml_glib.c | ||
@@ -25,6 +25,8 @@ | ||
#include <string.h> | ||
#include <locale.h> | ||
#ifdef _WIN32 | ||
+/* to kill a #warning: include winsock2.h before windows.h */ | ||
+#include <winsock2.h> | ||
#include "win32.h" | ||
#include <wtypes.h> | ||
#include <io.h> | ||
@@ -38,6 +40,11 @@ | ||
#include <caml/callback.h> | ||
#include <caml/threads.h> | ||
|
||
+#ifdef _WIN32 | ||
+/* for Socket_val */ | ||
+#include <caml/unixsupport.h> | ||
+#endif | ||
+ | ||
#include "wrappers.h" | ||
#include "ml_glib.h" | ||
#include "glib_tags.h" | ||
@@ -326,14 +333,23 @@ Make_Val_final_pointer_ext (GIOChannel, _noref, Ignore, g_io_channel_unref, 20) | ||
|
||
#ifndef _WIN32 | ||
ML_1 (g_io_channel_unix_new, Int_val, Val_GIOChannel_noref) | ||
+CAMLprim value ml_g_io_channel_unix_new_socket (value arg1) { | ||
+ return Val_GIOChannel_noref (g_io_channel_unix_new (Int_val (arg1))); | ||
+} | ||
|
||
#else | ||
CAMLprim value ml_g_io_channel_unix_new(value wh) | ||
{ | ||
return Val_GIOChannel_noref | ||
- (g_io_channel_unix_new | ||
+ (g_io_channel_win32_new_fd | ||
(_open_osfhandle((long)*(HANDLE*)Data_custom_val(wh), O_BINARY))); | ||
} | ||
+ | ||
+CAMLprim value ml_g_io_channel_unix_new_socket(value wh) | ||
+{ | ||
+ return Val_GIOChannel_noref | ||
+ (g_io_channel_win32_new_socket(Socket_val(wh))); | ||
+} | ||
#endif | ||
|
||
static gboolean ml_g_io_channel_watch(GIOChannel *s, GIOCondition c, | ||
-- | ||
2.27.0 | ||
|
45 changes: 45 additions & 0 deletions
45
opam/opam-repository/packages/lablgtk3/lablgtk3.3.1.3/opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
opam-version: "2.0" | ||
|
||
synopsis: "OCaml interface to GTK+3" | ||
description: """ | ||
OCaml interface to GTK+3 | ||
|
||
See https://garrigue.github.io/lablgtk/ for more information. | ||
""" | ||
|
||
maintainer: "garrigue@math.nagoya-u.ac.jp" | ||
authors: ["Jacques Garrigue et al., Nagoya University"] | ||
homepage: "https://github.com/garrigue/lablgtk" | ||
bug-reports: "https://github.com/garrigue/lablgtk/issues" | ||
dev-repo: "git+https://github.com/garrigue/lablgtk.git" | ||
license: "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception" | ||
doc: "https://garrigue.github.io/lablgtk/lablgtk3/lablgtk3" | ||
|
||
depends: [ | ||
"ocaml" { >= "4.09.0" } | ||
"dune" { >= "1.8.0" } | ||
"cairo2" { >= "0.6" } | ||
"conf-gtk3" { build & >= "18" } | ||
"camlp-streams" { build } | ||
"ocamlfind" { dev } | ||
"camlp5" { dev } | ||
] | ||
patches: [ | ||
"0001-Add-function-channel_of_descr_socket-windows-has-dif.patch" | ||
] | ||
|
||
build: [ | ||
[ "dune" "build" "-p" name "-j" jobs ] | ||
] | ||
run-test: [ | ||
[ "dune" "build" "-p" name "-j" jobs "examples/buttons.exe" ] | ||
] | ||
url { | ||
src: | ||
"https://github.com/garrigue/lablgtk/releases/download/3.1.3/lablgtk3-3.1.3.tbz" | ||
checksum: [ | ||
"sha256=786ae7fa15ce166ef85515eda86bb4b258f47cdc1d712d850bb9440a510021c6" | ||
"sha512=bfa0f351c18eff7c8bd79e9c7c533bc5e8882784d239ce3a3b71c0d50f647538f5d002e456a41969badbdfe07f0a9697c43850ebe3b372c147297690e7ee1c60" | ||
] | ||
} | ||
x-commit-hash: "8a803575ded8107a063a8779c47ca79310de90bc" |