forked from maki-rxrz/DGMPGDec
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·40 lines (35 loc) · 739 Bytes
/
Copy pathconfig.sh
File metadata and controls
executable file
·40 lines (35 loc) · 739 Bytes
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
#!/bin/sh
ERR_EXIT () {
echo $1; exit 1
}
cwd="$(cd $(dirname $0); pwd)"
version=''
clean='no'
config_h="$cwd/src/config.h"
# Parse options
for opt do
optarg="${opt#*=}"
case "$opt" in
--clean)
clean='yes'
;;
*)
ERR_EXIT "Unknown option ... $opt"
;;
esac
done
# Output config.h
if [ "$clean" = 'yes' -o ! -d "$cwd/.git" ]; then
cat > "$config_h" << EOF
#undef DGMPGDEC_GIT_VERSION
EOF
else
cd "$cwd"
if [ -n "`git tag`" ]; then
version="`git describe --tags`"
echo "$version"
echo "#define DGMPGDEC_GIT_VERSION \"$version\"" > "$config_h"
else
echo "#undef DGMPGDEC_GIT_VERSION" > "$config_h"
fi
fi