[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

script from Mattocks for building NetCDF on Mac OS X FC (fwd)



------- Forwarded Message

Date: Wed, 14 Mar 2001 01:41:04 -0500
To: Steve Emmerson <address@hidden>
From: "Craig A. Mattocks" <address@hidden>
Subject: NetCDF on Mac OS X FC (Build 4K78)

Hi Steve,

NetCDF 3.5 beta8 builds successfully under the Final Candidate of Mac 
OS X. Don't know how much will change prior to GM (Golden Master). 
Will keep you updated.

Small modification -- deleted Darwin reference to i386 architecture 
in /Developer/Makefiles/CoreOS/ReleaseControl/Common.make as a 
configure precaution.

- - Craig

#!/bin/sh
#################################################################
# This UNIX script builds the NetCDF (network Common Data Form) #
# library -- a machine-independent format for the creation,     #
# access, and sharing of scientific data -- under Mac OS X.     #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Info: http://www.unidata.ucar.edu/packages/netcdf/index.html  #
# Note: make this script executable with "chmod +x buildNetCDF" #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Errata:                                                       #
#       1. Log in as root to execute this script.               #
#       2. FORTRAN interface (using f2c) fails tests, so it is  #
#          currently deactivated. Working on this with Unidata. #
#################################################################

######################################
# Set trap to allow abort on signal: #
######################################
trap 'echo "Interrupted by signal" >&2; exit' 1 2 3 15

########################
# Specify source name: #
########################
export THE_SOURCE="netcdf-3.5-beta8"

echo "============"
echo "Build NetCDF"
echo "============"
echo "USAGE: ./buildNetCDF"

echo "---------------------------------------------"
echo "1. Downloading NetCDF source from the Unidata"
echo "   Program Center in Boulder, Colorado ...   "
echo "---------------------------------------------"
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/$THE_SOURCE.tar.Z
echo "... done."

echo "----------------------------------"
echo "2. Uncompressing NetCDF source ..."
echo "----------------------------------"
uncompress $THE_SOURCE.tar.Z
tar -xvf $THE_SOURCE.tar
compress $THE_SOURCE.tar
echo "... done."

echo "----------------------------------"
echo "3. Configuring the environment ..."
echo "----------------------------------"
export MAKE=/usr/bin/gnumake   # gnumake supports "include" syntax in makefiles
export CC=/usr/bin/cc          # Version gcc-926 based on gcc version 2.95.2
export CPPFLAGS="-O -DNDEBUG"
# export CPPFLAGS="-O -DNDEBUG -Df2cFortran"
export CFLAGS=-O
export CXX=/usr/bin/c++
export CXXFLAGS=-O
export FC=
export FFLAGS=
# export FC=/usr/local/bin/fc  # Fortran compiler is actually an f2c script
# export FFLAGS="-O -w -Nx400" # "-Nx400" allows fortran/netcdf.inc to have
                                #          many EXTERNAL statements
export F90=                    # f2c is not a rigorous f90 compiler

export RELCO="/Developer/Makefiles/CoreOS/ReleaseControl"
mv $RELCO/Common.make $RELCO/Common.make.orig
sed 's/ i386//' $RELCO/Common.make.orig > $RELCO/Common.make

cd $THE_SOURCE/src/
cp /usr/libexec/config.* ./
./configure --prefix=/usr > $HOME/netcdf.configure.log 2>&1
tail -5 $HOME/netcdf.configure.log
echo "... done. See $HOME/netcdf.configure.log for details."

echo "---------------------------------------------"
echo "4. Preparing Makefile for building NetCDF ..."
echo "---------------------------------------------"
mv macros.make macros.orig
sed 's/(prefix)\/man/(prefix)\/share\/man/' macros.orig > macros.make
echo "... done."

echo "----------------------"
echo "5. Building NetCDF ..."
echo "----------------------"
make
echo "... done."

#################################################
# Run NetCDF tests:                             #
# Eliminate reference to the math library (-lm) #
# since it is included the System framework and #
# and is linked by default under Mac OS X.      #
#################################################
cd nc_test
mv Makefile Makefile.orig
sed 's/ -lm//' Makefile.orig > Makefile
cd ..
echo "---------------------"
echo "6. Testing NetCDF ..."
echo "---------------------"
make test
echo "... done."

echo "------------------------"
echo "7. Installing NetCDF ..."
echo "------------------------"
if test ! -d /usr/share/man/man9; then
    mkdir -p /usr/share/man/man9
fi
make install
echo "... done."

echo "------------------"
echo "8. Cleaning up ..."
echo "------------------"
make clean
cd ..
echo "... All done!"

exit
------- End of Forwarded Message