From c2553e755a283354c0590cfc8478593435b410f1 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Sun, 2 Feb 2025 20:49:43 +0100 Subject: [PATCH] Fix genecodes_c on FreeBSD Unfortunately the existing CPATH/C_INCLUDE_PATH logic makes this a bit hard to generalize. --- docs/changelog.rst | 2 ++ setup.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 8320eae..20e7293 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,6 +8,8 @@ Changelog - Slightly faster reading of events. +- Fix build on FreeBSD. + 1.8.0 (Jan 25, 2025) ==================== diff --git a/setup.py b/setup.py index c5ab4a0..d255f4c 100755 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import sys import shutil import textwrap +import platform from pathlib import Path from subprocess import run @@ -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)]