[gembud] Latest set of GEMPAK build instructions on OSX

Hi everyone,

I have finally had a chance to build GEMPAK on a Lion system. Thus, attached please find my latest set of build instructions for NAWIPS/GEMPAK 6.4.0 on Mac OSX. I have not
included GARP.

Enjoy, and please let me know what problems you run into ...

--Kevin

_____________________________________________
Kevin Tyle, Systems Administrator
Dept. of Atmospheric & Environmental Sciences
University at Albany
Earth Science 235, 1400 Washington Avenue
Albany, NY 12222
Email: ktyle@xxxxxxxxxx
Phone: 518-442-4578
_____________________________________________

Here is the procedure to build GEMPAK6.4.0 on Intel Mac OS X
10.6, 10.7 (Snow Leopard, Lion) with the GCC 4.5 compilers.  I believe it will
also work for 10.5 (Leopard).  I cannot say anything about earlier
versions/CPU's of OS X. The following steps should lead to a
successful build.

I have done all of these steps on a user account with admin privileges, with
use of "sudo" as noted below.  I have not done it as user "root", which is not
enabled by default.

1. Install Xcode on the host system.  Prior to Lion, this can be found as an
optional install on the install DVD, or (pre-Lion) you can download the latest
disk image of Xcode from the Apple Developer web site (you will have
to register in order to download the .dmg file)
http://developer.apple.com/technologies/tools/xcode.html

As of the release of Lion, Xcode is now available as a free app in the
App Store.  When the app is installed, a "Install XCode" file will
appear in the Applications Folder on your hard disk.  Double click
it to begin the installer.

2. Install the correct MacPorts package for your version of OSX from 
http://www.macports.org.  Once
installed, your .profile or .cshrc should have "/opt/local/bin" first
in your path.  Check to be sure this is the case before proceeding,
and resource your .profile or .cshrc if not.

3. Using MacPorts, install several packages (all necessary
pre-requisites of each package will automatically be downloaded and
installed first, similar to "yum install" in CentOS/Fedora flavors of
Linux).  Perform some configuration following the installation of
some of them.  The sequence is as follows:

  a. Install gcc45 (type:  "sudo port install gcc45")  This will take
a long time . .. perhaps even a couple hours if you are on a
slower/low-RAM system!
  b. Install gcc_select (type: "sudo port install gcc_select")
  c. Make gcc45 the default compiler:
  type "sudo port select gcc mp-gcc45"
  d. Install a variety of xorg packages, culminating with the
"libXtst" package (type: sudo port install xorg-libXtst")
  e. Install a varitey of packages that are prequisites for OpenMotif, which
  you will build from source in the next step.

  sudo port install fontconfig (will also install freetype)
  sudo port install jpeg
  sudo port install libpng
  sudo port install splint
  sudo port install xbitmaps
  sudo port install Xft2 (will also install xorg-renderproto and libXrender)
  sudo port install xorg-libXp (will also install xorg-printproto)
  sudo port install xorg-libXmu(will also install xorg-libXt, xorg-libsm, 
xorg-libice)
  sudo port install xpm

4. The graphical programs, such as NMAP2 and NWX, are based on 
the OpenMotif package.  This is no longer available from MacPorts,
so next we need to download and install OpenMotif 2.3.3. 
  a. Obtain the tarball from 
  
http://www.motifzone.net/files/public_downloads/openmotif/2.3/2.3.3/openmotif-2.3.3.tar.gz
  Untar this in a directory of your choice. cd into it.
  b. Once you have extracted OpenMotif 2.3.3, you will need to
modify one file to avoid a compile-time error: In the subdirectory
"clients/uil", modify line 286 of UilDefI.h thusly:
 -#if defined(linux)
 +#if defined(linux) || defined(__APPLE__)
  c. Set the CFLAGS and LDFLAGS environment variables: if using a
Bourne-like shell, type "export CFLAGS=-I/opt/local/include"; export
LDFLAGS="-L/opt/local/lib".  If using a C-like shell, type "setenv
CFLAGS -I/opt/local/include; setenv LDFLAGS -L/opt/local/lib".
  d. In the top level of OpenMotif 2.3.3, configure, build, and
install: (type "configure --prefix=/opt/local", then "make all", check that
there are no build errors (if so, you probably missed one of the "port install" 
steps above) and
"sudo make install").

5. You are now ready to build GEMPAK/N-AWIPS 6.4.0.  Extract the tar
file that you downloaded from Unidata, and modify Gemenviron or 
Gemenviron.profile depending on your
shell so that the environmental variable "NAWIPS" is set to the
correct directory path.  Then cd into the $NAWIPS directory (this is the parent 
directory 
of the GEMPAK/N-AWIPS directory tree).

6. Be sure you are cd'd into the top level GEMPAK6.4.0 directory at this time.
Type "make > make.out" which will build the package.  This may take a long time,
depending on the speed of your computer.  In a separate window, you can
watch the compilation process by typing "tail -f make.out".  Once done, verify 
there are no fatal errors noted in the make.out file (there should be two
non-critical "Error 2" messages but no "Error 1" messages).

7. If all went well, run "make install" and you should be
good-to-go!

Despite my best efforts, no doubt some folks will discover some
problems.  Although I have done some basic run-time testing once the
program has built, I cannot say for sure that there are bugs in the
OS X build which are not seen on other platforms.  Please let us know
via the GEMBUD list what you find, and also let me know about any
errors/typos/confusing parts in the steps enumerated above!