Git Product home page Git Product logo

Comments (7)

Mjnd avatar Mjnd commented on July 18, 2024

I managed to solve the problem using a local (noindex) repository.
Interestingly, I had to include the package for hsc2hs in the repository (even if it was already installed in the system), to let it builds bindings-GLFW.
I haven't tested the bindings in my project, but I'm confident they will works.
Regarding the above suggestion, is it feasible?
If not, what is the rationale for not including that harmless (in my opinion) change?
Thank you and sorry for the noise, I should wait and think a little before reporting issues.

from bindings-glfw.

Mokosha avatar Mokosha commented on July 18, 2024

I think having different flavors of linux as part of the conditional for linux is fine. Feel free to submit a patch and I will review it.

from bindings-glfw.

Mjnd avatar Mjnd commented on July 18, 2024

The change highlighted above works only with the use of system glfw.
I'm now working on the proper OpenBSD support. Could you add me, in the meantime, to the contributors list, so when the patch will be ready, I'll be able to summit it? Thank you.

from bindings-glfw.

bsl avatar bsl commented on July 18, 2024

@Mjnd Hi, thanks for contributing. A cool way to collaborate is for you to clone this repo into your own account, and then make changes against that repo, which you of course have permissions over, and then submit a pull request back to here for the maintainers to review and possibly merge.

from bindings-glfw.

Mjnd avatar Mjnd commented on July 18, 2024

I managed to have the bundled glfw (v3.3.2) compile and work on OpenBSD.
OpenBSD doesn't support <sys/inotify.h> so I had to disable the compiling of linux_joystick.c (relying on inotify) and replace it with dummy functions, as it was done on previous versions of glfw (the code was hidden behind #if defined(__linux__) and #endif).

bindings-GLFW.cabal.diff

--- bindings-GLFW.cabal	Fri Feb 21 07:36:07 2020
+++ bindings-GLFW.cabal	Fri Jun  4 16:21:05 2021
@@ -133,11 +133,16 @@ library
       glfw/deps/glad_gl.c
       glfw/deps/glad_vulkan.c

-    if os(linux) || os(freebsd)
+    if os(linux) || os(freebsd) || os(openbsd)
+      if os(openbsd)
+        c-sources:
+          glfw/src/openbsd_joystick.c
+      else
+        c-sources:
+          glfw/src/linux_joystick.c
       c-sources:
         glfw/src/glx_context.c
         glfw/src/xkb_unicode.c
-        glfw/src/linux_joystick.c
         glfw/src/posix_time.c
         glfw/src/posix_thread.c
       if flag(X)

openbsd_joystick.c

#include "internal.h"

static void closeJoystick(_GLFWjoystick* js)
{
    _glfwFreeJoystick(js);
    _glfwInputJoystick(js, GLFW_DISCONNECTED);
}

GLFWbool _glfwInitJoysticksLinux(void)
{
    return GLFW_FALSE;
}

void _glfwTerminateJoysticksLinux(void) {}

void _glfwDetectJoystickConnectionLinux(void) {}

int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
{
    return GLFW_FALSE;
}

void _glfwPlatformUpdateGamepadGUID(char* guid) {}

If the patch is eligible, as I don't use git/github (except for bothering you), may I ask to relying on you to be committed? I don't want to lose time on a program which I'll use only once, and have to fight with its intricacies... I swear I won't bother you again for at least a year!
If the patch is wrong or not good enough, please tell me how it can be improved.
Thank you very much.

from bindings-glfw.

Mjnd avatar Mjnd commented on July 18, 2024

Actually you don't even need my openbsd_joystick.c, just copy null_joystick.c to openbsd_joystick.c.
If you know of a better way to replace linux_joystick.c with the content of null_joystick.c when compiling under OpenBSD, directly from bindings-GLFW.cabal, please go ahead.

from bindings-glfw.

Mjnd avatar Mjnd commented on July 18, 2024

Here I slightly better diff, which mimics what is done in CMakeLists.txt (not tested, I'm tired of this, but I'm sure it will work):

--- bindings-GLFW.cabal	Fri Feb 21 07:36:07 2020
+++ bindings-GLFW.cabal	Sun Jun  6 10:32:40 2021
@@ -133,11 +133,10 @@ library
       glfw/deps/glad_gl.c
       glfw/deps/glad_vulkan.c

-    if os(linux) || os(freebsd)
+    if os(linux) || os(freebsd) || os(openbsd)
       c-sources:
         glfw/src/glx_context.c
         glfw/src/xkb_unicode.c
-        glfw/src/linux_joystick.c
         glfw/src/posix_time.c
         glfw/src/posix_thread.c
       if flag(X)
@@ -146,12 +145,20 @@ library
           glfw/src/x11_init.c
           glfw/src/x11_monitor.c
           glfw/src/x11_window.c
+        if os(linux) || os(freebsd)
+          c-sources: glfw/src/linux_joystick.c
+        else
+          c-sources: glfw/src/null_joystick.c
       if flag(Wayland)
         cc-options: -DBINDINGS_GLFW_USE_WAYLAND -D_GLFW_WAYLAND
         c-sources:
           glfw/src/wl_init.c
           glfw/src/wl_monitor.c
           glfw/src/wl_window.c
+        if os(linux) || os(freebsd)
+          c-sources: glfw/src/linux_joystick.c
+        else
+          c-sources: glfw/src/null_joystick.c
       if flag(OSMesa)
         cc-options: -DBINDINGS_GLFW_USE_OSMESA -D_GLFW_OSMESA
         c-sources:

Since the modification is limited to bindings-GLFW.cabal, couldn't the hackage revision system be used?

Update: tested and working.

from bindings-glfw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.