better use of version.h and letting configure build things with versions

This commit is contained in:
Bryan Stansell 2019-03-24 09:59:46 -07:00
parent a75e3fc17c
commit a18c8bc6c4
No known key found for this signature in database
GPG Key ID: 28E4B7253029E7F6
9 changed files with 37 additions and 15 deletions

View File

@ -29,7 +29,7 @@ AH_TEMPLATE([REQ_SERVER_CERT], [Defined if client requires server SSL certificat
AH_TEMPLATE([TRUST_UDS_CRED], [Defined if we trust credentials from UDS client])
dnl ### Normal initialization. ######################################
AC_INIT
AC_INIT([conserver],m4_esyscmd_s([./package/get-version number]))
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([conserver/main.c])
AC_CONFIG_HEADER(config.h)
@ -43,6 +43,9 @@ fi
MKDIR="mkdir -p -m 755"
AC_SUBST(MKDIR)
AC_SUBST(CONSERVER_VERSION, m4_esyscmd_s([./package/get-version number]))
AC_SUBST(CONSERVER_DATE, m4_esyscmd_s([./package/get-version date]))
dnl ### Custom settings. ############################################
dnl AC_MSG_CHECKING(whether to allow 64bit compilation)
@ -844,6 +847,7 @@ AC_CHECK_FUNCS(getaudit getaudit_addr)
dnl ### Create output files. #######################################
AC_CONFIG_FILES([Makefile conserver/Makefile conserver.cf/Makefile console/Makefile autologin/Makefile contrib/chat/Makefile])
AC_CONFIG_FILES([conserver/conserver.rc], [chmod +x conserver/conserver.rc])
AC_CONFIG_FILES([conserver.cf/conserver.cf.man conserver.cf/conserver.passwd.man conserver/conserver.man console/console.man])
AC_OUTPUT
[

View File

@ -1,4 +1,4 @@
.TH CONSERVER.CF 5 "2019/03/17" "conserver-8.2.3" "conserver"
.TH CONSERVER.CF 5 "@CONSERVER_DATE@" "conserver-@CONSERVER_VERSION@" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)

View File

@ -1,4 +1,4 @@
.TH CONSERVER.PASSWD 5 "2019/03/17" "conserver-8.2.3" "conserver"
.TH CONSERVER.PASSWD 5 "@CONSERVER_DATE@" "conserver-@CONSERVER_VERSION@" "conserver"
.SH NAME
conserver.passwd \- user access information for
.BR conserver (8)

View File

@ -1,4 +1,4 @@
.TH CONSERVER 8 "2019/03/17" "conserver-8.2.3" "conserver"
.TH CONSERVER 8 "@CONSERVER_DATE@" "conserver-@CONSERVER_VERSION@" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS

View File

@ -12,6 +12,7 @@
@(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n"
#define VERSION_DATE "2019/03/17"
#define VERSION_MAJOR 8
#define VERSION_MINOR 2
#define VERSION_REV 3

View File

@ -1,4 +1,4 @@
.TH CONSOLE 1 "2019/03/17" "conserver-8.2.3" "conserver"
.TH CONSOLE 1 "@CONSERVER_DATE@" "conserver-@CONSERVER_VERSION@" "conserver"
.SH NAME
console \- console server client program
.SH SYNOPSIS

View File

@ -4,10 +4,7 @@ set -e
[ -z "$1" ] && echo "Usage: $0 tag" && exit 1
range="$1"
maj=`grep MAJOR conserver/version.h | awk '{print $NF; exit}'`
min=`grep MINOR conserver/version.h | awk '{print $NF; exit}'`
rev=`grep REV conserver/version.h | awk '{print $NF; exit}'`
ver="$maj.$min.$rev"
echo "version $ver (`date '+%B %-d, %Y'`):"
date=`./package/get-version date`
changedate=`date -j -f '%Y/%m/%d' "$date" '+%B %-d, %Y'`
echo "version `./package/get-version number` ($changedate):"
git log --no-merges --pretty=tformat:' - %s (%an <%ae>)' "$range" | tail -r | awk '{if (! l[$0]) {l[$0]++; print}}'

22
package/get-version Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e
# awk gets stdin from /dev/null 'cause when autoconf runs this via m4_esyscmd_s,
# stdin is closed and awk assumes there will always be an open stdin and you end
# up with a bogus message:
#
# awk: i/o error occurred while closing /dev/stdin
# input record number 20, file conserver/version.h
# source line number 1
#
#
case "$1" in
number)
awk '$2=="VERSION_MAJOR"{maj=$NF} $2=="VERSION_MINOR"{min=$NF} $2=="VERSION_REV"{rev=$NF} END{print maj "." min "." rev}' conserver/version.h < /dev/null
;;
date)
awk '$2=="VERSION_DATE"{print $NF}' conserver/version.h < /dev/null | tr -d '"'
;;
esac

View File

@ -5,10 +5,8 @@ set -e
local=false && [ "$1" = "local" ] && local=true
[ -f conserver/version.h ] || { echo "you are in the wrong place" ; exit 1; }
maj=`grep MAJOR conserver/version.h | awk '{print $NF; exit}'`
min=`grep MINOR conserver/version.h | awk '{print $NF; exit}'`
rev=`grep REV conserver/version.h | awk '{print $NF; exit}'`
ver="$maj.$min.$rev"
ver=`./package/get-version number`
if [ ! -f ../conserver-$ver.tar.gz ] || $local; then
(
[ -d build ] && rm -rf build