diff options
author | Derrick Hendricks <derrick@nanorex.com> | 2008-08-05 15:51:12 +0000 |
---|---|---|
committer | Derrick Hendricks <derrick@nanorex.com> | 2008-08-05 15:51:12 +0000 |
commit | 0a39b88ef51345367314a52cfc976d45979e81b3 (patch) | |
tree | 77d05814adbf1d63384fb29da41958c623038c8f | |
parent | f49773fa842151899a94be64662d8f098061214c (diff) | |
download | nanoengineer-0a39b88ef51345367314a52cfc976d45979e81b3.tar.gz nanoengineer-0a39b88ef51345367314a52cfc976d45979e81b3.zip |
mostly adding comment blocks to the scripts to make them easier to understand
-rwxr-xr-x | cad/plugins/GROMACS/gromacs-3.3.3/packaging/buildMac.sh | 242 | ||||
-rwxr-xr-x | packaging/Suite/buildMacSuite.sh | 49 |
2 files changed, 197 insertions, 94 deletions
diff --git a/cad/plugins/GROMACS/gromacs-3.3.3/packaging/buildMac.sh b/cad/plugins/GROMACS/gromacs-3.3.3/packaging/buildMac.sh index e3d039ae4..fd8a13250 100755 --- a/cad/plugins/GROMACS/gromacs-3.3.3/packaging/buildMac.sh +++ b/cad/plugins/GROMACS/gromacs-3.3.3/packaging/buildMac.sh @@ -1,5 +1,13 @@ #!/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" @@ -15,18 +23,36 @@ then mkdir ~/MacOSX_Installers fi -cd .. +# 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 -mkdir src -mkdir install -cd src -cp $TOP_LEVEL/packaging/MacOSX/dist_gromacs.sh . -cp $TOP_LEVEL/packaging/MacOSX/stitch_gromacs.sh . +# 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" @@ -35,7 +61,10 @@ export CXXFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-ve 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 @@ -43,10 +72,11 @@ make || exit 1 sudo -v cd .. || exit 1 -tar -xzvf ~/build_prereqs/gromacs-$GMX_VERSION.tar.gz || exit 1 -mv gromacs-$GMX_VERSION gromacs-$GMX_VERSION-i386 || 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" @@ -55,7 +85,10 @@ export CXXFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-v 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 @@ -66,162 +99,209 @@ sudo -v # Stitch gromacs together cd $TOP_LEVEL/src || exit 1 -rm -rf gromacs-$GMX_VERSION-joined -mkdir gromacs-$GMX_VERSION-joined -cd gromacs-$GMX_VERSION-i386 -find . -type d -exec mkdir ../gromacs-$GMX_VERSION-joined/{} \; -find . -name "*.a" -exec cp {} ../gromacs-$GMX_VERSION-joined/{}-i386 \; -find . -name "*.a" -exec cp {} ../gromacs-$GMX_VERSION-joined/{} \; +# 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 + file $name | grep Mach-O > /tmp/stitch_gromacs_junk || exit 1 if [ "$?" == "0" ] then - cp $name ../gromacs-$GMX_VERSION-joined/$name-i386 - cp $name ../gromacs-$GMX_VERSION-joined/$name + cp $name ../gromacs-$GMX_VERSION-joined/$name-i386 || exit 1 + cp $name ../gromacs-$GMX_VERSION-joined/$name || exit 1 fi fi done sudo -v -cd ../gromacs-$GMX_VERSION-ppc -find . -name "*.a" -exec cp {} ../gromacs-$GMX_VERSION-joined/{}-ppc \; +# 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 + file $name | grep Mach-O > /tmp/stitch_gromacs_junk || exit 1 if [ "$?" == "0" ] then - cp $name ../gromacs-$GMX_VERSION-joined/$name-ppc + cp $name ../gromacs-$GMX_VERSION-joined/$name-ppc || exit 1 fi fi done sudo -v -cd ../gromacs-$GMX_VERSION-joined +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 - echo $name - lipo -create $name-i386 $name-ppc -output $name - rm $name-i386 $name-ppc + rm $name || exit 1 + lipo -create $name-i386 $name-ppc -output $name || exit 1 + rm $name-i386 $name-ppc || exit 1 done sudo -v -mkdir ../gromacs-$GMX_VERSION-univ -cd gromacs-$GMX_VERSION-i386 -find . -print | cpio -pudvm ../gromacs-$GMX_VERSION-univ -cd ../gromacs-$GMX_VERSION-joined -find . -type f -print -exec cp {} ../gromacs-$GMX_VERSION-univ/{} \; -cd $TOP_LEVEL/src +# 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" -rm -rf dist -rm -rf dist2 -mkdir dist -mkdir dist2 +# 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/{} \; -find . -name "*.a" -exec cp {} $TOPLEVEL/dist2/{} \; +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 + file $name | grep Mach-O > /tmp/stitch_gromacs_junk || exit 1 if [ "$?" == "0" ] then - cp $name $TOPLEVEL/dist2/$name + cp $name $TOPLEVEL/dist2/$name || exit 1 fi fi done sudo -v -cd $TOPLEVEL/dist2 +cd $TOPLEVEL/dist2 || exit 1 echo "Pruning .svn directories" -find . -name ".svn" -depth -print -exec rm -rf {} \; +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 -mkdir bin +# 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 + cd $direct || exit 1 echo "Inspecting $direct" for name in `find . -type f` do if [ -x "$name" ] then - echo "copying $name to $TOPLEVEL/dist2/bin" - cp $name $TOPLEVEL/dist2/bin + cp $name $TOPLEVEL/dist2/bin || exit 1 fi done cd .. done sudo -v -cd $TOPLEVEL/dist2 -mkdir include -cp -r $TOP_LEVEL/install/include/gromacs/* include -mkdir lib -find . -name "*.a" -exec cp {} $TOPLEVEL/dist2/lib \; -find . -name "*.dylib" -exec cp {} $TOPLEVEL/dist2/lib \; -mkdir share -cp -r $TOP_LEVEL/install/share/gromacs/* share -cd $TOP_LEVEL/install/lib + +#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 +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 -cd $TOPLEVEL/dist2 -cp ~/build_prereqs/gromacs-$GMX_VERSION.tar.gz . -mv bin $TOPLEVEL/dist/bin -mv lib $TOPLEVEL/dist/lib -mv share $TOPLEVEL/dist/share -mv include $TOPLEVEL/dist/include -mv gromacs-$GMX_VERSION.tar.gz $TOPLEVEL/dist -cd $TOPLEVEL +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 -mkdir $TOP_LEVEL/packaging/build -mkdir $TOP_LEVEL/packaging/build/GROMACS -cd $TOP_LEVEL/src/dist -cp -R * $TOP_LEVEL/packaging/build/GROMACS +# 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 -cd $TOP_LEVEL/packaging/build/GROMACS -mkdir mcpp -cd mcpp -tar -xzvf ~/build_prereqs/mcpp.tar.gz -sudo touch /tmp/junk_alive.txt + +# Make all permissions be root:admin for final packaging cd $TOP_LEVEL/packaging -sudo find build/GROMACS -exec chown root:admin {} \; +sudo find build/GROMACS -exec chown root:admin {} \; || exit 1 #Next step is to build the package and the dmg rm -rf rec -mkdir build/rec -cp MacOSX/background.jpg build/rec -cp MacOSX/License.txt build/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 -sudo mv build/GROMACS build/$DIST_NAME -sudo mkdir build/GROMACS -sudo mv build/$DIST_NAME.pkg build/GROMACS +# 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 diff --git a/packaging/Suite/buildMacSuite.sh b/packaging/Suite/buildMacSuite.sh index 833c7587a..93e3dc2ca 100755 --- a/packaging/Suite/buildMacSuite.sh +++ b/packaging/Suite/buildMacSuite.sh @@ -110,6 +110,7 @@ then cat packaging/buildMac.sh | sed -e "s:^VERSION_NUM=.*:VERSION_NUM=\\\"$VERSION_NUM\\\":" | sed -e "s:^RC_NUMBER=.*:RC_NUMBER=\\\"$RC_NUMBER\\\":" > packaging/buildMac.sh.tmp mv packaging/buildMac.sh.tmp packaging/buildMac.sh || exit 1 cd packaging +# Set up the environment variables for the build export CPPFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include -I/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include" export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3 -I/usr/local/include -I/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include" export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/usr/local/lib -L/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib" @@ -134,48 +135,70 @@ cd $TOP_LEVEL # Made it this far, continue building the suite. Mod the suite installer files cd $PKNG_DIR cd MacOSX +# create a blank metapackages directory directory for the build sudo rm -rf metapackage -mkdir metapackage -mkdir metapackage/packages -mkdir metapackage/extras +mkdir metapackage || exit 1 +mkdir metapackage/packages || exit 1 +mkdir metapackage/extras || exit 1 +# grab the packages that make up the build and rename them to what the build +# expects them to be. Basically stripping off version numbers if [ -e ~/MacOSX_Installers ] then - cd metapackage/packages - sudo cp -R ~/MacOSX_Installers/NanoEngineer-1_v$VERSION_NUM.pkg . - sudo mv NanoEngineer-1_v$VERSION_NUM.pkg NanoEngineer-1.pkg - sudo cp -R ~/MacOSX_Installers/GROMACS_$GROMACS_VERSION.pkg . - sudo mv GROMACS_$GROMACS_VERSION.pkg GROMACS.pkg - sudo cp -R ~/MacOSX_Installers/QuteMolX_$QUTEMOLX_VERSION.pkg . - sudo mv QuteMolX_$QUTEMOLX_VERSION.pkg QuteMolX.pkg - sudo cp -R ~/MacOSX_Installers/pref_modifier.pkg . +# use the versions in the pre-built area if possible + cd metapackage/packages || exit 1 + sudo cp -R ~/MacOSX_Installers/NanoEngineer-1_v$VERSION_NUM.pkg . || exit 1 + sudo mv NanoEngineer-1_v$VERSION_NUM.pkg NanoEngineer-1.pkg || exit 1 + sudo cp -R ~/MacOSX_Installers/GROMACS_$GROMACS_VERSION.pkg . || exit 1 + sudo mv GROMACS_$GROMACS_VERSION.pkg GROMACS.pkg || exit 1 + sudo cp -R ~/MacOSX_Installers/QuteMolX_$QUTEMOLX_VERSION.pkg . || exit 1 + sudo mv QuteMolX_$QUTEMOLX_VERSION.pkg QuteMolX.pkg || exit 1 + sudo cp -R ~/MacOSX_Installers/pref_modifier.pkg . || exit 1 else # To be replaced later with something that searches for the pkg files + echo "Couldn't find pre-build packages" exit 1 fi + cd $PKNG_DIR/MacOSX -sudo rm -rf NanoEngineer-1_Suite -sudo rm -rf build rec +sudo rm -rf NanoEngineer-1_Suite build rec +# create the build directory area sudo mkdir build sudo mkdir build/NanoEngineer-1_Suite +# remove any old version of the doc used by package make to build the distro sudo rm -rf NE1_Suite.pmdoc +# expand the doc we need to build the distro tar -xzvf NE1_Suite.pmdoc.tar.gz +# insert the gromacs version into the default install directory cd NE1_Suite.pmdoc GROM_FILE=`ls *gromacs.xml` cat $GROM_FILE | sed -e "s:/Applications/GROMACS:/Applications/GROMACS_$GROMACS_VERSION:" > $GROM_FILE.tmp mv $GROM_FILE.tmp $GROM_FILE || exit 1 cd .. + +# create and populate the resources directory mkdir rec cp background.jpg rec +# make a welcome file for the installer cat Welcome_template.rtf | sed -e "s:VERSION_GOES_HERE:$VERSION_NUM:g" | sed -e "s:DATE_GOES_HERE:$DATECODE:g" > Welcome.rtf cp Welcome.rtf rec cp License.txt rec +# copy in the post install scripts cp post_*.sh rec + +Run the package builder sudo /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker -o build/NanoEngineer-1_Suite/NanoEngineer-1_Suite_v$VERSION_NUM.mpkg -d NE1_Suite.pmdoc + +# Code added to get around the race condition that seems to be a problem where +# hdiutil doesn't see the srcfolder unless the drive has been completely +# sync'd up sleep 10 sudo sync sleep 10 + +# Create the distribution dmg file sudo hdiutil create -srcfolder build/NanoEngineer-1_Suite -fs HFS+ -format UDZO build/NanoEngineer-1_Suite_v$VERSION_NUM.dmg +# Store the installers for use later or for upload if [ -e ~/MacOSX_Installers ] then cd build/NanoEngineer-1_Suite |