blob: 9497ff523eaa0c3e9adb13873c583a317d25ac94 (
plain)
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
#!/bin/sh -x
# this build requires for there to be a copy of the gromacs source stored in
# ~/build_prereqs. At current, it's stock gromacs source for the Mac with
# no modifications. So, there's no point in storing it in the svn tree
# Also, this script has plenty of room for code cleanup as it now does the
# job of 2 previous scripts and other manual work. It's been put together with
# only minimal attention paid to streamlining the process
# accept command line argument for version number
if [ "$1" = "" ]
then
GMX_VERSION="3.3.3"
else
GMX_VERSION="$1"
fi
DIST_NAME="GROMACS_$GMX_VERSION"
# set up a directory to store pre-built stuff
if [ ! -e ~/MacOSX_Installers ]
then
mkdir ~/MacOSX_Installers
fi
# See if the build tree is likely to make sense
pwd | grep "gromacs-$GMX_VERSION"
if [ "$?" != 0 -o ! -e MacOSX ]
then
echo "incorrect build tree design"
exit 1
fi
cd .. || exit 1
TOP_LEVEL=`pwd`
# Get rid of directoried from a previous build
sudo rm -rf install packaging/build src
# create the compile directory
mkdir src || exit 1
# create the directory to install into
mkdir install || exit 1
cd src || exit 1
# These are the two scripts that have now been included into this main script
#cp $TOP_LEVEL/packaging/MacOSX/dist_gromacs.sh . || exit 1
#cp $TOP_LEVEL/packaging/MacOSX/stitch_gromacs.sh . || exit 1
# Set up the build directories for the two archs
tar -xzvf ~/build_prereqs/gromacs-$GMX_VERSION.tar.gz || exit 1
mv gromacs-$GMX_VERSION gromacs-$GMX_VERSION-ppc || exit 1
tar -xzvf ~/build_prereqs/gromacs-$GMX_VERSION.tar.gz || exit 1
mv gromacs-$GMX_VERSION gromacs-$GMX_VERSION-i386 || exit 1
# Compile the ppc version
# Set up the environment variables
cd gromacs-$GMX_VERSION-ppc || exit 1
export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export LDFLAGS="-arch ppc -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/usr/local/lib"
export CXXFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export FFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export MACOSX_DEPLOYMENT_TARGET=10.3
# Run configure for a double precision gromacs (ppc)
./configure --prefix=$TOP_LEVEL/install --disable-ia32-3dnow --disable-ia32-sse --x-includes=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --x-libraries=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib --enable-double --program-suffix= || exit 1
# Start the actual compile (ppc)
sudo -v
make clean || exit 1
make || exit 1
sudo -v
cd .. || exit 1
sudo -v
# Compile the i386 version
# Set up the environment variables
cd gromacs-$GMX_VERSION-i386 || exit 1
export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export LDFLAGS="-arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/usr/local/lib"
export CXXFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export FFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include"
export MACOSX_DEPLOYMENT_TARGET=10.3
# Run configure for a double precision gromacs (i386)
./configure --prefix=$TOP_LEVEL/install --disable-ia32-3dnow --disable-ia32-sse --x-includes=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include --x-libraries=/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib --enable-double --program-suffix= || exit 1
# Start the actual compile (i386)
sudo -v
make clean || exit 1
make || exit 1
sudo -v
make install || exit 1
sudo -v
# Stitch gromacs together
cd $TOP_LEVEL/src || exit 1
# remove the joined directory if it exists
sudo rm -rf gromacs-$GMX_VERSION-joined
mkdir gromacs-$GMX_VERSION-joined || exit 1
# change into a compiled directory to work from
cd gromacs-$GMX_VERSION-i386 || exit 1
# recreate the compiled directory structure in joined
find . -type d -exec mkdir ../gromacs-$GMX_VERSION-joined/{} \; || exit 1
# copy all bibrary files and rename them with the -i386 extension
find . -name "*.a" -exec cp {} ../gromacs-$GMX_VERSION-joined/{}-i386 \; || exit 1
# make a non-renamed copy to work from later
find . -name "*.a" -exec cp {} ../gromacs-$GMX_VERSION-joined/{} \; || exit 1
sudo -v
# find all other files that have a Mach-O listing when doing file
# We want only binary files at this time
for name in `find . -type f`
do
if [ -x "$name" ]
then
file $name | grep Mach-O > /tmp/stitch_gromacs_junk
if [ "$?" == "0" ]
then
cp $name ../gromacs-$GMX_VERSION-joined/$name-i386 || exit 1
cp $name ../gromacs-$GMX_VERSION-joined/$name || exit 1
fi
fi
done
sudo -v
# do essentially the same thing for the ppc version
cd ../gromacs-$GMX_VERSION-ppc || exit 1
find . -name "*.a" -exec cp {} ../gromacs-$GMX_VERSION-joined/{}-ppc \; || exit 1
for name in `find . -type f`
do
if [ -x "$name" ]
then
file $name | grep Mach-O > /tmp/stitch_gromacs_junk
if [ "$?" == "0" ]
then
cp $name ../gromacs-$GMX_VERSION-joined/$name-ppc || exit 1
fi
fi
done
sudo -v
cd ../gromacs-$GMX_VERSION-joined || exit 1
echo "Starting joining process"
# Erase the non-type specific file and replace it with one sewn together with
# lipo. Then remove the type specific versions leaving only a universal of
# the original file
for name in `find . -type f ! -name "*-i386" ! -name "*-ppc" -print`
do
rm $name || exit 1
lipo -create $name-i386 $name-ppc -output $name
rm $name-i386 $name-ppc || exit 1
done
sudo -v
# Make a directory to hold a universal version of the whole tree
mkdir ../gromacs-$GMX_VERSION-univ || exit 1
# Populate the universal version of the tree with a tree structure that looks
# like one of the ones we compiled with
cd ../gromacs-$GMX_VERSION-i386 || exit 1
find . -print | cpio -pudvm ../gromacs-$GMX_VERSION-univ || exit 1
# Now replace all binary versions with the universal versions
cd ../gromacs-$GMX_VERSION-joined || exit 1
find . -type f -print -exec cp {} ../gromacs-$GMX_VERSION-univ/{} \; || exit 1
cd $TOP_LEVEL/src || exit 1
sudo -v
# build distribution area for gromacs
# use another TOPLEVEL for this area since it was imported from another script
# originally. This should maybe be changed later.
TOPLEVEL=`pwd`
echo "Top Level is $TOPLEVEL"
# recreate distribution directories
rm -rf dist dist2
mkdir dist || exit 1
mkdir dist2 || exit 1
# re-create the directory structure again for distribution.
cd $TOPLEVEL/gromacs-$GMX_VERSION-joined || exit 1
find . -type d -exec mkdir $TOPLEVEL/dist2/{} \; || exit 1
find . -name "*.a" -exec cp {} $TOPLEVEL/dist2/{} \; || exit 1
sudo -v
# Grab the binary files and put them into the temporary dist directory
for name in `find . -type f`
do
if [ -x "$name" ]
then
file $name | grep Mach-O > /tmp/stitch_gromacs_junk || exit 1
if [ "$?" == "0" ]
then
cp $name $TOPLEVEL/dist2/$name || exit 1
fi
fi
done
sudo -v
cd $TOPLEVEL/dist2 || exit 1
echo "Pruning .svn directories"
find . -name ".svn" -depth -print -exec rm -rf {} \; || exit 1
# removing empty directories if the directory is full, it will error,
# so don't use exit 1
find . -depth -type d -exec rmdir {} \;
sudo -v
# create a final bin directory for the new temporary tree
mkdir bin || exit 1
# create the contents of the bin directory from the contents of the others
for direct in `ls`
do
cd $direct || exit 1
echo "Inspecting $direct"
for name in `find . -type f`
do
if [ -x "$name" ]
then
cp $name $TOPLEVEL/dist2/bin || exit 1
fi
done
cd ..
done
sudo -v
#set up the rest of the distribution directory to look like what we want in the
# final package.
cd $TOPLEVEL/dist2 || exit 1
# grab all the includes
mkdir include || exit 1
cp -r $TOP_LEVEL/install/include/gromacs/* include || exit 1
# get all the libraries
mkdir lib || exit 1
find . -name "*.a" -exec cp {} $TOPLEVEL/dist2/lib \; || exit 1
find . -name "*.dylib" -exec cp {} $TOPLEVEL/dist2/lib \; || exit 1
# Create the share directories that have examples, docs, etc.
mkdir share || exit 1
cp -r $TOP_LEVEL/install/share/gromacs/* share || exit 1
# This next section is for the hdf5 implementations which may be put back later
cd $TOP_LEVEL/install/lib || exit 1
#tar -cvzf $TOPLEVEL/dist2/lib/HDF5.tar.gz libHDF5_SimResults.*
#tar -cvzf $TOPLEVEL/dist2/lib/hdf5.tar.gz libhdf5.*
cd $TOPLEVEL/dist2/lib || exit 1
#tar -xzf HDF5.tar.gz
#tar -xzf hdf5.tar.gz
#rm HDF5.tar.gz
#rm hdf5.tar.gz
sudo -v
cd $TOPLEVEL/dist2/bin || exit 1
cd $TOPLEVEL/dist2 || exit 1
# grab a copy of the source code for packaging
cp ~/build_prereqs/gromacs-$GMX_VERSION.tar.gz . || exit 1
# move the contents of the temporary tree into the final one
mv bin $TOPLEVEL/dist/bin || exit 1
mv lib $TOPLEVEL/dist/lib || exit 1
mv share $TOPLEVEL/dist/share || exit 1
mv include $TOPLEVEL/dist/include || exit 1
mv gromacs-$GMX_VERSION.tar.gz $TOPLEVEL/dist || exit 1
cd $TOPLEVEL || exit 1
sudo -v
# remove the temporary tree
rm -rf $TOPLEVEL/dist2
# final setup before the packaging
mkdir $TOP_LEVEL/packaging/build || exit 1
mkdir $TOP_LEVEL/packaging/build/GROMACS || exit 1
# copy everything from inside the dist into the pkg build area
cd $TOP_LEVEL/src/dist || exit 1
cp -R * $TOP_LEVEL/packaging/build/GROMACS || exit 1
sudo -v
# put the mcpp into the final package area
cd $TOP_LEVEL/packaging/build/GROMACS || exit 1
mkdir mcpp || exit 1
cd mcpp || exit 1
sudo -v
tar -xzvf ~/build_prereqs/mcpp.tar.gz || exit 1
sudo -v
# Make all permissions be root:admin for final packaging
cd $TOP_LEVEL/packaging
sudo find build/GROMACS -exec chown root:admin {} \; || exit 1
#Next step is to build the package and the dmg
rm -rf rec
# create the resources directory
mkdir build/rec || exit 1
cp MacOSX/background.jpg build/rec || exit 1
cp MacOSX/License.txt build/rec || exit 1
# Run the package maker program
sudo /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker -o $TOP_LEVEL/packaging/build/GROMACS_$GMX_VERSION.pkg -r ./build/GROMACS -v -e $TOP_LEVEL/packaging/build/rec -f MacOSX/GMX-info.plist || exit 1
# swap things around so the installer says GROMACS for the dmg file and insaller
sudo mv build/GROMACS build/$DIST_NAME || exit 1
sudo mkdir build/GROMACS || exit 1
sudo mv build/$DIST_NAME.pkg build/GROMACS || exit 1
# Build the dmg file
sleep 10
# code to get around a strange race condition where hdiutil doesn't see the
# the srcfolder if it's not completely sync'd up.
sudo sync
sleep 10
# Try building the final dmg file
sudo hdiutil create -srcfolder $TOP_LEVEL/packaging/build/GROMACS -fs HFS+ -format UDZO $TOP_LEVEL/packaging/build/${DIST_NAME}.dmg || exit 1
# make a copy of all this stuff so the suite builder can use it later.
if [ ! -e ~/MacOSX_Installers/$DIST_NAME.pkg ]
then
sudo cp -R $TOP_LEVEL/packaging/build/GROMACS/$DIST_NAME.pkg ~/MacOSX_Installers
cp $TOP_LEVEL/packaging/build/$DIST_NAME.dmg ~/MacOSX_Installers
fi
|