Installing Magic-7.1 on Mac OS X 10.3 and 10.4 (darwin) any platform

Magic -- VLSI layout editor (because some of us like it old-school)

(last updated 2007-04-06 by yours truly, Fang)

2007-04-06

I've updated scripts/config's generation of defs.mak to support $(DESTDIR)-staged installs, which is needed for fink/debian package-ability. (I should've done this years ago...) The latest CVS-mainline distribution of magic-7.1 is now magic-7.1-20070406.tar.gz, MD5 (magic-7.1-20070406.tar.gz) = 783cb2c585dd41fd7c7f5eaad81aa903. Note: this still uses the old interactive config in the build, and does not use any autotoolization -- the autotoolization work still remains on branch.

An *unofficial* fink package (undergoing validation) can be found here: magic71.info (tested under powerpc-darwin7, powerpc-darwin8, i686-darwin8). [Sourceforge package tracker item]
Update 2007-05-24: package has been accepted into the 10.4/unstable tree!
This pretty much follows the instructions I've outlined below, 2005-08-10. This installs magic and friends with program suffix -7.1 in the /prefix/ directory ($CAD_HOME), with a sym-links in the /prefix/bin directory. CAD_HOME is automatically set by a startup script, /prefix/etc/profile.d/magic71.[c]sh, sourced by /prefix/bin/init.[c]sh.


2006-11-15

I've finally gotten my hands on an Intel Mac to test portability. Fortunately, only one line change in the source (misc/magic.h) was needed to get things going. The latest CVS-mainline distribution of magic-7.1 is now magic-7.1-20061115.tar.gz, MD5 (magic-7.1-20061115.tar.gz) = bef6a8b7468909b1d55f27df5b8a0ac4. This was tested on i686-apple-darwin8's gcc-4.0.1 (build 5363), using a (fink-installed) readline-4.3. The same notes below apply for building on the Mac. (And yeah, I still intend to finish the GNU-autotoolization branch... when time permits.)


2006-07-08

I've backported the change to use ~/.magicrc instead of ~/.magic to magic-7.1 (refer to problem description below, under Known Issues). Also includes general header cleanups in preparation for GNU-autotool-ization. Tarball is here: magic-7.1-20060708.tar.gz, MD5 (magic-7.1-20060708.tar.gz) = 793f29ff1c305902c20e8d84102eeeee.

Plan: Preparing to fix sources to work with Intel Mac (endianness configuration), among other numerous portability issues, on CVS branch. Automake will create nicely maintainable distribution system, namely distcheck, allow VPATH builds. Non-recusive make for building binaries will solve broken cross-directory dependencies. No more shitty, outdated, error-prone interactive configure script. Preliminary work was easy and looks promising. Stay tuned.


2006-03-12

I've added some remarks about using readline below.

2006-02-07

I've committed my cleanup revisions to the CVS main trunk. You can follow the usual CVS checkout instructions or just grab the current tarball, magic-7.1-20060207.tar.gz. No patching should be necessary, but you may still have to hand-edit the generated defs.mak (include paths, libraries...), same drill as before.

2005-12-14

For the old-timers like me who grew up on magic-7.1, I've created a much cleaned up pre-release of magic-7.1. This (unofficial) snapshot contains NO behavioral changes relative to CVS HEAD, only clean-ups and fixes to make modern compilers happy. You can find it here: magic-7.1-20051125-fang-06.tar.gz (outdated)

You should NOT need to patch this snapshot, please follow the instructions below (under 2005-08-10) from Step 3 onward for building on Mac OS X. For other platforms, do what you have normally done before. This snapshot has been briefly tested on {gcc-3.3, 3.4, 4.0} x {i386-freebsd4.3, i686-linux-*, powerpc-apple-darwin}. Please report problems to magic-hackers AT vlsi DOT cornell DOT edu.


2005-08-10

Instructions for checking out the latest CVS snapshot of magic-7.1 can be found here. In its current state, magic-7.1 will not compile succesfully out-of-the-box on Mac OS X with gcc-4. Those of you familiar with more standard configuration and installation procedures will find magic's build system rather archaic (understatement). This patch should NOT break compiles on other platforms and compilers, and may even be needed for some of the platform-independent fixes included in this patch.
  1. Download this patch. This patch is known to work with the 2005-08-10 snapshot of magic-7.1, and will most likely work for revisions in the neighborhood.
    Summary:
  2. cd into the root directory of the source and apply the patch: patch -p0 < patchfile
    Optionally use --dry-run to see what would happen in simulation first.
  3. recommended: setenv CAD_HOME desired-install-path
  4. make config with the following answers:
    Display: X11, OS: FreeBSD 2.x, Machine: None (not Apple Mac II)
    Use default answers for module selection. (Non-manhattan geometry is optional.)
  5. Hand edit the generated defs.mak as follows:
    CADDIR     = wherever you want to install
    PROGRAM_SUFFIX = optional, but recommended if you keep multiple versions around
    
    CPP        = /usr/bin/cpp -P -traditional
    CPPFLAGS   = -I. -I${MAGICDIR} -I/sw/include
    DFLAGS     = -DUSE_READLINE -DNONMANHATTAN -DHAVE_READLINE
    CFLAGS     = whatever
    
    READLINE_LIBS = -L/sw/lib -lreadline
    
    This assumes you have readline-4.3 or higher installed through fink in the /sw directory. (If you want to use the readline that ships with magic, remove -DHAVE_READLINE and redirect the flags to ${MAGICDIR}/readline/readline.)
    Don't bother adding any warning flags to CFLAGS -- it will just spew out endless noise.
  6. make
  7. make install
  8. Currently, there is no way to configure with a custom program suffix, so if you want to add a suffix, you have to do it by hand post-installation.
  9. Don't forget to set your CAD_HOME environment variable to match CADDIR from defs.mak before running.

Remarks

This patch should work with OS X 10.3 and 10.4 (gcc-3.3 and gcc-4).

I'm also in the process of cleaning up the source so it compiles cleanly without warnings. (This is an incredibly lofty goal.) To say that the source code needs a facelift (and time-lift into the 21st century) would be a massive understatement. Status: mission sufficiently accomplished, available with the 20060207 snapshot, above. Thousands (8000+) of warnings reduced to around 80, using -Wall -W -ansi and now ANSI/ISO-compliant.

Known Issues

The .magic file may break the UNIX file command (added 2005-05-17, updated 2005-05-19, updated 2005-07-11)
This concerns users who work with magic and build open-source packages, either manually or with a manager such as fink. The file command is used to determine the contents of files such as dynamic shared libraries. (see man file) One undocumented feature of file is that it tries to read your home directory's .magic if it exists. Magic's .magic may break the file command because it is not in the format expected by file, rendering building against dynamic shared libraries dysfunctional in many cases. (My fink installation was broken for two whole years before I figured this out [frown].) The easy workaround is to move .magic out of the way during such builds, which is rather inconvenient. This realization was posted on fink-core@lists.sourceforge.net and has also been posted to the magic-dev@csl.cornell.edu mailing list (with some follow-up discussion). Afternote: magic-7.3(.87+) has been revised to look for .magicrc before .magic in one's home directory.

Readline (updated 2006-03-12) The readline bundled with magic-7.1 is version 4.1 and somewhat old. If you try to use it on Mac OS X, configure will fail because the config.guess and config.sub from autoconf/automake weren't aware of Darwin's existence at the time it was packaged; you will get a "host unknown" error at configure-time. One workaround I've tested is to manually replace those config scripts with newer versions (say, from autoconf-2.59, automake-1.9). (I then run into a link-time problem with undefined reference to rl_insert_text.) Until we re-package a newer version of readline with magic-7.1 (magic-7.2+ already have readline 4.3+), I would advise installing your own readline, as I've described above, at least on powerpc-apple-darwin. Fink's is known to work. You may have also noticed that OS X contains /usr/include/readline/readline.h and /usr/lib/libreadline.dylib, but these are actually a slightly old version of editline, a BSD-licensed readline substitute. The interface isn't a perfect substitute (e.g. a few missing functions), however, newer versions of the editline wrapper may work. Use with editline is not yet officially supported, but I will try to accommodate it after I autoconf-iscate magic-7.1 and write appropriate configuration tests for it.

Miscellaneous

Here's my personal .magicrc macro file. It adds some single-keystroke combinations for painting common layers and contacts. Also contains a few mappings to allow the use of option as alt on Mac keyboards. These macros were motivated by the days when I used a two-button mouse to do magic layout. ("Where's that paint?") A Jedi Layout Apprentice needs only one mouse-button. (The option-key modifies the mouse to emulate the middle-button, and the command(apple)-key emulates the right-button.) A Jedi Layout Master writes layout with no display in vi.

"Mouse buttons? Colored rectangles? A Jedi needs not such things."

[back to main]