Adds --config-dir option in configure script to let the user set a custom path for system wide config file

This commit is contained in:
Yohann Bianchi 2013-05-27 17:56:19 +02:00
parent 63d0f97df7
commit 937b112e71
5 changed files with 10 additions and 6 deletions

View File

@ -58,7 +58,7 @@ ifeq ($(findstring Haiku,$(OS)),)
LIBS = -lm
endif
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS -DCONFIG_DIR='"$(CONFIG_DIR)"'
ifeq ($(REENTRANT_TEST), 1)
DEFINES += -Dmain=retroarch_main
@ -389,11 +389,11 @@ tools/input_common_joyconfig.o: input/input_common.c
install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)/etc 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(CONFIG_DIR)/etc 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
install -m644 retroarch.cfg $(DESTDIR)/etc/retroarch.cfg
install -m644 retroarch.cfg $(DESTDIR)$(CONFIG_DIR)/etc/retroarch.cfg
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
install -m644 docs/retroarch-joyconfig.1 $(DESTDIR)$(MAN_DIR)
install -m755 retroarch-zip $(DESTDIR)$(PREFIX)/bin
@ -404,7 +404,7 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-joyconfig
rm -f $(DESTDIR)$(PREFIX)/bin/retrolaunch
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-zip
rm -f $(DESTDIR)/etc/retroarch.cfg
rm -f $(DESTDIR)$(CONFIG_DIR)/etc/retroarch.cfg
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch.1
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-joyconfig.1
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.png

View File

@ -6,6 +6,7 @@ cat /dev/null > "$MAKEFILE_DEFINES" > "$CONFIG_DEFINES"
#cat /dev/null > "${MAKEFILE_DEFINES:=.MAKEFILE_DEFINES}" > "${CONFIG_DEFINES=.CONFIG_DEFINES}"
[ "$PREFIX" ] || PREFIX="/usr/local"
[ "$CONFIG_DIR" ] || CONFIG_DIR="/etc"
add_define_header()
{ echo "$1=$2" >> "$CONFIG_DEFINES";}
@ -235,6 +236,7 @@ create_config_make()
echo "PACKAGE_NAME = $PACKAGE_NAME"
echo "PACKAGE_VERSION = $PACKAGE_VERSION"
echo "PREFIX = $PREFIX"
echo "CONFIG_DIR = $CONFIG_DIR"
while [ "$1" ]; do
case $(eval echo \$HAVE_$1) in

View File

@ -16,6 +16,7 @@ LDFLAGS: Linker flags
General options:
--prefix=\$path: Install path prefix
--config-dir=\$path: System wide config file prefix
--host=HOST: cross-compile to build programs to run on HOST
--help: Show this help
@ -51,6 +52,7 @@ parse_input() # Parse stuff :V
while [ "$1" ]; do
case "$1" in
--prefix=*) PREFIX=${1##--prefix=};;
--config-dir=*) CONFIG_DIR=${1##--config-dir=};;
--host=*) CROSS_COMPILE=${1##--host=}-;;
--enable-*)
opt_exists "${1##--enable-}"

View File

@ -380,9 +380,9 @@ static config_file_t *open_default_config_file(void)
// Try this as a last chance ...
if (!conf)
{
strlcpy(conf_path, "/etc/retroarch.cfg", sizeof(conf_path));
snprintf(conf_path, sizeof(conf_path), "%s/retroarch.cfg", CONFIG_DIR);
RARCH_LOG("Looking for config in: \"%s\".\n", conf_path);
conf = config_file_new(conf_path);
RARCH_LOG("Looking for config in: \"/etc/retroarch.cfg\".\n");
}
if (conf)

BIN
tools/retrolaunch/retrolaunch Executable file

Binary file not shown.