g77 on MacOS X

Before you begin, you need to have Apple's developer tools (Dec2001DevTools). If you just want to use my precompiled gcc-with-g77 package, get an RPM package from here. If you want to build g77 for yourself, follow the instruction below.

g77 Building Procedure

Extract libf2c and gcc/f from the standard gcc-2.95.2 and place them in Apple's gcc-932.1-6 tree:

$ tar -zxvf gcc-932.1-6.tar.gz
$ mv gcc-6 gcc-2.95.2-g77
$ tar -zxvf <somewhere>/gcc-2.95.2-g77.tar.gz
$ mv gcc-2.95.2-g77 gcc-6

and then apply my private patch and make:

$ patch -p1 -s < <somewhere>/gcc-2.95.2-macosx-10.1.patch
$ su
# ln -s /usr/bin/nmedit /usr/local/bin/.
$ export RC_ARCHS=ppc
$ export RC_CFLAGS='-arch ppc'
$ export RC_OS='macos'
$ export TARGETS=ppc
$ export HOSTS=ppc
$ export SRCROOT=`pwd`
$ make install >& install.log &

Then build libg2c.a (dynamic)

$ patch -p1 -s < ../patches/gcc-2.95.2-libg2c.patch
$ cd gcc
$ for i in ../obj/cc-ppc-on-ppc/*.h; do ln -s $i .; done
$ cd ..
$ mkdir obj/ppc/libf2c
$ pushd obj/ppc/libf2c
$ CFLAGS='-traditional-cpp' $SRCROOT/libf2c/configure --srcdir=$SRCROOT/libf2c --host=ppc --target=ppc
$ make >& make.log &
$ cp -pP libg2c.a ../../../dst/usr/lib/gcc/darwin/2.95.2/

$ cp g2c.h ../../../dst/usr/include/gcc/darwin/2.95.2/
$ ln -s gcc/darwin/2.95.2/g2c.h ../../../dst/usr/include/.
$ ln -s gcc/darwin/default/libg2c.a ../../../dst/usr/lib/libg2c.a
$ cd ../../cc-ppc-on-ppc/
$ cp g77 ../../dst/usr/bin/f77
$ cp f771 ../../dst/usr/libexec/gcc/darwin/ppc/2.95.2/
$ su
# cd ../../dst
# chown -R root:wheel usr
# pushd usr/bin
# ln -s c++ g++
# ln -s cc gcc
# ln -s f77 g77
# popd
# gnutar -zcvf <somewhere>/gcc-with-g77-932.1-1c-bin.tar.gz usr/

How to Install a Precompiled Binary Package

A binary package is available as an RPM which can be installed as

# rpm -ivh gcc-with-g77-932.1-1c.ppc.rpm


Back to Keisuke Fujii's HEP on X Page
fujiik@jlcuxf.kek.jp March 18, 2001