The GNU Modula-2 front end to GCC

Building GNU Modula-2 under Mac OSX

The easiest way to build GNU Modula-2 under Mac OSX is to use macports. At the time of writing GNU Modula-2 is not an official mac port, however you can build it locally and produce your own testing release quite easily.

Firstly you must install macports http://www.macports.org/install.php. Secondly you need to modify your macports configuration file /opt//local/etc/macports/sources.conf so that it allows users to maintain private ports. This requires that you add the line:

file:///Users/yourusername/MacPorts/ports

which allows you to keep your own macports under $HOME/MacPorts/ports. Now download the GNU Modula-2 Portfile and build the port index.

$ mkdir -p $HOME/MacPorts/ports/lang/gm2-latest
$ cd $HOME/MacPorts/ports/lang/gm2-latest
$ curl http://floppsie.comp.glam.ac.uk/download/c/patches/gcc/4.1.2/Portfile \
  -o Portfile
$ cd $HOME/MacPorts/port
$ portindex
Creating software index in /Users/yourusername/MacPorts/ports
Adding port lang/gm2-latest

Total number of ports parsed:   1
Ports successfully parsed:      1
Ports failed:                   0
$ sudo port clean --all gm2-latest
--->  Cleaning gm2-latest
$ sudo port build gm2-latest
Password:
--->  Fetching gm2-latest
--->  Attempting to fetch gcc-core-4.1.2.tar.bz2 from ftp://ftp.lip6.fr/pub/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gcc-g++-4.1.2.tar.bz2 from ftp://ftp.lip6.fr/pub/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.lip6.fr/pub/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://www.mirrorservice.org/sites/ftp.gnu.org/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-4.1.2/
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-4.1.2/
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://arn.se.distfiles.macports.org/gm2-latest
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-4.1.2/
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.funet.fi/pub/gnu/prep//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://mirrors.kernel.org/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.chg.ru/pub/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://mirrors.ibiblio.org/pub/mirrors/gnu/ftp/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://distfiles.macports.org/gm2-latest
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.1.2/
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.dti.ad.jp/pub/GNU//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from ftp://ftp.unicamp.br/pub/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://mirror.aarnet.edu.au/pub/GNU//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://aarnet.au.distfiles.macports.org/pub/macports/mpdistfiles/gm2-latest
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://mirror.pacific.net.au/pub1/gnu/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://mirror.internode.on.net/pub/gnu//gcc/gcc-4.1.2
--->  Attempting to fetch gm2-cvs-latest.tar.bz2 from http://floppsie.comp.glam.ac.uk/download/c
--->  Verifying checksum(s) for gm2-latest
--->  Extracting gm2-latest
--->  Applying patches to gm2-latest
--->  Configuring gm2-latest
--->  Building gm2-latest

Now you can produce your own release of GNU Modula-2 via:

$ sudo port dmg gm2-latest
--->  Staging gm2-latest into destroot
--->  Creating pkg for gm2-latest-4.1.2
--->  Creating disk image for gm2-latest-4.1.2

You can run the regression testsuite by:

$ sudo port install dejagnu
$ cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gcc41/work/build/gcc
$ sudo make check-gm2
$ sudo make gm2.paranoid

Here is a simple script which enables you to download, build and test the latest GNU Modula-2 cvs snapshot:

#!/bin/bash

cd $HOME/MacPorts/ports/lang/gm2-latest
curl http://floppsie.comp.glam.ac.uk/download/c/patches/gcc/4.1.2/Portfile -o Portfile
cd $HOME/MacPorts/ports
portindex
cd $HOME
sudo port clean --all gm2-latest
sudo port build gm2-latest
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gcc41/work/build/gcc
sudo make gm2.paranoid
sudo make check-gm2