janet-lang / jaylib

Janet bindings to Raylib
MIT License
143 stars 37 forks source link

FreeBSD build possible, modifications needed #28

Open llmII opened 3 years ago

llmII commented 3 years ago

cflags, lflags, and defines need to be FreeBSD specific in this case:

diff --git a/project.janet b/project.janet
index 96e9e81..d954222 100644
--- a/project.janet
+++ b/project.janet
@@ -16,6 +16,7 @@
     :windows '["user32.lib" "gdi32.lib" "winmm.lib" "shell32.lib"]
     :macos '["-lpthread" "-framework" "Cocoa" "-framework" "CoreVideo" "-framework" "IOKit" "-framework" "OpenGL"]
     :linux '["-lpthread" "-lX11"]
+    :freebsd '["-L/usr/local/lib" "-lpthread" "-lX11"]
     #default
     '["-lpthread"]))

@@ -24,7 +25,7 @@

   :cflags [;default-cflags ;cflags]

-  :defines {"PLATFORM_DESKTOP" true "_POSIX_C_SOURCE" "200809L"}
+  :defines {"PLATFORM_DESKTOP" true } # "_POSIX_C_SOURCE" "200809L"}

   :source ["src/main.c"

@@ -47,6 +48,8 @@
             "src/shapes.h"
             "src/3d.h"]

+  :cflags [;default-cflags ;'["-I/usr/local/include"]]
+
   :lflags [;default-lflags ;lflags])

 # `jpm run repl` to run a repl with access to jaylib

That illustrates the changes necessary, however, is not fit for actual use (would probably break other platforms) so is mostly provided as documentation.

The other ordeal might be that the cflags, lflags, should be defaults under FreeBSD in jpm but am not sure if that is true or not. Depends on what those are under other platforms. The _POSIX_C_SOURCE define breaks soundcard.h on some platforms supposedly (currently on FreeBSD to our knowledge).