Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support plugins #176

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Support plugin resources
Copy extra resource files added to a res/ directory in the plugin source.
flibbertigibbet committed Nov 30, 2024
commit 97f29bcd90f09efb2c8da4ab8be6aeb29aa9dd8f
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
include NickelHook/NickelHook.mk

PLUGIN_DIR = src/plugins
PLUGIN_SRC_DIR = src/plugins
PLUGIN_DEST_DIR = /usr/local/Kobo/plugins

override PKGCONF += Qt5Widgets
override LIBRARY := src/libnm.so
override SOURCES += src/action.c src/action_c.c src/action_cc.cc src/config.c src/generator.c src/generator_c.c src/kfmon.c src/nickelmenu.cc src/util.c
override MOCS += $(PLUGIN_DIR)/NPGuiInterface.h
override MOCS += $(PLUGIN_SRC_DIR)/NPGuiInterface.h
override CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden
override CXXFLAGS += -Wall -Wextra -Werror -Wno-missing-field-initializers -isystemlib -fvisibility=hidden -fvisibility-inlines-hidden

@@ -36,21 +37,26 @@ endif
override CPPFLAGS += -DNM_CONFIG_DIR='"$(NM_CONFIG_DIR)"' -DNM_CONFIG_DIR_DISP='"$(patsubst /mnt/onboard/%,KOBOeReader/%,$(NM_CONFIG_DIR))"'

# Find plugins
PLUGIN_DIRS = $(foreach dir,$(shell find $(PLUGIN_DIR) -mindepth 1 -maxdepth 1 -type d),$(notdir $(dir)))
PLUGIN_EXPORTS := $(foreach plugin,$(PLUGIN_DIRS),$(PLUGIN_DIR)/$(plugin)/$(plugin).so:/usr/local/Kobo/plugins/$(plugin).so)
PLUGIN_SRC_DIRS = $(foreach dir,$(shell find $(PLUGIN_SRC_DIR) -mindepth 1 -maxdepth 1 -type d),$(notdir $(dir)))
PLUGIN_EXPORTS := $(foreach plugin,$(PLUGIN_SRC_DIRS),$(PLUGIN_SRC_DIR)/$(plugin)/$(plugin).so:$(PLUGIN_DEST_DIR)/$(plugin).so)
override KOBOROOT += $(PLUGIN_EXPORTS)

# Find plugin extra resources
PLUGIN_EXTRAS := $(foreach plugin,$(PLUGIN_SRC_DIRS),$(shell find $(PLUGIN_SRC_DIR)/$(plugin)/res/* -not -path '*/.*' -type f))
PLUGIN_EXTRA_EXPORTS := $(foreach extra,$(PLUGIN_EXTRAS),$(extra):$(shell echo $(extra) | sed -e 's,^$(PLUGIN_SRC_DIR)/.*/res/,$(PLUGIN_DEST_DIR)/res/,'))
override KOBOROOT += $(PLUGIN_EXTRA_EXPORTS)

clean:
rm -r $(GENERATED)
for p in $(PLUGIN_DIRS); do $(MAKE) -C $(PLUGIN_DIR)/$$p clean; done
for p in $(PLUGIN_SRC_DIRS); do $(MAKE) -C $(PLUGIN_SRC_DIR)/$$p clean; done

.PHONY: plugins

export CPPFLAGS
export CXXFLAGS
export LDFLAGS
plugins:
for p in $(PLUGIN_DIRS); do $(MAKE) -C $(PLUGIN_DIR)/$$p; done
for p in $(PLUGIN_SRC_DIRS); do $(MAKE) -C $(PLUGIN_SRC_DIR)/$$p; done
for f in $(PLUGIN_EXPORTS); do echo $$f; done

include NickelHook/NickelHook.mk