Building NEdit 5.5 on an Intel Mac

What is this?

This page was written in 2006. It explains how to build NEdit for use with an Intel Macintosh.

Background

I use NEdit daily at work and occasionally on my G4. When I began to equip my new MacBook with my favorite programs I realized that no “Mac OS X Intel” version was available. So I took a look at the NEdit mailing list archives and found that indeed, someone had already asked about it. No downloadable solution was given, but this informative response got me most of the way there.

Here’s a summary of how to do it:

  1. Download OpenMotif for Mac OS X Intel
  2. Download the NEdit source code
  3. Modify NEdit’s Mac OS X makefile
  4. Make NEdit

My MacBook has Mac OS X 10.4.7 with X11 and the XCode developer tools installed. Your mileage may vary with other configurations.

Note that for the purpose of building NEdit it is not necessary to install OpenMotif or the NEdit source code in any particular location (although you may wish to do so). I left all the files in my downloads folder (~/Documents/Queue). All the example commands that appear on this page should be issued from within this directory (or whatever directory you use instead).

It may be possible to build a “Universal” version of NEdit with suitable compiler options since a universal version of OpenMotif is available, but I do not know.

Downloading OpenMotif

I downloaded OpenMotif 2.2.3 from DonaldsonLab’s Scientific Software for Mac OS X page. The file I downloaded was http://dryden.biol.yorku.ca/macosx/packages/openmotif-2.2.3-intel.tar.gz.

All you have to do with the OpenMotif distribution is expand it:

> gunzip openmotif-2.2.3-intel.tar.gz
> tar xvf openmotif-2.2.3-intel.tar

This will produce a folder named openmotif-2.2.3-intel. You may delete the tar file since it is no longer needed:

> rm openmotif-2.2.3-intel.tar

Actually, you might as well do this and the next two steps from the Finder.

Downloading NEdit’s Source Code

I downloaded the source code for NEdit 5.5 from one of the NEdit download mirrors. The specific file I downloaded was http://nl.nedit.org/ftp/v5_5/nedit-5.5-src.tar.gz.

Unpack the source code:

> gunzip nedit-5.5-src.tar.gz
> tar xvf nedit-5.5-src.tar
> rm nedit-5.5-src.tar

Editing the Makefile

There are two changes that need to made to NEdit’s Mac OS X makefile. The first is to indicate the location of the Intel-compatible OpenMotif distribution you just downloaded. The second is to include editres options to prevent undefined symbol link errors.

First, move into the NEdit directory and open the Mac OS X makefile:

> cd nedit-5.5
> open makefiles/Makefile.macosx

Find the line that defines MOTIFDIR. It is probably set to /usr/local by default. Change it to the path of the openmotif-2.2.3-intel directory expanded above. In my case, line 12 now reads:

MOTIFDIR=/Users/anoved/Documents/Queue/openmotif-2.2.3-intel

Then, follow the instructions in the makefile comments for enabling editres. This means adding -DEDITRES to the list of CFLAGS options and -lXmu to the list of LIBS. The revised CFLAGS and LIBS definitions should look like this:

CFLAGS=-O -no-cpp-precomp -mdynamic-no-pic -DNO_XMIM -I/usr/X11R6/include \
        -I${MOTIFDIR}/include -DUSE_DIRENT -DUSE_LPR_PRINT_CMD -DEDITRES
LIBS= ${EXTRALINKFLAGS} -L/usr/X11R6/lib ${MOTIFLINK} -lXp \
        -lXpm -lXext -lXt -lSM -lICE -lX11 -lXmu

You can now save and close the makefile.

Making NEdit

Compile NEdit with the following command:

> make macosx

This generates nedit and nc (the NEdit Client) in the source subdirectory. You’ll need to install these executables in an appropriate location yourself. I put them in /usr/local/bin, but this location does not exist by default. (Don’t forget to add any custom locations to your PATH environment variable.) Note that nc is also the name of the “netcat” program that ships with Mac OS X, so you may want to sort your PATH accordingly to make sure you get your preferred program.

Intel Mac NEdit screenshot


Building a Distribution

The main NEdit makefile includes a dist-bin target that prepares packages suitable for distribution. However, I could not get the distribution executables to run until I added some options to the strip command.

Open the main NEdit makefile:

> open Makefile

Edit the strip command in the dist-bin section to include the options -x and -S (based on the options used to compile Universal Mozilla applications). The strip command should now read:

strip -x -S $(RELEASE)/nedit $(RELEASE)/nc

Save and close the makefile. Now you can prepare a distribution:

> make docs
> make dist-bin

Downloads

This Mac OS X Intel build of NEdit is now available from the NEdit download mirrors as nedit-5.5-MacOSX-intel.tar.gz.