forked from INFERLab/gridlab-d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkpkgs
89 lines (83 loc) · 2.59 KB
/
checkpkgs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# $Id$
#
# Checkpkgs verifies that the directories listed in Makefile.am are available
# and removed any that are not found. This is required so that that
# autoreconf works properly.
#
OLDSUBDIRS="$(grep ^SUBDIRS Makefile.am)"
DIRS=$(echo $OLDSUBDIRS | cut -f2- -d= | cut -f1 -d#)
echo "Packages listed: $DIRS"
remake="no"
for D in $DIRS ; do
echo -n "Checking $D..."
if [ -d $D -a -f $D/Makefile.am ]; then
echo "found and ready"
SUBDIRS="$SUBDIRS $D"
else
echo "not found or ready"
remake="yes"
MISSING="$MISSING $D"
fi
done
if [ "$remake" == "yes" ]; then
if [ ! -f Makefile.org ]; then
echo "Saving Makefile.am to Makefile.org"
cp Makefile.am Makefile.org
fi
echo "Updating Makefile.am to exclude missing packages"
cat Makefile.am | sed -e "s/^SUBDIRS = .*/SUBDIRS = $SUBDIRS # previously: $DIRS/" > .tmp.$$
mv .tmp.$$ Makefile.am
if [ ! -f configure.org ]; then
echo "Saving configure.ac to configure.org"
cp configure.ac configure.org
fi
echo -n "Updating configure.ac to exclude missing packages"
for D in $MISSING; do
grep -v $D/Makefile configure.ac >.tmp.$$
mv .tmp.$$ configure.ac
echo -n "."
done
echo "done"
else
echo "All packages are found"
fi
if [ -f VERSION ]; then
. VERSION
if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$NAME" ]; then
echo "ERROR: VERSION doesn't specified release version info"
elif [ ! -f REV ]; then
echo "ERROR: REV file not found; this release is faulty"
elif [ -f gldcore/version.h ]; then
. ./REV
if [ -z "$BUILD" ]; then
echo "ERROR: REV file does not specify BUILD"
else
echo -n "Updating gldcore/version.h with VERSION info... "
echo "/* automatically created by $0 */" >.tmp.$$
echo "" >>.tmp.$$
echo "#ifndef _GRIDLABD_VERSION_H" >>.tmp.$$
echo "#define _GRIDLABD_VERSION_H" >>.tmp.$$
echo "" >>.tmp.$$
echo "#define REV_MAJOR $MAJOR" >>.tmp.$$
echo "#define REV_MINOR $MINOR" >>.tmp.$$
echo "#define REV_PATCH $PATCH" >>.tmp.$$
echo "#define COPYRIGHT \"Copyright (C) 2004-$(date +'%Y')\\nBattelle Memorial Institute\\nAll Rights Reserved\"" >>.tmp.$$
echo "#ifdef WIN32 " >>.tmp.$$
echo "#define BUILD \"\$Revision: $BUILD \$\"" >>.tmp.$$
echo "#else" >>.tmp.$$
echo "#include \"build.h\"">>.tmp.$$
echo "#endif" >>.tmp.$$
echo "#define BUILDNUM (atoi(BUILD+11))" >>.tmp.$$
echo "#define BRANCH \"$NAME\"" >>.tmp.$$
echo "" >>.tmp.$$
echo "#endif" >>.tmp.$$
# grep BRANCH gldcore/version.h >>.tmp.$$
mv .tmp.$$ gldcore/version.h
echo "done"
fi
else
echo "ERROR: gldcore/version.h not found and couldn't be updated"
fi
fi
echo "You may proceed with autoreconf -isf"