mkversion 1.88 KB
Newer Older
1
#! /bin/sh
Kurt Zeilenga's avatar
Kurt Zeilenga committed
2
# Create a version.c file
Kurt Zeilenga's avatar
Kurt Zeilenga committed
3
# $OpenLDAP$
Kurt Zeilenga's avatar
Kurt Zeilenga committed
4
5
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
6
## Copyright 1998-2021 The OpenLDAP Foundation.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
7
8
9
10
11
12
13
14
15
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
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
PACKAGE=OpenLDAP
VERSION=unknown
SYMBOL=__Version
static=static
const=const
while :
	do case "$1" in
		-p)
			PACKAGE=$2
			shift; shift ;;
		-v)
			VERSION=$2
			shift; shift ;;

		-c)
			const=
			shift ;;
		-n)
			SYMBOL=$2
			shift; shift ;;
		-s)
			static=
			shift ;;

#		-*) shift ;;
		*)
			break ;;
	esac
done

if test $# != 1 ; then
	echo 'usage: mkversion [-c] [-s] [-p package] [-v version] application'
	exit 1
fi

APPLICATION=$1
53
54
55
56
57
58
# Reproducible builds set SOURCE_DATE_EPOCH, want constant strings
if [ -n "${SOURCE_DATE_EPOCH}" ]; then
   WHOWHERE="openldap"
else
   WHOWHERE="$USER@$(uname -n):$(pwd)"
fi
59
60

cat << __EOF__
Kurt Zeilenga's avatar
Kurt Zeilenga committed
61
62
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 *
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
63
 * Copyright 1998-2021 The OpenLDAP Foundation.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
64
65
66
67
68
69
70
71
72
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted only as authorized by the OpenLDAP
 * Public License.
 *
 * A copy of this license is available in the file LICENSE in the
 * top-level directory of the distribution or, alternatively, at
 * <http://www.OpenLDAP.org/license.html>.
73
 */
Kurt Zeilenga's avatar
Kurt Zeilenga committed
74

Kurt Zeilenga's avatar
Kurt Zeilenga committed
75
static const char copyright[] =
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
76
"Copyright 1998-2021 The OpenLDAP Foundation.  All rights reserved.\n"
Kurt Zeilenga's avatar
Kurt Zeilenga committed
77
"COPYING RESTRICTIONS APPLY\n";
78
79

$static $const char $SYMBOL[] =
Kurt Zeilenga's avatar
Kurt Zeilenga committed
80
81
"@(#) \$$PACKAGE: $APPLICATION $VERSION (" __DATE__ " " __TIME__ ") \$\n"
"\t$WHOWHERE\n";
82
83

__EOF__