slackbuilds

My Slackbuilds
git clone git://git.server.ky/slackcoder/slackbuilds
Log | Files | Refs | README

0002-configure-allow-setting-mandir-prefix.patch (2017B)


      1 From 67154066915430626eff8ddf88632fa94558841a Mon Sep 17 00:00:00 2001
      2 From: Slack Coder <slackcoder@server.ky>
      3 Date: Fri, 18 Jul 2025 12:34:15 -0500
      4 Subject: [PATCH] configure: allow setting mandir+prefix
      5 
      6 Follow the pattern from gmid to implement the configuration options mandir and prefix.
      7 ---
      8  Makefile  |  2 --
      9  configure | 26 ++++++++++++++++++--------
     10  2 files changed, 18 insertions(+), 10 deletions(-)
     11 
     12 diff --git a/Makefile b/Makefile
     13 index 8007454..62ef4f3 100644
     14 --- a/Makefile
     15 +++ b/Makefile
     16 @@ -2,9 +2,7 @@ include config.mk
     17  
     18  # -- options --
     19  
     20 -PREFIX =	/usr/local
     21  SBINDIR =	${PREFIX}/sbin
     22 -MANDIR =	${PREFIX}/man
     23  WWWDIR =	/var/www/htdocs
     24  
     25  # -- build-related variables --
     26 diff --git a/configure b/configure
     27 index 0568bea..ae93be8 100755
     28 --- a/configure
     29 +++ b/configure
     30 @@ -54,16 +54,18 @@ while [ $# -gt 0 ]; do
     31  		usage
     32  	fi
     33  
     34 -	if [ "$key" = --prefix ]; then
     35 -		key=PREFIX
     36 -		if [ "$1" = --prefix ]; then # no =, look at next arg
     37 -			if !shift 2>&1 >/dev/null; then
     38 -				echo "$0: missing value for --prefix" >&2
     39 -				exit 1
     40 -			fi
     41 -			val="$1"
     42 +	if [ "$key" = "$1" ]; then
     43 +		# if no --xy=, look at the next arg
     44 +		if ! shift 2>/dev/null; then
     45 +			echo "$0: missing value for $key" >&2
     46 +			exit 1
     47  		fi
     48 +		val="$1"
     49  	fi
     50 +        case "$key" in
     51 +        --mandir)   key=MANDIR ;;
     52 +        --prefix)   key=PREFIX ;;
     53 +        esac
     54  
     55  	if [ "$1" = "$key" ]; then
     56  		echo "$0: invalid key-value: $1" >&2
     57 @@ -85,8 +87,12 @@ while [ $# -gt 0 ]; do
     58  		LDADD_LIBEVENT="$val" ;;
     59  	LDADD_LIBSOCKET)
     60  		LDADD_LIBSOCKET="$val" ;;
     61 +	MANDIR)
     62 +                MANDIR="$val" ;;
     63  	PKG_CONFIG)
     64  		pkgconfig="$val" ;;
     65 +	PREFIX)
     66 +                PREFIX="$val" ;;
     67  	SOCK)
     68  		sock="$sock" ;;
     69  	USER)
     70 @@ -388,12 +394,16 @@ EOF
     71  exec > config.mk
     72  echo "config.mk: writing..." >&2
     73  
     74 +[ -z "${MANDIR}" ] && MANDIR="\${PREFIX}/man"
     75 +
     76  cat <<EOF
     77  CC=		${CC}
     78  CFLAGS=		${CFLAGS}
     79  LIBS=		${LIBS}
     80  LDFLAGS=	${LDFLAGS}
     81  YACC=		${YACC}
     82 +PREFIX=         ${PREFIX}
     83 +MANDIR=         ${MANDIR}
     84  
     85  COMPATS=	${COMPATS}
     86  
     87 -- 
     88 2.46.3
     89