Skip to content

Commit

Permalink
Fix genecodes_c on FreeBSD
Browse files Browse the repository at this point in the history
Unfortunately the existing CPATH/C_INCLUDE_PATH logic makes this a bit
hard to generalize.
  • Loading branch information
gvalkov committed Feb 2, 2025
1 parent ed39ab8 commit c2553e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Changelog

- Slightly faster reading of events.

- Fix build on FreeBSD.


1.8.0 (Jan 25, 2025)
====================
Expand Down
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import shutil
import textwrap
import platform
from pathlib import Path
from subprocess import run

Expand All @@ -24,8 +25,13 @@ def create_ecodes(headers=None):
if c_inc_path:
include_paths.update(c_inc_path.split(":"))

include_paths.add("/usr/include")
files = ["linux/input.h", "linux/input-event-codes.h", "linux/uinput.h"]
if platform.system().lower() == "freebsd":
include_paths.add("/usr/include/dev/evdev")
files = ["input.h", "input-event-codes.h", "uinput.h"]
else:
include_paths.add("/usr/include")
files = ["linux/input.h", "linux/input-event-codes.h", "linux/uinput.h"]

headers = [os.path.join(path, file) for path in include_paths for file in files]

headers = [header for header in headers if os.path.isfile(header)]
Expand Down

0 comments on commit c2553e7

Please sign in to comment.