So, I just got a new mac and I wanted it to act like my linux box so
I could develop wherever I took it.
The first thing I needed to do was install XCode tools which gives
you normal command line things like gcc and cvs.
Go to
Applications/Installers/Xcode Tools/
and click XcodeTools.mpkg
I wanted the gnu scientific library and the tiff library.
There are places you can download these but first you have to
download software to help with the downloading! The software names
are port and fink. Between them you can get
the open source packages you're used to having in linux.
Open GL and GLUT
I also wanted to run openGL and GLUT. These come installed but in Mac,
anything tied to the platform is kept in a "framework" and you are not
allowed to see the libraries or header files. You need to add to the
makefile
LIBS := -framework Cocoa -framework OpenGL -framework GLUT -framework
Foundation -lstdc++
In my app I added the conditional statement
#if defined(__APPLE__)&& defined(__MACH__)
#include <GLUT/glut.h >
#include <OpenGL/gl.h >
#include <OpenGL/glu.h>
#include <tiffio.h>
#else
#include <GL/glx.h> /* this includes the necessary X headers
*/
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <tiffio.h> //take tiff snapshot, draw texture map
#endif
LaTex
To get command line latex for writing papers, I needed to do
fink teTex
It takes a while to load beacuse it depends on ghostscript. To run it:
/sw/bin/latex
/sw/bin/bibtex
if you have a makefile and and an environment variable for your bib files,
mac uses export rather than setenv.
tcl/tk
Finally, I needed tcl/tk. I chose fink
fink install tcltk tcltk-dev
tcltk-shlibs
In fink, the shared libraries get installed in /sw/lib and the extension
is .dylib
However, I later I learned that AS MUCH AS POSSIBLE, try to use the
preinstalled versions. They can be found in /Library so your make file
should say
TCL_INCLUDES = -I/Library/Frameworks/Tcl.framework/Headers
-I/Library/Frameworks/Tk.framework/Headers
and
TCL_LIBRARY = -framework Tcl -framework Tk
Notes: I just installed OS X tiger and used the latest version of darwin
ports, which auto-installs from a .dmg file. port puts libraries in
/opt/local/lib and header files in /opt/local/include
ports creates .dylib files which are like shared libraries. You can link
to them in a makefile just like you would to a static library, ending in .a
Here's a lttle note about mac os x shared library paths from the build
instructions for xerces-c:
"On Linux and Solaris, the environment variable name is called
LD_LIBRARY_PATH, on AIX it is LIBPATH, on Mac OS X it is
DYLD_LIBRARY_PATH, while on HP-UX it is SHLIB_PATH."
GLUI
I like this little platform-independent widget kit that works
with OpenGL and glut. Eventually you will be able to get it from fink,
but for now a little twiddling is required to get it going.
In the makefile, you don't need any includes , just use
gcc -framework Cocoa -framework OpenGL -framework GLUT
also, the includes for glut must be
placed in subdirectory GL or changed from
#include <GL/glut.h >
to
#include <GLUT/glut.h>
in about 7 files. Finally, it wants to place the archived libarary in lib,
so either create the directory or edit the makefile. If you are using
version 2.35 you need the additional step of ranlib, e.g.
ranlib libglui.a
last updated May 28, 2006