-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautogen.sh
executable file
·64 lines (52 loc) · 1.42 KB
/
autogen.sh
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
#!/bin/sh
#
# Execute this script to generate a configure script
#
# Copyright (C) 2020-2021 jeremy theler
# This file is part of libreblackjack.
#
# This file is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
#
# check for needed tools
for i in git autoreconf make m4 fmt; do
if test -z "$(which ${i})"; then
echo "error: ${i} is not installed"
exit 1
fi
done
./autoclean.sh
if test -d ".git"; then
vcs=git
else
echo "this tree is not a repository (did you download instead of clone?)"
exit 1
fi
if test ${vcs} = "git"; then
# major version is equal to the latest tag
version=$(git describe --tags | sed 's/-/./')
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
commitdate=$(git log -1 --pretty=format:"%ad")
cat << EOF > src/version-vcs.h
#define LIBREBLACKJACK_VCS_BRANCH "${branch}"
#define LIBREBLACKJACK_VCS_VERSION "${version}"
#define LIBREBLACKJACK_VCS_DATE "${commitdate}"
#define LIBREBLACKJACK_VCS_CLEAN $(git status --porcelain | wc -l)
EOF
else
version=0.1.0
fi
echo "define(libreblackjackversion, [${version}])dnl" > version.m4
if [ ! -z "$(which pandoc)" ]; then
pandoc README.md -t plain -o README
# cd doc
# ./md2texi.sh
# cd ..
else
fmt README.md > README
touch doc/libreblackjack.texi
fi
# touch ChangeLog
git log --oneline --decorate > ChangeLog
autoreconf --install
automake --add-missing