tINSTALL: fix build on Snow Leopard - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fa662c9571e92d5fc4f36414723bbaed1e11b278
 (DIR) parent a673ea22035ad986afc84d44543cd232218ddbe9
 (HTM) Author: Russ Cox <russcox@gmail.com>
       Date:   Fri, 11 Sep 2009 13:51:50 -0400
       
       INSTALL: fix build on Snow Leopard
       
       http://codereview.appspot.com/116073
       
       Diffstat:
         M bin/9a                              |       8 +++++++-
         M bin/9c                              |       4 ++--
         M bin/9l                              |       2 +-
         M src/cmd/eqn/e.h                     |       2 ++
         M src/cmd/grap/grap.h                 |       3 +++
         M src/cmd/pic/pic.h                   |       3 +++
         M src/cmd/tpic/pic.h                  |       3 +++
         M src/cmd/troff/tdef.h                |       2 ++
         M src/lib9/dirread.c                  |       4 ++++
         M src/libthread/threadimpl.h          |       3 +++
       
       10 files changed, 30 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/bin/9a b/bin/9a
       t@@ -5,5 +5,11 @@ if [ $# != 1 ]; then
                exit 1
        fi
        
       +aflags=""
       +case "`uname`" in
       +Darwin)
       +        aflags="-arch i386"
       +esac
       +
        out=`echo $1 | sed 's/\.s$//;s/$/.o/'`
       -exec as -o $out $1
       +exec as $aflags -o $out $1
 (DIR) diff --git a/bin/9c b/bin/9c
       t@@ -25,7 +25,7 @@ tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
        case "$tag" in
        *BSD*)        usegcc ;;
        *Darwin*)        usegcc 
       -                cflags="$ngflags -g3 -no-cpp-precomp" ;;
       +                cflags="$ngflags -g3 -no-cpp-precomp -m32" ;;
        *HP-UX*)        cc=cc; cflags="-g -O -c -Ae" ;;
        *Linux*)        usegcc 
                        case "${CC9:-gcc}" in
       t@@ -76,7 +76,7 @@ xtmp=/tmp/9c.$$.$USER.out
        $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
        status=$?
        grep -v '__p9l_autolib_' $xtmp |
       -egrep -v ': error: .Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|In file included from|        from|use of C99 long long|ISO C forbids conversion|Cursor. is deprecated|warn_unused_result' |
       +egrep -v ': error: .Each undeclared identifier|: error: for each function it appears|is dangerous, better use|is almost always misused|: In function |: At top level:|support .long long.|In file included from|        from|use of C99 long long|ISO C forbids conversion|is deprecated|warn_unused_result' |
        sed 's/ .first use in this function.$//; s/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' |
        uniq 1>&2
        rm -f $xtmp $xtmp.status
 (DIR) diff --git a/bin/9l b/bin/9l
       t@@ -46,7 +46,7 @@ case "$tag" in
                esac
                ;;
        *Darwin*)
       -        ld=gcc
       +        ld="gcc -m32"
                ;;
        *SunOS*)
                ld="${CC9:-cc} -g"
 (DIR) diff --git a/src/cmd/eqn/e.h b/src/cmd/eqn/e.h
       t@@ -18,6 +18,8 @@ extern int class[LAST][LAST];
        #define        max(x,y)        (((x) >= (y)) ? (x) : (y))        /* beware of side effects */
        #define        min(x,y)        (((x) <= (y)) ? (x) : (y))
        
       +#undef        sprintf        /* Snow Leopard */
       +
        extern        char        errbuf[200];
        extern        char        *cmdname;
        #define        ERROR        sprintf(errbuf,
 (DIR) diff --git a/src/cmd/grap/grap.h b/src/cmd/grap/grap.h
       t@@ -1,4 +1,7 @@
        extern        char        errbuf[200];
       +
       +#undef        sprintf        /* Snow Leopard */
       +
        #define        ERROR        sprintf(errbuf,
        #define        FATAL        ), yyerror(errbuf), exit(1)
        #define        WARNING        ), yyerror(errbuf)
 (DIR) diff --git a/src/cmd/pic/pic.h b/src/cmd/pic/pic.h
       t@@ -10,6 +10,9 @@
        extern        void        yyerror(char *);
        
        extern        char        errbuf[200];
       +
       +#undef        sprintf        /* Snow Leopard */
       +
        #define        ERROR        sprintf(errbuf,
        #define        FATAL        ), yyerror(errbuf), exit(1)
        #define        WARNING        ), yyerror(errbuf)
 (DIR) diff --git a/src/cmd/tpic/pic.h b/src/cmd/tpic/pic.h
       t@@ -12,6 +12,9 @@
        #define        dprintf        if(dbg)printf
        
        extern        char        errbuf[200];
       +
       +#undef        sprintf        /* Snow Leopard */
       +
        #define        ERROR        sprintf(errbuf,
        #define        FATAL        ), yyerror(errbuf), exit(1)
        #define        WARNING        ), yyerror(errbuf)
 (DIR) diff --git a/src/cmd/troff/tdef.h b/src/cmd/troff/tdef.h
       t@@ -68,6 +68,8 @@ typedef        struct        Tbuf        Tbuf;
        #define        oputs(a)        OUT "%s", a PUT
        #define        oput(c)                ( *obufp++ = (c), obufp > obuf+BUFSIZ ? flusho() : 1 )
        
       +#undef        sprintf        /* Snow Leopard */
       +
        extern        char        errbuf[];
        #define        ERROR        sprintf(errbuf,
        #define        WARN        ), errprint()
 (DIR) diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c
       t@@ -1,3 +1,7 @@
       +#if defined(__APPLE__)
       +#define _DARWIN_NO_64_BIT_INODE        /* Snow Leopard */
       +#endif
       +
        #include <u.h>
        #define NOPLAN9DEFINES
        #include <libc.h>
 (DIR) diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h
       t@@ -6,6 +6,9 @@
        #include <sched.h>
        #include <signal.h>
        #if !defined(__OpenBSD__)
       +#        if defined(__APPLE__)
       +#                define _XOPEN_SOURCE         /* for Snow Leopard */
       +#        endif
        #        include <ucontext.h>
        #endif
        #include <sys/utsname.h>