MAGIC Magic Mailing List
 
 

From: Michael Doster (mtdos AT erols DOT com)
Date: Thu Jan 24 2002 - 18:16:47 EST

  • Next message: stefanos AT aeluros DOT com: "new photos from my party!"

    John,
    
    I've gotten Magic to compile on X.1; attached is a diff log of the 
    changes that I had to make after running the configure script setting 
    the OS to FreeBSD and the machine to macII.  I've sent the changes I 
    made to the source to the current Magic hackers, and Tim Edwards said he 
    would add the changes to the source when he gets a chance.  Best regards.
    
    -- Mike Doster
    
    John Nestor wrote:
    
    >I just got an ibook with OS 10.1 installed on it and though I would ask
    >if anyone has tried compiling Magic on here yet.  I'll probably try it
    >anyway, but anyone has encounter "gotchas" I'd like to hear about them.
    >
    >I've already installed XFree86, and down at the terminal window level,
    >OS 10.1 really does look kind of like Unix.
    >
    >Thanks!
    >
    >John Nestor, Associate Professor
    >Department of Electrical and Computer Engineering
    >Lafayette College
    >Easton, PA 18042
    >(610) 330-5411	nestorj AT lafayette DOT edu
    >
    >
    >
    
    
    
    Only in sources/magic-7.1.3/: README.darwin
    diff -r --ignore-space-change -c magic/defs.mak sources/magic-7.1.3/defs.mak
    *** magic/defs.mak	Fri Dec 28 17:29:35 2001
    --- sources/magic-7.1.3/defs.mak	Sun Dec 30 14:37:50 2001
    ***************
    *** 29,44 ****
      LD                     = ld -r
      RANLIB                 = ranlib
      
    ! CC                     = gcc
    ! CPP                    = /usr/libexec/cpp -P -traditional
      CPPFLAGS               = -I. -I${MAGICDIR} -I${MAGICDIR}/readline
    ! DFLAGS                 =  -DmacII -DUSE_READLINE -DUSE_NEW_MACROS
    ! CFLAGS                 = -g  -B /usr/lib/big/
      # These CFLAGS may include switches for an optimized compile
      # CFLAGS                 = -g  -B /usr/lib/big/ 
      
      READLINE_DEFS          = 
    ! READLINE_LIBS          =  -L${MAGICDIR}/readline/readline -lreadline -ltermcap
      
      DEPEND_FLAG            = -MM
      DEPEND_FILE            = Depend
    --- 29,44 ----
      LD                     = ld -r
      RANLIB                 = ranlib
      
    ! CC                     = cc
    ! CPP                    = /usr/bin/cpp -P
      CPPFLAGS               = -I. -I${MAGICDIR} -I${MAGICDIR}/readline 
    ! DFLAGS                 =  -DmacII -DUSE_READLINE -DUSE_NEW_MACROS -Dmacosx
    ! CFLAGS                 = -g  -O2 -traditional
      # These CFLAGS may include switches for an optimized compile
      # CFLAGS                 = -g  -B /usr/lib/big/ 
      
      READLINE_DEFS          = 
    ! READLINE_LIBS          =  -L${MAGICDIR}/readline/readline -lreadline -L/usr/local/lib -lncurses
      
      DEPEND_FLAG            = -MM
      DEPEND_FILE            = Depend
    diff -r --ignore-space-change -c magic/graphics/X11Helper.c sources/magic-7.1.3/graphics/X11Helper.c
    *** magic/graphics/X11Helper.c	Fri Oct 19 09:38:53 2001
    --- sources/magic-7.1.3/graphics/X11Helper.c	Sun Dec 30 14:39:23 2001
    ***************
    *** 71,77 ****
      {
          XEvent xevent;
      
    ! #ifdef macII
          set42sig();
      #endif macII
      
    --- 71,77 ----
      {
          XEvent xevent;
      
    ! #if defined(macII) && !defined(macosx)
          set42sig();
      #endif macII
      
    diff -r --ignore-space-change -c magic/lisp/other/X11Helper.c sources/magic-7.1.3/lisp/other/X11Helper.c
    *** magic/lisp/other/X11Helper.c	Fri Oct 19 09:38:56 2001
    --- sources/magic-7.1.3/lisp/other/X11Helper.c	Sun Dec 30 14:40:11 2001
    ***************
    *** 49,55 ****
      {
          XEvent xevent;
      
    ! #ifdef macII
          set42sig();
      #endif macII
      
    --- 49,55 ----
      {
          XEvent xevent;
      
    ! #if defined(macII) && !defined(macosx)
          set42sig();
      #endif macII
      
    diff -r --ignore-space-change -c magic/lisp/other/main.c sources/magic-7.1.3/lisp/other/main.c
    *** magic/lisp/other/main.c	Fri Oct 19 09:38:56 2001
    --- sources/magic-7.1.3/lisp/other/main.c	Sun Dec 30 14:40:58 2001
    ***************
    *** 835,841 ****
          char *argv[];
      {
      
    ! #ifdef macII
          set42sig();
      #endif macII
          mainInitBeforeArgs(argc, argv);
    --- 835,841 ----
          char *argv[];
      {
      
    ! #if defined(macII) && !defined(macosx)
          set42sig();
      #endif macII
          mainInitBeforeArgs(argc, argv);
    diff -r --ignore-space-change -c magic/main/main.c sources/magic-7.1.3/main/main.c
    *** magic/main/main.c	Fri Oct 19 09:38:57 2001
    --- sources/magic-7.1.3/main/main.c	Sun Dec 30 16:31:51 2001
    ***************
    *** 897,903 ****
          char *argv[];
      {
      
    ! #ifdef macII
          set42sig();
      #endif macII
          mainInitBeforeArgs(argc, argv);
    --- 897,903 ----
          char *argv[];
      {
      
    ! #if defined(macII) && !defined(macosx)
          set42sig();
      #endif macII
          mainInitBeforeArgs(argc, argv);
    diff -r --ignore-space-change -c magic/misc/magic.h sources/magic-7.1.3/misc/magic.h
    *** magic/misc/magic.h	Fri Oct 19 09:38:57 2001
    --- sources/magic-7.1.3/misc/magic.h	Sun Dec 30 14:41:40 2001
    ***************
    *** 297,303 ****
      
      #ifndef  __STDC__
      #ifndef	SYSV
    ! #ifndef ALPHA
          extern char* sprintf();
      #endif
      #endif
    --- 297,303 ----
      
      #ifndef  __STDC__
      #ifndef	SYSV
    ! #if !defined(ALPHA) && !defined(macosx)
          extern char* sprintf();
      #endif
      #endif
    diff -r --ignore-space-change -c magic/netlist/netlist.c sources/magic-7.1.3/netlist/netlist.c
    *** magic/netlist/netlist.c	Fri Oct 19 09:38:58 2001
    --- sources/magic-7.1.3/netlist/netlist.c	Sun Dec 30 14:42:30 2001
    ***************
    *** 366,371 ****
    --- 366,373 ----
          static char tempId[100];
      #if defined(linux) || defined(CYGWIN)
          extern int etext asm("etext");
    + #elif defined(macosx)
    +   int etext;
      #else
       extern int etext;
      #endif
    diff -r --ignore-space-change -c magic/plot/plotInt.h sources/magic-7.1.3/plot/plotInt.h
    *** magic/plot/plotInt.h	Fri Oct 19 09:38:59 2001
    --- sources/magic-7.1.3/plot/plotInt.h	Sun Dec 30 14:43:08 2001
    ***************
    *** 27,33 ****
      #endif	_GEOMETRY
      
      /* system V machines lack vfont.h, so include the defs below. */
    ! #if  !defined(SYSV) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(CYGWIN)
      #include <vfont.h>
      #else
      struct header {
    --- 27,33 ----
      #endif	_GEOMETRY
      
      /* system V machines lack vfont.h, so include the defs below. */
    ! #if  !defined(SYSV) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(CYGWIN) && !defined(macosx)
      #include <vfont.h>
      #else
      struct header {
    diff -r --ignore-space-change -c magic/readline/Makefile sources/magic-7.1.3/readline/Makefile
    *** magic/readline/Makefile	Fri Oct 19 09:39:00 2001
    --- sources/magic-7.1.3/readline/Makefile	Wed Nov 28 18:05:08 2001
    ***************
    *** 10,16 ****
      
      readline/libreadline.a:
      	@echo --- building GNU readline
    ! 	cd readline; CC="${CC}" CFLAGS="${CFLAGS}" LOCAL_DEFS="${READLINE_DEFS}" ./configure; ${MAKE}
      
      clean:
      	-(cd readline && ${MAKE} distclean)
    --- 10,16 ----
      
      readline/libreadline.a:
      	@echo --- building GNU readline
    ! 	cd readline; CC="${CC}" CFLAGS="${CFLAGS}" LOCAL_DEFS="${READLINE_DEFS}" ./configure powerpc-apple-darwin1.4; ${MAKE}
      
      clean:
      	-(cd readline && ${MAKE} distclean)
    Only in sources/magic-7.1.3/readline/readline: config.guess
    Only in sources/magic-7.1.3/readline/readline: config.sub
    diff -r --ignore-space-change -c magic/resis/ResRex.c sources/magic-7.1.3/resis/ResRex.c
    *** magic/resis/ResRex.c	Fri Oct 19 09:39:03 2001
    --- sources/magic-7.1.3/resis/ResRex.c	Sun Dec 30 15:40:59 2001
    ***************
    *** 8,14 ****
      #include <math.h>
      
      /* It is hard to get the value of MAXFLOAT in a portable manner. */
    ! #if defined(ibm032) || defined(CYGWIN) 
      #define MAXFLOAT        ((float)3.40282346638528860e+38)
      #elif !defined(__NetBSD__)
      #include <values.h>
    --- 8,14 ----
      #include <math.h>
      
      /* It is hard to get the value of MAXFLOAT in a portable manner. */
    ! #if defined(ibm032) || defined(CYGWIN) || defined(macosx)
      #define MAXFLOAT        ((float)3.40282346638528860e+38)
      #elif !defined(__NetBSD__)
      #include <values.h>
    diff -r --ignore-space-change -c magic/utils/getrect.c sources/magic-7.1.3/utils/getrect.c
    *** magic/utils/getrect.c	Fri Oct 19 09:39:10 2001
    --- sources/magic-7.1.3/utils/getrect.c	Sun Dec 30 15:42:29 2001
    ***************
    *** 62,68 ****
      #define	FILE_PTR(fin)	((char *) fin->_IO_read_ptr)
      #define FILE_DEC_CNT(fin, n)	
      #define	FILE_SET_PTR(fin, cp) ((fin)->_IO_read_ptr = (cp))
    ! #elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(CYGWIN)
      #define FILE_CNT(fin)   ((fin)->_r)
      #define FILE_PTR(fin)   ((char *)(fin)->_p)
      #define FILE_DEC_CNT(fin, n)  ((fin)->_r -= (n))
    --- 62,68 ----
      #define	FILE_PTR(fin)	((char *) fin->_IO_read_ptr)
      #define FILE_DEC_CNT(fin, n)	
      #define	FILE_SET_PTR(fin, cp) ((fin)->_IO_read_ptr = (cp))
    ! #elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(CYGWIN) || defined(macosx)
      #define FILE_CNT(fin)   ((fin)->_r)
      #define FILE_PTR(fin)   ((char *)(fin)->_p)
      #define FILE_DEC_CNT(fin, n)  ((fin)->_r -= (n))
    diff -r --ignore-space-change -c magic/utils/runstats.c sources/magic-7.1.3/utils/runstats.c
    *** magic/utils/runstats.c	Fri Oct 19 09:39:10 2001
    --- sources/magic-7.1.3/utils/runstats.c	Sun Dec 30 15:43:04 2001
    ***************
    *** 31,38 ****
    --- 31,43 ----
      
      /* Library imports: */
      
    + #if !defined(macosx)
      extern char *sbrk();
      extern end;
    + #else
    + extern void *sbrk();
    + int end;
    + #endif
      
      /*
       * ----------------------------------------------------------------------------
    
    
    Author: Michael Doster (mtdos AT erols DOT com)
    Date: January 6, 2002
    
    This README file documents the changes necessary to successfully compile magic 7.1.x under Mac OS X.1
    
    0. Before messing with the magic source to work in OS X land, make sure you
       have the following items:
       a. XFree86 4.1 for Darwin (pay a visit to ftp.xfree86.org)
       b. most current version of XDarwin that is compatible with X.1
          (go to www.xdarwin.org for the most recent version; as I write
          this the most current is version 1.0.6 for X.0.4 and X.1)
       c. GNU ncurses library ( a precompiled version for Darwin can be downloaded
          from gnu-darwin.sourceforge.net )
    1. run 'make config' as instructed and choose FreeBSD as the OS and macII as the machine.
    2. edit the defs.mak file to make the following changes:
    
      CC                     = cc
      CPP                    = /usr/bin/cpp -P
      CFLAGS                 = -g  -O2 -traditional
      DFLAGS                 =  -DmacII -DUSE_READLINE -DUSE_NEW_MACROS -Dmacosx
      READLINE_LIBS          =  -L${MAGICDIR}/readline/readline -lreadline -L/usr/local/lib -lncurses
      GR_CFLAGS              = -I/usr/X11R6/include
      GR_LIBS                =  -L/usr/X11R6/lib -lX11
    
    2b. The last 3 variables should be user dependent depending on where on your system the include and lib directories for X11
        are located.  Also originally READLINE_LIBS wanted libtermcaps which I changed to libncurses which replaces libtermcaps
        and put in a system dependent -L statement to where it's located
    
    3. Under directory readline, modify the Makefile like so:
    
      cd readline; CC="${CC}" CFLAGS="${CFLAGS}" LOCAL_DEFS="${READLINE_DEFS}" ./configure powerpc-apple-darwin1.4; ${MAKE}
    


  •  
     
    Questions? Contact Rajit Manohar
    cornell logo