Port of synopsis to MACOSX - HOWTO

Brian Kelley <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
I've noticed at least one request for porting synopsis to MACOSX, here 
is how I did it.  First, install XCode if you haven't done this.  This 
should be available on one of your CD's or you can download it from 
apple.  The rest is pretty UNIXy, so be warned.

1) First download synopsis 0.7 and untar it to your home directory.

2) Download the MacOSX port of Graphviz 
(http://www.pixelglow.com/graphviz/), place this in the Applications 
folder.  Add the following line to your ~/.profile:

export PATH=$PATH:/Applications/Graphviz.app/Contents/MacOS/

This will help you run some of the tests cases.

3) In the file
synopsis-0.7/Synopsis/Parsers/Cpp/ucpp/eval.c

Change the line
#if defined(__CYGWIN__) || defined(__cygwin__) || defined(__WIN32__) || 
defined(__sun)

to

#if defined(__CYGWIN__) || defined(__cygwin__) || defined(__WIN32__) || 
defined(__sun)|| defined(__APPLE__)

4) Now the cute trick, apple g++ doesn't support the "-shared" flag, 
what you really want is "-bundle --undefined dynamic_lookup", you can 
replace the LDFLAGS, or, you can use this python script to replace g++.  
This has not failed for me so far and is far easier than mucking with 
configure. 

-- cut here --
#!/usr/bin/python
import sys, os
args = []
for v in sys.argv:
    if v == "-shared":
        args.append("-bundle -undefined dynamic_lookup")
    elif os.path.split(v)[-1] == "g++":
        args.append("/usr/bin/g++")
    else:
        args.append(v)
   
os.system(" ".join(args))
-- end cut --

copy this file to ~/local/bin/g++
chmod +x ~/local/bin/g++

and add this to your ~/.profile
export PATH=~/local/bin:$PATH
source the profile
source ~/.profile

Now "-shared" extensions will automatically become "-bundle -undefined 
dynamic_lookup" and you won't have to mess with LD_FLAGS anymore.

5) type python setup.py build
6) I got an error about missing Grammar.hh (this came from python's 
build directory that setup.py build creates).  I copied Grammar.cc.h to 
Grammar.hh (This fixed the problem, but might not be the correct thing 
to do here)

cp 
build/temp.darwin-7.5.0-Power_Macintosh-2.3/Synopsis/Parsers/C/Grammar.cc.h 
\
    
build/temp.darwin-7.5.0-Power_Macintosh-2.3/Synopsis/Parsers/C/Grammar.hh

Your path may be slightly different.

7) type python setup.py build 
You might get an "ar" error, if you do, just type "python setup.py 
build" again.  This only happened to me once...

8) One of the directories (the share) directory, doesn't get copied into 
the build directory so do this by hand:
cp -r ~/synopsis-0.7/share/ 
~/synopsis-0.7/build/lib.darwin-7.5.0-Power_Macintosh-2.3/

9) To test, point your python path to the build directory
export PYTHONPATH=~/synopsis-0.7/build/lib.darwin-7.5.0-Power_Macintosh-2.3/
cd demo/C++/GapBuffer
make

Now you will probablly die on the texi2pdf command, but you are on your 
own for that.

These changes should be fairly trivial to place in the makefiles and 
configures, but I'll leave that for someone else.

Brian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.