чување d14bdd02d94e2a73d4a693004aae0a5787f3a9b9
родитељ c29a26dac7bcbeb07d8854ec7f5be82115e5866f
Аутор: Страхиња Радић <sr@strahinja.org>
Датум: Sat, 7 Feb 2026 15:49:22 +0100
Propagate changes to build scripts from sled
Diffstat:
измењених датотека: 7, додавања: 72(+), брисања: 52(-)
diff --git a/INSTALL b/INSTALL
@@ -1,7 +1,7 @@
Prerequisites
=============
-* C compiler - defaults in config.mk
+* C compiler - defaults in config.mk (HaikuOS needs Clang/LLVM)
Install
@@ -9,6 +9,7 @@ Install
$ git clone https://git.sr.ht/~strahinja/poe
$ cd poe
+ $ cp config.$(uname -s) config.mk
$ su
# make install
@@ -17,6 +18,7 @@ With got[1]:
$ got clone https://git.sr.ht/~strahinja/poe
$ got checkout poe.git
$ cd poe
+ $ cp config.$(uname -s) config.mk
$ su
# make install
@@ -25,24 +27,12 @@ Persistent build configuration file
-----------------------------------
The file config.mk will be sourced when building targets which also accept
-configuration through environment variables. For example, CC and PREFIX
+configuration through environment variables. For example, CPPFLAGS and PREFIX
are specified in config.mk.
+Initially, there will be no config.mk, you will need to copy one of the
+customized config.* files or write your own:
-OpenBSD
--------
-
-Before running make(1), comment the CPPFLAGS definition in config.mk above the
-line with the "OpenBSD" comment and uncomment the one below it:
-
- #CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
- # -D_XOPEN_SOURCE=700
- # OpenBSD
- CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
- -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
-
-Also, do the same for MANPREFIX:
+ $ cp config.$(uname -s) config.mk || echo Write config.mk from scratch
- #MANPREFIX = $(DESTDIR)$(PREFIX)/share/man
- # OpenBSD
- MANPREFIX = $(DESTDIR)$(PREFIX)/man
+[1]: https://www.gameoftrees.org
diff --git a/config.Haiku b/config.Haiku
@@ -0,0 +1,18 @@
+CC = clang
+CFLAGS = -I. -Os -Wextra -Wall -pedantic -std=c99
+CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
+ -D_XOPEN_SOURCE=700 -DNDEBUG
+DESTDIR = /boot/home/config/non-packaged
+INSTALL = install
+LIBS =
+SRC = draw.c po.c poe.c strlcat.c strlcpy.c util.c
+HEADERS = config.h draw.h po.h termbox.h util.h version.h
+OBJS = draw.o po.o poe.o strlcat.o strlcpy.o util.o
+PREFIX =
+PROG = poe
+
+# Derived macros
+BINDIR = $(DESTDIR)$(PREFIX)/bin
+DOCDIR = $(DESTDIR)$(PREFIX)/documentation/$(PROG)
+MANPREFIX = $(DESTDIR)$(PREFIX)/documentation/man
+MANPAGE = $(PROG).1
diff --git a/config.Linux b/config.Linux
@@ -0,0 +1,16 @@
+CFLAGS = -Os -Wextra -Wall -pedantic -std=c99
+CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
+ -D_XOPEN_SOURCE=700 -DNDEBUG
+INSTALL = install
+LIBS =
+SRC = draw.c po.c poe.c strlcat.c strlcpy.c util.c
+HEADERS = config.h draw.h po.h termbox.h util.h version.h
+OBJS = draw.o po.o poe.o strlcat.o strlcpy.o util.o
+PREFIX = /usr/local
+PROG = poe
+
+# Derived macros
+BINDIR = $(DESTDIR)$(PREFIX)/bin
+DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/$(PROG)
+MANPREFIX = $(DESTDIR)$(PREFIX)/share/man
+MANPAGE = $(PROG).1
diff --git a/config.OpenBSD b/config.OpenBSD
@@ -0,0 +1,16 @@
+CFLAGS = -Os -Wextra -Wall -pedantic -std=c99
+CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
+ -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -DNDEBUG
+INSTALL = install
+LIBS =
+SRC = draw.c po.c poe.c strlcat.c strlcpy.c util.c
+HEADERS = config.h draw.h po.h termbox.h util.h version.h
+OBJS = draw.o po.o poe.o strlcat.o strlcpy.o util.o
+PREFIX = /usr/local
+PROG = poe
+
+# Derived macros
+BINDIR = $(DESTDIR)$(PREFIX)/bin
+DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/$(PROG)
+MANPREFIX = $(DESTDIR)$(PREFIX)/man
+MANPAGE = $(PROG).1
diff --git a/config.mk b/config.mk
@@ -1,22 +0,0 @@
-#CC = cc
-CFLAGS = -Os -Wall -pedantic -std=c99
-CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
- -D_XOPEN_SOURCE=700
-# OpenBSD
-#CPPFLAGS = -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L \
-# -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
-INSTALL = install
-LIBS =
-SRC = draw.c po.c poe.c strlcat.c strlcpy.c util.c
-HEADERS = config.h draw.h po.h termbox.h util.h version.h
-OBJS = draw.o po.o poe.o strlcat.o strlcpy.o util.o
-PREFIX = /usr/local
-PROG = poe
-
-# Derived macros
-BINDIR = $(DESTDIR)$(PREFIX)/bin
-DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/$(PROG)
-MANPREFIX = $(DESTDIR)$(PREFIX)/share/man
-# OpenBSD
-#MANPREFIX = $(DESTDIR)$(PREFIX)/man
-MANPAGE = $(PROG).1
diff --git a/lib/makedate b/lib/makedate
@@ -6,16 +6,16 @@ export LC_ALL
getent()
{
- if command -v getent >/dev/null 2>&1; then
- command getent "$@"
+ geresult=''
+ if geresult=$(command getent "$@" 2>/dev/null); then
return
fi
case "$1" in
passwd|group)
if [ -z "$2" ]; then
- cat /etc/"$1"
+ geresult=$(cat /etc/"$1")
else
- awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1"
+ geresult=$(awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1")
fi
;;
*) ;;
@@ -44,8 +44,9 @@ if [ -d .got ] && command -v got >/dev/null 2>&1; then
exit
}' >date.new
elif [ -d .git ] && command -v git >/dev/null 2>&1; then
- user=$(getent passwd "$(unalias ls >/dev/null 2>&1 || true; \
- command ls -nd . | awk '{print $3}')" | awk -F: '{print $1}')
+ getent passwd "$(unalias ls >/dev/null 2>&1 || true; \
+ command ls -nd . | awk '{print $3}')"
+ user=$(printf "%s\n" "$geresult" | awk -F: '{print $1}')
if [ -z "$user" ]; then
printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2
exit 1
diff --git a/lib/makeversion b/lib/makeversion
@@ -4,16 +4,16 @@ FALLBACKVER=${FALLBACKVER:-unknown}
getent()
{
- if command -v getent >/dev/null 2>&1; then
- command getent "$@"
+ geresult=''
+ if geresult=$(command getent "$@" 2>/dev/null); then
return
fi
case "$1" in
passwd|group)
if [ -z "$2" ]; then
- cat /etc/"$1"
+ geresult=$(cat /etc/"$1")
else
- awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1"
+ geresult=$(awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1")
fi
;;
*) ;;
@@ -51,8 +51,9 @@ if [ -d .got ] && command -v got >/dev/null 2>&1; then
elif [ -d .git ] && command -v git >/dev/null 2>&1; then
LC_ALL=C
export LC_ALL
- user=$(getent passwd "$(unalias ls >/dev/null 2>&1 || true; \
- command ls -nd . | awk '{print $3}')" | awk -F: '{print $1}')
+ getent passwd "$(unalias ls >/dev/null 2>&1 || true; \
+ command ls -nd . | awk '{print $3}')"
+ user=$(printf "%s\n" "$geresult" | awk -F: '{print $1}')
if [ -z "$user" ]; then
printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2
exit 1