(last updated 2007-04-06 by yours truly, Fang)
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
.
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.)
~/.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.
defs.mak
(include paths, libraries...), same drill as before.
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.
varargs.h
to stdarg.h
__APPLE__
which will have
to change in the future once Intel Macs roll out
along side PowerPCs.
PROGRAM_SUFFIX
to the installed binaries with this patch. See step 4.
magic/proto.magic
cpp-clean, which
would often cause errors during make install.
cd
into the root directory of the source and
apply the patch: patch -p0 < patchfile
--dry-run
to see what would happen in simulation first.
setenv CAD_HOME
desired-install-path
make config
with the following answers:
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 -lreadlineThis 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
.)
make
make install
CAD_HOME
environment variable to
match CADDIR
from defs.mak
before running.
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.
.magic
file may break the UNIX file
command
(added 2005-05-17, updated 2005-05-19, updated 2005-07-11)
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.
.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."