xref: /netbsd-src/external/bsd/openldap/dist/build/mkrelease (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1#! /bin/sh
2# $OpenLDAP$
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 1998-2021 The OpenLDAP Foundation.
6## All rights reserved.
7##
8## Redistribution and use in source and binary forms, with or without
9## modification, are permitted only as authorized by the OpenLDAP
10## Public License.
11##
12## A copy of this license is available in the file LICENSE in the
13## top-level directory of the distribution or, alternatively, at
14## <http://www.OpenLDAP.org/license.html>.
15#
16# Make a release
17#
18
19#
20# This script MUST NOT add files to the export nor modify
21# any file in the export, exceptions:
22#	make guide.html
23#
24
25set -e 		# exit immediately if any errors occur
26
27if test $# != 3 ; then
28	echo 'usage: mkrelease REPO RELNAME TAG'
29	exit 1
30fi
31
32REPO=$1
33shift
34RELNAME=openldap-$1
35shift
36TAG=$1
37shift
38
39#Linux
40#SHA="sha1sum"
41#MD="md5sum"
42#BSD
43#SHA="sha1"
44#MD="md5"
45#OpenSSL
46#SHA="openssl sha1"
47SHA3="openssl sha3-512"
48#MD="openssl md5"
49
50if test -e $RELNAME ; then
51	echo "error: $RELNAME exists"
52	exit 1
53fi
54
55echo Release: $RELNAME
56echo Tag: $TAG
57
58git archive --format=tar --prefix="${RELNAME}/" --remote="${REPO}" "$TAG" |  tar xvf -
59
60if test ! -d $RELNAME ; then
61	echo "error: $RELNAME doesn't exists"
62	exit 1
63fi
64
65if test -e $RELNAME/doc/guide/admin/guide.sdf ; then
66	echo "build guide..."
67	( cd $RELNAME/doc/guide/admin ; make guide.html )
68else
69	echo "No guide"
70fi
71
72if test -e $RELNAME/libraries/liblunicode/ucdata/uctable.h ; then
73	echo "touching uctable.h..."
74	touch $RELNAME/libraries/liblunicode/ucdata/uctable.h
75fi
76
77if test ! -e $RELNAME/build/version.sh ; then
78	echo "No build version"
79	OL_STRING="something"
80else
81	eval `$RELNAME/build/version.sh`
82fi
83
84echo "Rolling up $OL_STRING ..."
85
86
87tar cf $RELNAME.tar $RELNAME
88gzip -9 -c $RELNAME.tar > $RELNAME.tgz
89#${MD} $RELNAME.tgz > $RELNAME.md5
90#${SHA} $RELNAME.tgz > $RELNAME.sha1
91${SHA3} $RELNAME.tgz > $RELNAME.sha3-512
92rm -f $RELNAME.tar
93
94ls -l $RELNAME.*
95
96echo "Made $OL_STRING as $RELNAME.tgz"
97