Skip to content

Commit 0f3fb2e

Browse files
committed
Distinguish msys and other mingw environments
1 parent 53a9847 commit 0f3fb2e

File tree

7 files changed

+109
-42
lines changed

7 files changed

+109
-42
lines changed

dune-project

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
(lang dune 3.17)
1+
(lang dune 3.20)
2+
23
(using ctypes 0.3)
34

45
(name raylib)
56

67
(generate_opam_files true)
78

8-
(source (github tjammer/raylib-ocaml))
9+
(source
10+
(github tjammer/raylib-ocaml))
11+
912
(license MIT)
13+
1014
(authors "Tobias Mock")
15+
1116
(maintainers "[email protected]")
1217

1318
(package
@@ -16,52 +21,66 @@
1621
(description "OCaml bindings for raylib")
1722
(synopsis "OCaml bindings for raylib")
1823
(depends
19-
(ocaml (>= 4.08.0))
20-
(dune (>= 3.17))
21-
dune-configurator
22-
(ctypes (>= 0.14))
23-
(integers (>= 0.5))
24-
(patch (>= 3.0.0))
25-
(conf-mesa (or (= :os linux) (= :os-family bsd)))
26-
(conf-libxcursor (or (= :os linux) (= :os-family bsd)))
27-
(conf-libxi (or (= :os linux) (= :os-family bsd)))
28-
(conf-libxinerama (or (= :os linux) (= :os-family bsd)))
29-
(conf-libxrandr (or (= :os linux) (= :os-family bsd)))))
24+
(ocaml
25+
(>= 4.08.0))
26+
(dune
27+
(>= 3.20))
28+
dune-configurator
29+
(ctypes
30+
(>= 0.14))
31+
(integers
32+
(>= 0.5))
33+
(patch
34+
(>= 3.0.0))
35+
(conf-mesa
36+
(or
37+
(= :os linux)
38+
(= :os-family bsd)))
39+
(conf-libxcursor
40+
(or
41+
(= :os linux)
42+
(= :os-family bsd)))
43+
(conf-libxi
44+
(or
45+
(= :os linux)
46+
(= :os-family bsd)))
47+
(conf-libxinerama
48+
(or
49+
(= :os linux)
50+
(= :os-family bsd)))
51+
(conf-libxrandr
52+
(or
53+
(= :os linux)
54+
(= :os-family bsd)))))
3055

3156
(package
3257
(name raygui)
3358
(version 1.5.0)
3459
(description "OCaml bindings for raygui")
3560
(synopsis "OCaml bindings for raygui")
3661
(depends
37-
(ocaml (>= 4.05))
38-
(dune (>= 3.17))
39-
dune-configurator
40-
(ctypes (>= 0.14))
41-
(raylib (= :version))
42-
(patch (>= 3.0.0))))
62+
(raylib
63+
(= :version))))
4364

4465
(package
4566
(name raylib-callbacks)
4667
(version 1.5.0)
4768
(description "OCaml bindings for raygui")
4869
(synopsis "OCaml bindings for raygui")
4970
(depends
50-
(ocaml (>= 4.05))
51-
(dune (>= 3.17))
52-
dune-configurator
53-
(ctypes (>= 0.14))
54-
(ctypes-foreign (>= 0.14))
55-
(raylib (= :version))))
71+
(ctypes-foreign
72+
(>= 0.14))
73+
(raylib
74+
(= :version))))
5675

5776
(package
5877
(name raylib-gen)
5978
(version 0.1.0)
6079
(description "Binding generation for raylib")
6180
(synopsis "Binding generation for raylib")
6281
(depends
63-
(ocaml (>= 4.08.0))
64-
(dune (>= 3.17))
65-
yojson
66-
re
67-
containers))
82+
(ocaml
83+
(>= 4.08.0))
84+
yojson
85+
re
86+
containers))

raygui.opam

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ license: "MIT"
99
homepage: "https://github.com/tjammer/raylib-ocaml"
1010
bug-reports: "https://github.com/tjammer/raylib-ocaml/issues"
1111
depends: [
12-
"ocaml" {>= "4.05"}
13-
"dune" {>= "3.17" & >= "3.17"}
14-
"dune-configurator"
15-
"ctypes" {>= "0.14"}
12+
"dune" {>= "3.20"}
1613
"raylib" {= version}
17-
"patch" {>= "3.0.0"}
1814
"odoc" {with-doc}
1915
]
2016
build: [
@@ -32,6 +28,7 @@ build: [
3228
]
3329
]
3430
dev-repo: "git+https://github.com/tjammer/raylib-ocaml.git"
31+
x-maintenance-intent: ["(latest)"]
3532
available: [arch != "arm32" & arch != "ppc64"]
3633
x-ci-accept-failures: [
3734
"centos-7" # C compiler is too old

raylib-callbacks.opam

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ license: "MIT"
99
homepage: "https://github.com/tjammer/raylib-ocaml"
1010
bug-reports: "https://github.com/tjammer/raylib-ocaml/issues"
1111
depends: [
12-
"ocaml" {>= "4.05"}
13-
"dune" {>= "3.17" & >= "3.17"}
14-
"dune-configurator"
15-
"ctypes" {>= "0.14"}
12+
"dune" {>= "3.20"}
1613
"ctypes-foreign" {>= "0.14"}
1714
"raylib" {= version}
1815
"odoc" {with-doc}
@@ -32,3 +29,4 @@ build: [
3229
]
3330
]
3431
dev-repo: "git+https://github.com/tjammer/raylib-ocaml.git"
32+
x-maintenance-intent: ["(latest)"]

raylib-gen.opam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ license: "MIT"
99
homepage: "https://github.com/tjammer/raylib-ocaml"
1010
bug-reports: "https://github.com/tjammer/raylib-ocaml/issues"
1111
depends: [
12+
"dune" {>= "3.20"}
1213
"ocaml" {>= "4.08.0"}
13-
"dune" {>= "3.17" & >= "3.17"}
1414
"yojson"
1515
"re"
1616
"containers"
@@ -31,3 +31,4 @@ build: [
3131
]
3232
]
3333
dev-repo: "git+https://github.com/tjammer/raylib-ocaml.git"
34+
x-maintenance-intent: ["(latest)"]

raylib.opam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ homepage: "https://github.com/tjammer/raylib-ocaml"
1010
bug-reports: "https://github.com/tjammer/raylib-ocaml/issues"
1111
depends: [
1212
"ocaml" {>= "4.08.0"}
13-
"dune" {>= "3.17" & >= "3.17"}
13+
"dune" {>= "3.20" & >= "3.20"}
1414
"dune-configurator"
1515
"ctypes" {>= "0.14"}
1616
"integers" {>= "0.5"}
@@ -37,6 +37,7 @@ build: [
3737
]
3838
]
3939
dev-repo: "git+https://github.com/tjammer/raylib-ocaml.git"
40+
x-maintenance-intent: ["(latest)"]
4041
available: [arch != "arm32" & arch != "ppc64"]
4142
x-ci-accept-failures: [
4243
"centos-7" # C compiler is too old

src/c/dune

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
(alias build-raylib)
6767
(targets libraylib.a dllraylib.dll)
6868
(enabled_if
69-
(= %{system} mingw64))
69+
(and
70+
(= %{system} mingw64)
71+
(<> %{os_distribution} msys2)))
7072
(deps
7173
(source_tree vendor/raylib)
7274
enable_formats.patch
@@ -86,6 +88,32 @@
8688
(run make -C vendor/raylib/src RAYLIB_LIBTYPE=SHARED -j 8)
8789
(copy vendor/raylib/src/raylib.dll dllraylib.dll)))))
8890

91+
(rule
92+
(alias build-raylib)
93+
(targets libraylib.a dllraylib.dll)
94+
(enabled_if
95+
(and
96+
(= %{system} mingw64)
97+
(= %{os_distribution} msys2)))
98+
(deps
99+
(source_tree vendor/raylib)
100+
enable_formats.patch
101+
msys2.patch
102+
apply_patch.exe
103+
chmodx.exe)
104+
(action
105+
(no-infer
106+
(progn
107+
(run ./chmodx.exe vendor/raylib/src/config.h)
108+
(run ./apply_patch.exe enable_formats.patch)
109+
(run ./chmodx.exe vendor/raylib/src/Makefile)
110+
(run ./apply_patch.exe msys2.patch)
111+
(run make -C vendor/raylib/src RAYLIB_LIBTYPE=STATIC -j 8)
112+
(copy vendor/raylib/src/libraylib.a libraylib.a)
113+
(run make -C vendor/raylib/src clean)
114+
(run make -C vendor/raylib/src RAYLIB_LIBTYPE=SHARED -j 8)
115+
(copy vendor/raylib/src/raylib.dll dllraylib.dll)))))
116+
89117
(rule
90118
(alias build-raylib)
91119
(targets libraylib.a dllraylib.so)

src/c/msys2.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff --git a/vendor/raylib/src/Makefile b/vendor/raylib/src/Makefile
2+
index 7dde52fb..9df71f4f 100644
3+
--- a/vendor/raylib/src/Makefile
4+
+++ b/vendor/raylib/src/Makefile
5+
@@ -266,8 +266,8 @@ endif
6+
7+
# Define default C compiler and archiver to pack library: CC, AR
8+
#------------------------------------------------------------------------------------------------
9+
-CC = gcc
10+
+CC = x86_64-w64-mingw32-gcc
11+
AR = ar
12+
13+
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
14+
ifeq ($(PLATFORM_OS),OSX)
15+
@@ -669,7 +669,7 @@ else
16+
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
17+
ifeq ($(PLATFORM_OS),WINDOWS)
18+
# NOTE: Linking with provided resource file
19+
- $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS)
20+
+ $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(LDFLAGS) $(LDLIBS)
21+
@echo "raylib dynamic library ($(RAYLIB_LIB_NAME).dll) and import library (lib$(RAYLIB_LIB_NAME)dll.a) generated!"
22+
endif
23+
ifeq ($(PLATFORM_OS),LINUX)

0 commit comments

Comments
 (0)