1
0

Added NM_CONFIG_DIR option to the Makefile (closes #68)

This should not be used in most cases, as it will break compatibility with
existing mods which depend on adding a config to NM. This option is meant as a
better option than find/replace for people who do private builds of NM for
themselves and want to change the config dir.

It will also affect the path used for installing the documentation and shown in
the default menu item.
This commit is contained in:
Patrick Gaskin
2020-08-03 15:36:25 -04:00
parent 667208e8d5
commit 7a372616bf
4 changed files with 21 additions and 12 deletions

View File

@@ -5,7 +5,7 @@ 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 CFLAGS += -Wall -Wextra -Werror -fvisibility=hidden
override CXXFLAGS += -Wall -Wextra -Werror -Wno-missing-field-initializers -isystemlib -fvisibility=hidden -fvisibility-inlines-hidden
override KOBOROOT += res/doc:/mnt/onboard/.adds/nm/doc
override KOBOROOT += res/doc:$(NM_CONFIG_DIR)/doc
override SKIPCONFIGURE += strip
strip:
@@ -16,4 +16,14 @@ ifeq ($(NM_UNINSTALL_CONFIGDIR),1)
override CPPFLAGS += -DNM_UNINSTALL_CONFIGDIR
endif
ifeq ($(NM_CONFIG_DIR),)
override NM_CONFIG_DIR := /mnt/onboard/.adds/nm
endif
ifneq ($(NM_CONFIG_DIR),/mnt/onboard/.adds/nm)
$(info -- Warning: NM_CONFIG_DIR is set to a non-default value; this will cause issues with other mods using it!)
endif
override CPPFLAGS += -DNM_CONFIG_DIR='"$(NM_CONFIG_DIR)"' -DNM_CONFIG_DIR_DISP='"$(patsubst /mnt/onboard/%,KOBOeReader/%,$(NM_CONFIG_DIR))"'
include NickelHook/NickelHook.mk

11
res/doc
View File

@@ -7,10 +7,9 @@
# it has a lot of error checking, and a failsafe mechanism which automatically
# uninstalls it as a last resort.
#
# Place your configuration files in this folder (/mnt/onboard/.adds/nm). They
# can be named anything, and should consist of multiple lines either starting
# with # for a comment, or in one of the the following formats (spaces around
# fields are ignored):
# Place your configuration files in this folder. They can be named anything, and
# should consist of multiple lines either starting with # for a comment, or in
# one of the the following formats (spaces around fields are ignored):
#
# menu_item:<location>:<label>:<action>:<arg>
# Adds a menu item.
@@ -131,7 +130,7 @@
# gui - only enumerate non-hidden active KFMon watches (this is the default)
# all - enumerate all active KFMon watches
#
# For example, you might have a configuration file in KOBOeReader/.adds/nm/mystuff like:
# For example, you might have a configuration file named "mystuff" like:
#
# menu_item :main :Show an Error :dbg_error :This is an error message!
# menu_item :main :Do Nothing :cmd_spawn :sleep 60
@@ -164,7 +163,7 @@
# which can be viewed over telnet or SSH (the username is root) with the command
# logread.
#
# To uninstall NickelMenu, create a file named KOBOeReader/.adds/nm/uninstall,
# To uninstall NickelMenu, create a file in this directory named "uninstall",
# or manually uninstall it by deleting libnm.so. You can also uninstall it by
# triggering the failsafe mechanism by turning your Kobo off within 20 seconds
# of turning it on.

View File

@@ -300,7 +300,7 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
.act = NM_ACTION(dbg_toast),
.on_failure = true,
.on_success = true,
.arg = "See .adds/nm/doc for instructions on how to customize this menu.",
.arg = "See " NM_CONFIG_DIR_DISP "/doc for instructions on how to customize this menu.",
.next = NULL,
}))) RETERR("error appending default action to empty config: %s", nm_config_parse__strerror(ret));
}

View File

@@ -28,8 +28,8 @@ typedef struct {
nm_menu_action_t *action;
} nm_menu_item_t;
#ifndef NM_CONFIG_DIR
#define NM_CONFIG_DIR "/mnt/onboard/.adds/nm"
#if !(defined(NM_CONFIG_DIR) && defined(NM_CONFIG_DIR_DISP))
#error "NM_CONFIG_DIR not set (it should be done by the Makefile)"
#endif
#ifndef NM_CONFIG_MAX_MENU_ITEMS_PER_MENU
@@ -40,8 +40,8 @@ typedef struct nm_config_t nm_config_t;
typedef struct nm_config_file_t nm_config_file_t;
// nm_config_parse lists the configuration files in /mnt/onboard/.adds/nm. If
// there are errors reading the dir, NULL is returned and nm_err is set.
// nm_config_parse lists the configuration files in NM_CONFIG_DIR. If there are
// errors reading the dir, NULL is returned and nm_err is set.
nm_config_file_t *nm_config_files();
// nm_config_files_update checks if the configuration files are up to date and