diff --git a/bsnes/target-bsnes/GNUmakefile b/bsnes/target-bsnes/GNUmakefile index c693a2ed9..6c9058a13 100644 --- a/bsnes/target-bsnes/GNUmakefile +++ b/bsnes/target-bsnes/GNUmakefile @@ -40,8 +40,6 @@ verbose: hiro.verbose ruby.verbose nall.verbose all; install: all ifeq ($(platform),windows) -else ifeq ($(shell id -un),root) - $(error "make install should not be run as root") else ifeq ($(platform),macos) mkdir -p ~/Library/Application\ Support/$(name)/ mkdir -p ~/Library/Application\ Support/$(name)/Database/ @@ -49,32 +47,29 @@ else ifeq ($(platform),macos) mkdir -p ~/Library/Application\ Support/$(name)/Shaders/ cp -R out/$(name).app /Applications/$(name).app else ifneq ($(filter $(platform),linux bsd),) - mkdir -p $(prefix)/bin/ - mkdir -p $(prefix)/share/applications/ - mkdir -p $(prefix)/share/icons/hicolor/256x256/apps/ - mkdir -p $(prefix)/share/icons/hicolor/scalable/apps/ - mkdir -p $(prefix)/share/$(name)/ - mkdir -p $(prefix)/share/$(name)/Database/ - mkdir -p $(prefix)/share/$(name)/Firmware/ - mkdir -p $(prefix)/share/$(name)/Shaders/ - cp out/$(name) $(prefix)/bin/$(name) - cp $(ui)/resource/$(name).desktop $(prefix)/share/applications/$(name).desktop - cp $(ui)/resource/$(name).png $(prefix)/share/icons/hicolor/256x256/apps/$(name).png - cp $(ui)/resource/$(name).svg $(prefix)/share/icons/hicolor/scalable/apps/$(name).svg - cp Database/* $(prefix)/share/$(name)/Database/ - cp -r ../shaders/* $(prefix)/share/$(name)/Shaders/ + mkdir -p $(DESTDIR)$(bindir) + mkdir -p $(DESTDIR)$(datarootdir)/applications + mkdir -p $(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps + mkdir -p $(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps + mkdir -p $(DESTDIR)$(datadir)/$(name)/Database + mkdir -p $(DESTDIR)$(datadir)/$(name)/Firmware + mkdir -p $(DESTDIR)$(datadir)/$(name)/Shaders + cp out/$(name) $(DESTDIR)$(bindir)/$(name) + cp $(ui)/resource/$(name).desktop $(DESTDIR)$(datarootdir)/applications/$(name).desktop + cp $(ui)/resource/$(name).png $(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/$(name).png + cp $(ui)/resource/$(name).svg $(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/$(name).svg + cp Database/* $(DESTDIR)$(datadir)/$(name)/Database/ + cp -r ../shaders/* $(DESTDIR)$(datadir)/$(name)/Shaders/ endif uninstall: ifeq ($(platform),windows) -else ifeq ($(shell id -un),root) - $(error "make uninstall should not be run as root") else ifeq ($(platform),macos) rm -rf /Applications/$(name).app else ifneq ($(filter $(platform),linux bsd),) - rm -f $(prefix)/bin/$(name) - rm -f $(prefix)/share/applications/$(name).desktop - rm -f $(prefix)/share/icons/hicolor/256x256/apps/$(name).png - rm -f $(prefix)/share/icons/hicolor/scalable/apps/$(name).svg - rm -rf $(prefix)/share/$(name) + rm -f $(DESTDIR)$(bindir)/$(name) + rm -f $(DESTDIR)$(datarootdir)/applications/$(name).desktop + rm -f $(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/$(name).png + rm -f $(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/$(name).svg + rm -rf $(DESTDIR)$(datadir)/$(name) endif diff --git a/bsnes/target-bsnes/bsnes.cpp b/bsnes/target-bsnes/bsnes.cpp index c7bb3dd3c..5c07e06bf 100644 --- a/bsnes/target-bsnes/bsnes.cpp +++ b/bsnes/target-bsnes/bsnes.cpp @@ -12,6 +12,9 @@ auto locate(string name) -> string { location = {Path::userData(), "bsnes/", name}; if(inode::exists(location)) return location; + location = {Path::sharedData(), "bsnes/", name}; + if(inode::exists(location)) return location; + directory::create({Path::userSettings(), "bsnes/"}); return {Path::userSettings(), "bsnes/", name}; } diff --git a/nall/GNUmakefile b/nall/GNUmakefile index f064ae772..dcca2b6dd 100755 --- a/nall/GNUmakefile +++ b/nall/GNUmakefile @@ -239,5 +239,9 @@ strne = $(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),1,) ifeq ($(platform),windows) prefix := $(subst $([space]),\$([space]),$(strip $(call strtr,$(LOCALAPPDATA),\,/))) else - prefix := $(HOME)/.local + prefix ?= /usr/local + bindir ?= $(prefix)/bin + datarootdir ?= $(prefix)/share + datadir ?= $(datarootdir) + flags += -DDATADIR=\"$(datadir)\" endif diff --git a/nall/path.hpp b/nall/path.hpp index 3353817b4..a9f0b496c 100644 --- a/nall/path.hpp +++ b/nall/path.hpp @@ -137,6 +137,8 @@ inline auto sharedData() -> string { result.transform("\\", "/"); #elif defined(PLATFORM_MACOS) string result = "/Library/Application Support/"; + #elif defined(DATADIR) + string result = DATADIR; #else string result = "/usr/share/"; #endif