Mercurial > nsnake
changeset 93:5758289c8121 default tip @
make: various cleanups
- We don't need setgid to save files, the user can just have write access to
the directory.
- Don't define our own rules.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 21 Sep 2023 13:32:11 +0200 |
parents | e640f3ffa57d |
children | |
files | CHANGES.md GNUmakefile INSTALL.md |
diffstat | 3 files changed, 21 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.md Fri Feb 03 15:36:43 2023 +0100 +++ b/CHANGES.md Thu Sep 21 13:32:11 2023 +0200 @@ -1,6 +1,12 @@ NSnake CHANGES ============== +nsnake 3.0.2 2023-??-?? +----------------------- + +- Ditch setgid in favor to writable group. +- Simplify GNUmakefile. + nsnake 3.0.1 2021-06-17 -----------------------
--- a/GNUmakefile Fri Feb 03 15:36:43 2023 +0100 +++ b/GNUmakefile Thu Sep 21 13:32:11 2023 +0200 @@ -18,7 +18,7 @@ # Build options. GID := games -UID := games +UID := root # Installation options. PREFIX := /usr/local @@ -26,7 +26,7 @@ MANDIR := $(PREFIX)/share/man VARDIR := $(PREFIX)/var -VERSION := 3.0.1 +VERSION := 3.0.2 SRCS := nsnake.c OBJS := $(SRCS:.c=.o) @@ -41,8 +41,7 @@ INCS := -I/usr/local/include -I/usr/local/include/ncurses LIBS := -L/usr/local/lib -lncurses else ifeq ($(OS),OpenBSD) -# OpenBSD has no games UID, use root instead (we ran as setgid so that's fine.) -UID := root +# OpenBSD has no games UID LIBS := -lncurses MANDIR := $(PREFIX)/man else @@ -51,24 +50,23 @@ LIBS := $(shell pkg-config --libs ncurses) endif -all: nsnake +override CPPFLAGS += -DVARDIR=\"$(VARDIR)\" +override CPPFLAGS += -DVERSION=\"$(VERSION)\" -%.o: %.c - $(CC) -c $< -o $@ -DVARDIR=\"$(VARDIR)\" -DVERSION=\"$(VERSION)\" $(INCS) $(CFLAGS) +override CFLAGS += $(INCS) -nsnake: $(OBJS) - $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) +override LDLIBS += $(LIBS) + +all: nsnake install: mkdir -p $(DESTDIR)$(BINDIR) cp nsnake $(DESTDIR)$(BINDIR) - chown $(UID):$(GID) $(DESTDIR)$(BINDIR)/nsnake - chmod 2555 $(DESTDIR)$(BINDIR)/nsnake mkdir -p $(DESTDIR)$(MANDIR)/man6 cp nsnake.6 $(DESTDIR)$(MANDIR)/man6 mkdir -p $(DESTDIR)$(VARDIR)/db/nsnake + chown $(UID):$(GID) $(DESTDIR)$(VARDIR)/db/nsnake chmod 770 $(DESTDIR)$(VARDIR)/db/nsnake - chown $(UID):$(GID) $(DESTDIR)$(VARDIR)/db/nsnake clean: rm -f nsnake $(OBJS)
--- a/INSTALL.md Fri Feb 03 15:36:43 2023 +0100 +++ b/INSTALL.md Thu Sep 21 13:32:11 2023 +0200 @@ -30,7 +30,7 @@ The following options may be used to configure the build. -- `GID`: change the gid to chown (default: games), +- `GID`: change the gid to chown (default: root), - `UID`: change the uid to chown (default: games), - `PREFIX`: root directory for installation - `BINDIR`: change to the installation of executable (default: PREFIX/bin), @@ -41,9 +41,8 @@ ----------- NSnake uses a scores file in order to share all users scores on the same -machine. In order to work, the binary `nsnake` but have setgid file attribute -and its database directory with the appropriate permissions. This is -automatically done as `make install` step. +machine. In order to work, your user must have read/write permissions to the +directory which is created at install time, it defaults to UID:GID (see above). -The directory for saving the scores is writable by this group to make sure the -executable can write it from any user. +The directory for saving the scores is writable by this group to make sure your +user can write it from any user.