From 9c1eaaa4b267a402148f4532eb97573a57cce48e Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 3 Apr 2026 22:54:48 -0700 Subject: [PATCH] build: Migrate includes to use libx52/ prefix As part of the refactor, have the sources include the public headers via the libx52 prefix, instead of relying on the include directories approach in meson.build --- .gitignore | 1 + Doxyfile.in | 4 +++- bugreport/bugreport.c | 2 +- cli/test_x52_cli.c | 2 +- cli/x52_cli.c | 2 +- daemon/x52ctl.c | 2 +- daemon/x52d_comm_client.c | 2 +- daemon/x52d_config.h | 2 +- daemon/x52d_config_dump.c | 2 +- daemon/x52d_device.c | 2 +- daemon/x52d_device.h | 2 +- daemon/x52d_io.c | 2 +- daemon/x52d_main.c | 2 +- daemon/x52d_mouse.h | 2 +- daemon/x52d_mouse_handler.c | 4 ++-- daemon/x52d_notify.c | 2 +- docs/integration.dox | 2 +- docs/main.dox | 10 +++++----- evtest/ev_test.c | 2 +- joytest/x52_test.c | 2 +- joytest/x52_test_clock.c | 2 +- joytest/x52_test_common.h | 2 +- joytest/x52_test_led.c | 2 +- joytest/x52_test_mfd.c | 2 +- libx52/libx52io.h | 1 + libx52/libx52util.h | 1 + libx52/test_strings.c | 2 +- libx52/x52_common.h | 2 +- libx52/x52_control.c | 2 +- libx52/x52_core.c | 2 +- libx52/x52_date_time.c | 2 +- libx52/x52_strerror.c | 2 +- libx52/x52_stringify.c | 2 +- libx52/x52dcomm.h | 1 + libx52io/io_common.h | 2 +- libx52io/io_strings.c | 2 +- libx52io/test_io_strings.c | 2 +- libx52util/x52_char_map_lookup.c | 2 +- libx52util/x52_char_map_test.c | 2 +- meson.build | 2 +- vkm/test_strerror.c | 2 +- vkm/vkm-internal.h | 2 +- vkm/vkm_stub.c | 2 +- 43 files changed, 50 insertions(+), 44 deletions(-) create mode 120000 libx52/libx52io.h create mode 120000 libx52/libx52util.h create mode 120000 libx52/x52dcomm.h diff --git a/.gitignore b/.gitignore index 16f9b0a..a4d1982 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ libx52util/util_char_map.c udev/*.rules x52d* !daemon/x52d*.* +!libx52/x52dcomm.h test-* libx52-*.tar.gz diff --git a/Doxyfile.in b/Doxyfile.in index b58e35c..d6fa2fd 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -1021,7 +1021,9 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = */libx52/libx52io.h \ + */libx52/libx52util.h \ + */libx52/x52dcomm.h # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/bugreport/bugreport.c b/bugreport/bugreport.c index 3e1ce7a..c77aa99 100644 --- a/bugreport/bugreport.c +++ b/bugreport/bugreport.c @@ -14,7 +14,7 @@ #include "libusb.h" #include "hidapi.h" -#include "libx52io.h" +#include #include "version-info.h" static void print_sysinfo(void) diff --git a/cli/test_x52_cli.c b/cli/test_x52_cli.c index 4aee744..cea227e 100644 --- a/cli/test_x52_cli.c +++ b/cli/test_x52_cli.c @@ -12,7 +12,7 @@ #include #include -#include "libx52.h" +#include extern int run_main(int argc, char **argv); diff --git a/cli/x52_cli.c b/cli/x52_cli.c index d44365a..afbb582 100644 --- a/cli/x52_cli.c +++ b/cli/x52_cli.c @@ -158,7 +158,7 @@ possibly through \b sudo(8) #include #include -#include "libx52.h" +#include struct string_map { const char *key; diff --git a/daemon/x52ctl.c b/daemon/x52ctl.c index a948752..78f88b7 100644 --- a/daemon/x52ctl.c +++ b/daemon/x52ctl.c @@ -49,7 +49,7 @@ string "quit", or terminates input by using Ctrl+D. #include #include "x52d_const.h" -#include "x52dcomm.h" +#include #define APP_NAME "x52ctl" #if HAVE_FUNC_ATTRIBUTE_NORETURN diff --git a/daemon/x52d_comm_client.c b/daemon/x52d_comm_client.c index 0a40c18..0576483 100644 --- a/daemon/x52d_comm_client.c +++ b/daemon/x52d_comm_client.c @@ -15,7 +15,7 @@ #include #include -#include "x52dcomm.h" +#include #include "x52dcomm-internal.h" static int _setup_socket(struct sockaddr_un *remote, int len) diff --git a/daemon/x52d_config.h b/daemon/x52d_config.h index 930f16c..d6ba410 100644 --- a/daemon/x52d_config.h +++ b/daemon/x52d_config.h @@ -12,7 +12,7 @@ #include #include #include -#include "libx52.h" +#include /** * @brief Configuration structure diff --git a/daemon/x52d_config_dump.c b/daemon/x52d_config_dump.c index ef68c83..9f73c08 100644 --- a/daemon/x52d_config_dump.c +++ b/daemon/x52d_config_dump.c @@ -16,7 +16,7 @@ #define PINELOG_MODULE X52D_MOD_CONFIG #include "pinelog.h" -#include "libx52.h" +#include #include "x52d_config.h" #include "x52d_const.h" diff --git a/daemon/x52d_device.c b/daemon/x52d_device.c index 7347abb..3ffb221 100644 --- a/daemon/x52d_device.c +++ b/daemon/x52d_device.c @@ -16,7 +16,7 @@ #include "x52d_config.h" #include "x52d_device.h" #include "x52d_notify.h" -#include "libx52.h" +#include #include "pinelog.h" static libx52_device *x52_dev; diff --git a/daemon/x52d_device.h b/daemon/x52d_device.h index e7f024c..f3907cd 100644 --- a/daemon/x52d_device.h +++ b/daemon/x52d_device.h @@ -9,7 +9,7 @@ #ifndef X52D_DEVICE_H #define X52D_DEVICE_H -#include "libx52.h" +#include void x52d_dev_init(void); void x52d_dev_exit(void); diff --git a/daemon/x52d_io.c b/daemon/x52d_io.c index b23c866..f579a60 100644 --- a/daemon/x52d_io.c +++ b/daemon/x52d_io.c @@ -15,7 +15,7 @@ #include "x52d_config.h" #include "x52d_io.h" #include "x52d_mouse.h" -#include "libx52io.h" +#include #define PINELOG_MODULE X52D_MOD_IO #include "pinelog.h" diff --git a/daemon/x52d_main.c b/daemon/x52d_main.c index 64867e9..d2415fd 100644 --- a/daemon/x52d_main.c +++ b/daemon/x52d_main.c @@ -26,7 +26,7 @@ #include "x52d_command.h" #include "x52d_notify.h" #include "x52dcomm-internal.h" -#include "x52dcomm.h" +#include #include "pinelog.h" static volatile int flag_quit; diff --git a/daemon/x52d_mouse.h b/daemon/x52d_mouse.h index d0f733c..e9025c7 100644 --- a/daemon/x52d_mouse.h +++ b/daemon/x52d_mouse.h @@ -10,7 +10,7 @@ #define X52D_MOUSE_H #include -#include "libx52io.h" +#include extern volatile bool mouse_isometric_mode; extern volatile int mouse_scroll_dir; diff --git a/daemon/x52d_mouse_handler.c b/daemon/x52d_mouse_handler.c index b91c6ce..0e24204 100644 --- a/daemon/x52d_mouse_handler.c +++ b/daemon/x52d_mouse_handler.c @@ -13,8 +13,8 @@ #include #include -#include "libx52io.h" -#include "vkm.h" +#include +#include #define PINELOG_MODULE X52D_MOD_MOUSE #include "pinelog.h" diff --git a/daemon/x52d_notify.c b/daemon/x52d_notify.c index 4853bd8..dbcf93f 100644 --- a/daemon/x52d_notify.c +++ b/daemon/x52d_notify.c @@ -16,7 +16,7 @@ #include "x52d_const.h" #include "x52d_notify.h" #include "x52d_client.h" -#include "x52dcomm.h" +#include #include "x52dcomm-internal.h" static pthread_t notify_thr; diff --git a/docs/integration.dox b/docs/integration.dox index 53ace1c..4b29ba4 100644 --- a/docs/integration.dox +++ b/docs/integration.dox @@ -11,7 +11,7 @@ to a supported joystick. This function must be called after \ref libx52_init Example Initialization/Deinitialization Code @code{.c} -#include +#include libx52_device* init_libx52(void) { diff --git a/docs/main.dox b/docs/main.dox index fd2a4e4..9729476 100644 --- a/docs/main.dox +++ b/docs/main.dox @@ -45,10 +45,10 @@ with your application. See the documentation for the following files for a complete list of all functions. -- libx52.h -- libx52io.h -- libx52util.h -- vkm.h -- x52dcomm.h +- libx52/libx52.h +- libx52/libx52io.h +- libx52/libx52util.h +- vkm/vkm.h +- libx52/x52dcomm.h */ diff --git a/evtest/ev_test.c b/evtest/ev_test.c index 76fb607..201b8f9 100644 --- a/evtest/ev_test.c +++ b/evtest/ev_test.c @@ -17,7 +17,7 @@ #include #include -#include "libx52io.h" +#include #include "gettext.h" /* diff --git a/joytest/x52_test.c b/joytest/x52_test.c index 1a8507a..fb54c0e 100644 --- a/joytest/x52_test.c +++ b/joytest/x52_test.c @@ -15,7 +15,7 @@ #include #include -#include "libx52.h" +#include #include "x52_test_common.h" libx52_device *dev; int test_exit; diff --git a/joytest/x52_test_clock.c b/joytest/x52_test_clock.c index c0371e7..239811f 100644 --- a/joytest/x52_test_clock.c +++ b/joytest/x52_test_clock.c @@ -13,7 +13,7 @@ #include #include -#include "libx52.h" +#include #include "x52_test_common.h" int test_clock(void) diff --git a/joytest/x52_test_common.h b/joytest/x52_test_common.h index d72f3fb..50fae64 100644 --- a/joytest/x52_test_common.h +++ b/joytest/x52_test_common.h @@ -12,7 +12,7 @@ #include "config.h" #include #include -#include "libx52.h" +#include #include "gettext.h" extern libx52_device *dev; diff --git a/joytest/x52_test_led.c b/joytest/x52_test_led.c index 9bd28af..0805465 100644 --- a/joytest/x52_test_led.c +++ b/joytest/x52_test_led.c @@ -12,7 +12,7 @@ #include #include -#include "libx52.h" +#include #include "x52_test_common.h" #define TEST_LED(name, state) do { \ diff --git a/joytest/x52_test_mfd.c b/joytest/x52_test_mfd.c index dc68736..0e23961 100644 --- a/joytest/x52_test_mfd.c +++ b/joytest/x52_test_mfd.c @@ -12,7 +12,7 @@ #include #include -#include "libx52.h" +#include #include "x52_test_common.h" #define TEST_BRIGHTNESS(mfd, value) TEST(brightness, mfd, value) diff --git a/libx52/libx52io.h b/libx52/libx52io.h new file mode 120000 index 0000000..55b8da8 --- /dev/null +++ b/libx52/libx52io.h @@ -0,0 +1 @@ +../libx52io/libx52io.h \ No newline at end of file diff --git a/libx52/libx52util.h b/libx52/libx52util.h new file mode 120000 index 0000000..f841f6d --- /dev/null +++ b/libx52/libx52util.h @@ -0,0 +1 @@ +../libx52util/libx52util.h \ No newline at end of file diff --git a/libx52/test_strings.c b/libx52/test_strings.c index 7635f20..c15ef76 100644 --- a/libx52/test_strings.c +++ b/libx52/test_strings.c @@ -13,7 +13,7 @@ #include #include -#include "libx52.h" +#include #define TEST_STRINGIFY(name) do { \ char expected[256]; \ diff --git a/libx52/x52_common.h b/libx52/x52_common.h index b40f449..918f002 100644 --- a/libx52/x52_common.h +++ b/libx52/x52_common.h @@ -12,7 +12,7 @@ #include #include #include -#include "libx52.h" +#include /* * The X52 MFD supports the following: diff --git a/libx52/x52_control.c b/libx52/x52_control.c index 5c85f6e..fb2de5b 100644 --- a/libx52/x52_control.c +++ b/libx52/x52_control.c @@ -13,7 +13,7 @@ #include #include -#include "libx52.h" +#include #include "x52_commands.h" #include "x52_common.h" diff --git a/libx52/x52_core.c b/libx52/x52_core.c index c6f84d8..5fa956f 100644 --- a/libx52/x52_core.c +++ b/libx52/x52_core.c @@ -14,7 +14,7 @@ #include #include "usb-ids.h" -#include "libx52.h" +#include #include "x52_commands.h" #include "x52_common.h" #include "gettext.h" diff --git a/libx52/x52_date_time.c b/libx52/x52_date_time.c index abb40a6..5f98b39 100644 --- a/libx52/x52_date_time.c +++ b/libx52/x52_date_time.c @@ -14,7 +14,7 @@ #include #include -#include "libx52.h" +#include #include "x52_commands.h" #include "x52_common.h" diff --git a/libx52/x52_strerror.c b/libx52/x52_strerror.c index 3f48d5f..a150723 100644 --- a/libx52/x52_strerror.c +++ b/libx52/x52_strerror.c @@ -9,7 +9,7 @@ #include "config.h" #include -#include "libx52.h" +#include #include "gettext.h" #define N_(str) gettext_noop(str) diff --git a/libx52/x52_stringify.c b/libx52/x52_stringify.c index 6470bfa..384b35b 100644 --- a/libx52/x52_stringify.c +++ b/libx52/x52_stringify.c @@ -9,7 +9,7 @@ #include "config.h" #include -#include "libx52.h" +#include #include "gettext.h" #define N_(str) gettext_noop(str) diff --git a/libx52/x52dcomm.h b/libx52/x52dcomm.h new file mode 120000 index 0000000..ba01270 --- /dev/null +++ b/libx52/x52dcomm.h @@ -0,0 +1 @@ +../daemon/x52dcomm.h \ No newline at end of file diff --git a/libx52io/io_common.h b/libx52io/io_common.h index d46ad77..03b4dae 100644 --- a/libx52io/io_common.h +++ b/libx52io/io_common.h @@ -10,7 +10,7 @@ #define IO_COMMON_H #include -#include "libx52io.h" +#include #include "hidapi.h" // Function handler for parsing reports diff --git a/libx52io/io_strings.c b/libx52io/io_strings.c index 3ae3d04..8d6d831 100644 --- a/libx52io/io_strings.c +++ b/libx52io/io_strings.c @@ -9,7 +9,7 @@ #include "config.h" #include #include -#include "libx52io.h" +#include #include "gettext.h" /* The strings corresponding to the axis and button enumerations are diff --git a/libx52io/test_io_strings.c b/libx52io/test_io_strings.c index 128b1af..7fd7a52 100644 --- a/libx52io/test_io_strings.c +++ b/libx52io/test_io_strings.c @@ -11,7 +11,7 @@ #include #include -#include "libx52io.h" +#include static void lower_ascii_only(char *dst, const char *src) { diff --git a/libx52util/x52_char_map_lookup.c b/libx52util/x52_char_map_lookup.c index 1217577..b048046 100644 --- a/libx52util/x52_char_map_lookup.c +++ b/libx52util/x52_char_map_lookup.c @@ -14,7 +14,7 @@ #include #include -#include "libx52util.h" +#include #include "x52_char_map.h" /** diff --git a/libx52util/x52_char_map_test.c b/libx52util/x52_char_map_test.c index 97fc2e1..40b0264 100644 --- a/libx52util/x52_char_map_test.c +++ b/libx52util/x52_char_map_test.c @@ -16,7 +16,7 @@ #include #include -#include "libx52util.h" +#include // Fix this if we ever hit longer sequences #define RECORD_SIZE 8 diff --git a/meson.build b/meson.build index 7124f00..c38ba5b 100644 --- a/meson.build +++ b/meson.build @@ -120,7 +120,7 @@ dep_inih = dependency('inih') # Shared libraries and programs ####################################################################### # Includes -includes = include_directories('.', 'libx52', 'libx52io', 'libx52util', 'vkm') +includes = include_directories('.') subdir('libx52') subdir('libx52io') diff --git a/vkm/test_strerror.c b/vkm/test_strerror.c index 946fe7c..a204b7b 100644 --- a/vkm/test_strerror.c +++ b/vkm/test_strerror.c @@ -13,7 +13,7 @@ #include #include -#include "vkm.h" +#include static void test_strerror(void **state) { diff --git a/vkm/vkm-internal.h b/vkm/vkm-internal.h index b93acae..a7441f1 100644 --- a/vkm/vkm-internal.h +++ b/vkm/vkm-internal.h @@ -7,7 +7,7 @@ */ #include -#include "vkm.h" +#include #ifndef VKM_INTERNAL_H #define VKM_INTERNAL_H diff --git a/vkm/vkm_stub.c b/vkm/vkm_stub.c index 2b65775..e7fe1c8 100644 --- a/vkm/vkm_stub.c +++ b/vkm/vkm_stub.c @@ -9,7 +9,7 @@ #include #include -#include "vkm.h" +#include struct vkm_context { bool started;