aboutsummaryrefslogtreecommitdiff
path: root/galileo/patch/0002-configure-allow-setting-mandir-prefix.patch
blob: 4e78b71a9bd860b93d18b4fb3ad8573327f7dfb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From 67154066915430626eff8ddf88632fa94558841a Mon Sep 17 00:00:00 2001
From: Slack Coder <slackcoder@server.ky>
Date: Fri, 18 Jul 2025 12:34:15 -0500
Subject: [PATCH] configure: allow setting mandir+prefix

Follow the pattern from gmid to implement the configuration options mandir and prefix.
---
 Makefile  |  2 --
 configure | 26 ++++++++++++++++++--------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 8007454..62ef4f3 100644
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,7 @@ include config.mk
 
 # -- options --
 
-PREFIX =	/usr/local
 SBINDIR =	${PREFIX}/sbin
-MANDIR =	${PREFIX}/man
 WWWDIR =	/var/www/htdocs
 
 # -- build-related variables --
diff --git a/configure b/configure
index 0568bea..ae93be8 100755
--- a/configure
+++ b/configure
@@ -54,16 +54,18 @@ while [ $# -gt 0 ]; do
 		usage
 	fi
 
-	if [ "$key" = --prefix ]; then
-		key=PREFIX
-		if [ "$1" = --prefix ]; then # no =, look at next arg
-			if !shift 2>&1 >/dev/null; then
-				echo "$0: missing value for --prefix" >&2
-				exit 1
-			fi
-			val="$1"
+	if [ "$key" = "$1" ]; then
+		# if no --xy=, look at the next arg
+		if ! shift 2>/dev/null; then
+			echo "$0: missing value for $key" >&2
+			exit 1
 		fi
+		val="$1"
 	fi
+        case "$key" in
+        --mandir)   key=MANDIR ;;
+        --prefix)   key=PREFIX ;;
+        esac
 
 	if [ "$1" = "$key" ]; then
 		echo "$0: invalid key-value: $1" >&2
@@ -85,8 +87,12 @@ while [ $# -gt 0 ]; do
 		LDADD_LIBEVENT="$val" ;;
 	LDADD_LIBSOCKET)
 		LDADD_LIBSOCKET="$val" ;;
+	MANDIR)
+                MANDIR="$val" ;;
 	PKG_CONFIG)
 		pkgconfig="$val" ;;
+	PREFIX)
+                PREFIX="$val" ;;
 	SOCK)
 		sock="$sock" ;;
 	USER)
@@ -388,12 +394,16 @@ EOF
 exec > config.mk
 echo "config.mk: writing..." >&2
 
+[ -z "${MANDIR}" ] && MANDIR="\${PREFIX}/man"
+
 cat <<EOF
 CC=		${CC}
 CFLAGS=		${CFLAGS}
 LIBS=		${LIBS}
 LDFLAGS=	${LDFLAGS}
 YACC=		${YACC}
+PREFIX=         ${PREFIX}
+MANDIR=         ${MANDIR}
 
 COMPATS=	${COMPATS}
 
-- 
2.46.3