Subject: Re: pkg/32971 (cad/qcad macros undefined on MacOS X)
To: None <darwin-pkg-people@netbsd.org, gnats-admin@netbsd.org,>
From: John D. Baker <jdbaker@mylinuxisp.com>
List: pkgsrc-bugs
Date: 03/09/2006 14:35:20
The following reply was made to PR pkg/32971; it has been noted by GNATS.

From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@netbsd.org
Cc: "John D. Baker" <jdbaker@mylinuxisp.com>
Subject: Re: pkg/32971 (cad/qcad macros undefined on MacOS X)
Date: Thu, 9 Mar 2006 08:33:41 -0600

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 I've tested and confirmed that additional macros in the qcad  
 distribution
 Makefile and augmented OS type check in "rprgdef.h" allows qcad to build
 properly on MacOS X.
 
 The first modification augments the conditional compilation  
 directives in
 rprgdef.h.  It is essentially an enhanced version of 'patches/patch-ac'
 and could be implemented as-is with no adverse effect.  As follows:
 
 - --- work/qcad-1.5.4/rprgdef.h.orig      2002-09-20 12:26:57.000000000  
 - -0500
 +++ work/qcad-1.5.4/rprgdef.h   2006-03-06 14:02:30.000000000 -0600
 @@ -22,16 +22,27 @@
   //#define DEF_LESS_DIALOGS    // Don't show the startup dialog
 
 
 +// Define one of
 +//  DEF_LINUX
 +//  DEF_SOLARIS
 +//  DEF_WINDOWS
 +//  DEF_BSD
 +//  DEF_IRIX
 +
 +#define DEF_BSD
 +
   // Uncomment for Linux
 - -#define DEF_LINUX           // Are we running Linux?
 +#ifdef DEF_LINUX           // Are we running Linux?
   #define RUNNING_LINUX   true
   #define RUNNING_WINDOWS false
   #define RUNNING_SOLARIS false
   #define RUNNING_IRIX    false
 - -#define DATADIR         "/usr/share"
 +#endif
 
 +#define DATADIR         "/usr/pkg/share"
 
 - -#ifdef __FreeBSD__
 +
 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined 
 (__OpenBSD__) ||  defined(__DragonFly__) || defined(__DARWIN__)
   #define DEF_FREEBSD
   #undef DEF_LINUX
   #define RUNNING_LINUX   true    // close enough
 @@ -42,35 +53,30 @@
 
 
   // Uncomment for Solaris
 - -/*
 - -#define DEF_SOLARIS           // Are we running Solaris?
 +#ifdef DEF_SOLARIS           // Are we running Solaris?
   #define RUNNING_SOLARIS true
   #define RUNNING_WINDOWS false
   #define RUNNING_LINUX   false
   #define RUNNING_IRIX    false
 - -*/
 +#endif
 
 
   // Uncomment for Windoze
 - -/*
 - -#define DEF_WINDOWS           // Iiiik - we're running windoze!!!
 +#ifdef DEF_WINDOWS           // Iiiik - we're running windoze!!!
   #define RUNNING_WINDOWS true
   #define RUNNING_LINUX   false
   #define RUNNING_SOLARIS false
   #define RUNNING_IRIX    false
 - -*/
 - -
 +#endif
 
 
   // Uncomment for IRIX
 - -/*
 - -#define DEF_SGI               // Are we running IRIX?
 +#ifdef DEF_SGI               // Are we running IRIX?
   #define RUNNING_SOLARIS false
   #define RUNNING_WINDOWS false
   #define RUNNING_LINUX   false
   #define RUNNING_IRIX    true
 - -*/
 - -
 +#endif
 
   #ifdef DEF_SOLARIS
   #define true 1
 
 
 The second, a patch for the distribution Makefile, would have to be
 selectively applied based on OSTYPE.  It amounts to a modification of
 "patches/patch-aa", but couldn't be applied via the patch mechanism,
 since it's platform-specific:
 
 - --- work/qcad-1.5.4/Makefile.orig       2002-09-20 12:26:57.000000000  
 - -0500
 +++ work/qcad-1.5.4/Makefile    2006-03-06 14:02:00.000000000 -0600
 @@ -8,20 +8,20 @@
 
   ####### Compiler, tools and options
 - -CC       = gcc
 - -CXX      = g++
 - -LEX      = flex
 - -YACC     = yacc
 - -CFLAGS   = -pipe -Wall -W -O2  -DQT_NO_DEBUG
 - -CXXFLAGS = -pipe -Wall -W -O2  -DQT_NO_DEBUG
 +CC       ?= gcc
 +CXX      ?= g++
 +LEX      ?= flex
 +YACC     ?= yacc
 +CFLAGS   += -Wall -W -DQT_NO_DEBUG -D__DARWIN__
 +CXXFLAGS += -Wall -W -DQT_NO_DEBUG -D__DARWIN__
   LEXFLAGS =
   YACCFLAGS= -d
 - -INCPATH  = -I$(QTDIR)/include -I$(QTDIR)/mkspecs/linux-g++
 +INCPATH  = -I$(QTDIR)/include -I$(X11BASE)/include
   LINK     = g++
   LFLAGS   =
 - -LIBS     = $(SUBLIBS)  -Wl,-rpath,$(QTDIR)/lib  -L$(QTDIR)/lib  -L/ 
 usr/X11R6/lib -lqt -lXext -lX11 -lm
 - -AR       = ar cqs
 - -RANLIB   =
 +LIBS     = -Wl,-R$(QTDIR)/lib -L$(QTDIR)/lib -Wl,-R$(X11BASE)/lib -L$ 
 (X11BASE)/lib -Wl,-R$(LOCALBASE)/lib -L$(LOCALBASE)/lib -lqt-mt -lGLU  
 - -lGL -lXmu -lXext -lX11 -lm -lSM -lICE -lXmu -lpng -lz -ljpeg $ 
 {PTHREAD_LDFLAGS} ${PTHREAD_LIBS}
 +AR       ?= ar cqs
 +RANLIB   ?=
   MOC      = $(QTDIR)/bin/moc
   UIC      = $(QTDIR)/bin/uic
   QMAKE    = qmake
 @@ -1766,6 +1766,9 @@
 
   moc_rappwin.o: moc_rappwin.cpp rappwin.h ractiondef.h \
                  rprgdef.h
 +.if (${MACHINE_ARCH} == "alpha")
 +       $(CXX) -c $(CXXFLAGS_NOOPT) $(INCPATH) -o $@ moc_rappwin.cpp
 +.endif
 
   moc_rattribdialog.o: moc_rattribdialog.cpp rattribdialog.h  
 rcombobox.h \
                  rgraphdef.h \
 @@ -1836,6 +1839,9 @@
                  rtypes.h \
                  rprgdef.h \
                  rmathdef.h
 +.if (${MACHINE_ARCH} == "alpha")
 +       $(CXX) -c $(CXXFLAGS_NOOPT) $(INCPATH) -o $@ moc_rgraphic.cpp
 +.endif
 
   moc_rgroupbox.o: moc_rgroupbox.cpp rgroupbox.h
 
 
 Perhaps there's a post-patch/pre-configure make target that could
 test OSTYPE and append the "-D__DARWIN__" to the CFLAGS and CXXFLAGS
 macros if Darwin is the target OS?
 
 - --
 John D. Baker, KN5UKS                    NetBSD     Darwin/MacOS X
 http://mylinuxisp(dot)com/(tilde)jdbaker/     OpenBSD            FreeBSD
 BSD -- It just sits there and _works_!
 GnuPG fingerprint = D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645
 
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2 (Darwin)
 
 iD8DBQFEEDzSlXKPI+StFkURAhv1AJ0fdcacMKRbzX168WfJiPfQi7FsIACfRGva
 7dvTMYGgeGE4kpyAmsR63hY=
 =5Niz
 -----END PGP SIGNATURE-----