Newer
Older
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/bash
#
# TODO:
#
# * anpasen, dass bei installiertem Dune das DUNEDIR nicht an
# autogen.sh uebergeben weden muss.
#
set -e
echo Dune project generator
echo ----------------------
################## READ OPTIONS ##################
while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do
PROJECT=""
while [ -z $PROJECT ]; do
read -p "Project name? " PROJECT
done
VERSION=""
while [ -z $VERSION ]; do
read -p "Project version? " VERSION
done
MAINTAINER=""
while [ -z $MAINTAINER ]; do
read -p "Maintainers email address? " MAINTAINER
done
echo
echo -n "creating Project \"$PROJECT\", version $VERSION "
echo "with maintainer \"$MAINTAINER\""
read -p "Are these informations correct? [y/N] " DATACORRECT
echo
done
################## CONFIGURE.AC ##################
mkdir "$PROJECT"
cat > "$PROJECT/configure.ac" <<C_DELIM
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT($PROJECT, $VERSION, $MAINTAINER)
AM_INIT_AUTOMAKE($PROJECT, $VERSION, $MAINTAINER)
AC_CONFIG_SRCDIR([$PROJECT.cc])
AM_CONFIG_HEADER([config.h])
# we need no more than the standard DUNE-stuff
DUNE_CHECK_ALL
# implicitly set the Dune-flags everywhere
AC_SUBST(AM_CPPFLAGS, \$DUNE_CPPFLAGS)
AC_SUBST(AM_LDFLAGS, \$DUNE_LDFLAGS)
LIBS="\$DUNE_LIBS"
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
# finally print the summary information
DUNE_SUMMARY_ALL
C_DELIM
################## AUTOGEN.SH ##################
cat > "$PROJECT/autogen.sh" <<A_DELIM
#!/bin/sh
set -e
# may be used to force a certain automake-version e.g. 1.7
AMVERS=
if test x\$1 = "x" ; then
echo "Usage: ./autogen.sh DUNEDIR"
exit 0
fi
if test ! -d \$1/m4 ; then
echo \$1/m4 not found! Wrong directory supplied?
exit 1
fi
if test "x\$AMVERS" != x ; then
echo Warning: explicitly using automake version \$AMVERS
# binaries are called automake-\$AMVERS
AMVERS="-\$AMVERS"
fi
# convert to absolute path so that aclocal 1.8 does the right thing
DUNEM4=\`cd \$1/m4 && pwd\`
aclocal\$AMVERS -I \$DUNEM4
libtoolize --force
autoheader
automake\$AMVERS --add-missing
autoconf
A_DELIM
chmod +x "$PROJECT/autogen.sh"
################## README ##################
cat > "$PROJECT/README" <<R_DELIM
Getting started
===============
You have to create the configure-script on your own!
First, you'll need the followings programs installed:
automake >= 1.5
autoconf >= 2.50
libtool
Then run
./autogen.sh DUNEDIR
where DUNEDIR is the (absolute or relative) path of the dune/-directory.
The directory is needed because autogen.sh needs access to the tests
stored in DUNEDIR/m4
Now call
./configure --with-dune=DIR
where DIR is the directory _above_ dune/. If you want to include third
party packages check
./configure --help
for options on how to include Albert, Grape, UG, ...
If configure checked your system without problems you can use
make
to build all examples.
R_DELIM
################## MAKEFILE.AM ##################
cat> "$PROJECT/Makefile.am" << M_DELIM
# \$Id$
# possible options
#LDADD = \$(UG_LDFLAGS) \$(AMIRAMESH_LDFLAGS) \$(UG_LIBS) \$(AMIRAMESH_LIBS)
#AM_CPPFLAGS = \$(UG_CPPFLAGS) \$(AMIRAMESH_CPPFLAGS)
noinst_PROGRAMS = ${PROJECT}
${PROJECT}_SOURCES = ${PROJECT}.cc
# don't follow the full GNU-standard
# we need automake 1.5
AUTOMAKE_OPTIONS = foreign 1.5
M_DELIM
################## PROJECT.CC ##################
cat> "$PROJECT/$PROJECT.cc" << CC_DELIM
#include <iostream>
int main()
{
std::cout << "Hello World! This is ${PROJECT}." << std::endl;
return 0;
}
CC_DELIM