Subject: pkg/32971: cad/qcad macros undefined on MacOS X
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdbaker@mylinuxisp.com>
List: pkgsrc-bugs
Date: 03/02/2006 23:00:00
>Number:         32971
>Category:       pkg
>Synopsis:       cad/qcad macros undefined on MacOS X
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 02 23:00:00 +0000 2006
>Originator:     John D. Baker
>Release:        MacOS X 10.4.5, pkgsrc-current
>Organization:
>Environment:
Darwin ed.local 8.5.0 Darwin Kernel Version 8.5.0: Sun Jan 22 10:38:46 PST 2006; root:xnu-792.6.61.obj~1/RELEASE_PPC Power Macintosh powerpc

>Description:
Building cad/qcad on MacOS X fails as follows:

g++ -c -O2 -I/usr/pkg/include -I/usr/pkg/qt3/include -I/usr/include -DGLX_GLXEXT_LEGACY -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -Wall -W -DQT_NO_DEBUG -I/usr/pkg/qt3/include -I/usr/X11R6/include -o rappwin.o rappwin.cpp
/usr/pkg/qt3/include/qnetworkprotocol.h:58: warning: 'class QNetworkProtocolFactoryBase' has virtual functions but non-virtual destructor
/usr/pkg/qt3/include/qfiledialog.h:78: warning: 'class QFilePreview' has virtual functions but non-virtual destructor
/usr/pkg/qt3/include/qtooltip.h:86: warning: 'class QToolTip' has virtual functions but non-virtual destructor
rappwin.cpp: In member function 'void RAppWin::filePrint(bool)':
rappwin.cpp:1362: error: 'RUNNING_LINUX' was not declared in this scope
rappwin.cpp: In member function 'void RAppWin::resizeChildren()':
rappwin.cpp:3420: error: 'RUNNING_WINDOWS' was not declared in this scope
*** Error code 1

Stop.
bmake: stopped in /Volumes/NetBSD/pkgsrc/cad/qcad/work/qcad-1.5.4
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/cad/qcad

>How-To-Repeat:
On any MacOS X:

cd .../pkgsrc/cad/qcad

bmake
>Fix:
System-type definitions are collected in:

    work/qcad-1.5.4/rprgdef.h

which is patched to detect internal compiler definitions for the
various BSDs, except Darwin/MacOSX, and set qcad's macros accordingly.

For most Darwin/MacOS X packages, there's a -D__DARWIN__ added to
one or another compiler flag groups and the macro test above is
just augmented to accept __DARWIN__ as another BSD-type OS.  This is
not (currently) done for cad/qcad.

As a workaround, for MacOS X on Apple platforms (both PPC and [*ugh*]
intel), the BSD-matching macro is augmented from:

#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)

to:

#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__) && defined(__GNUC__))

which lets the build proceed and results in a working qcad.

The above change might be applied to cad/qcad/patches/patch-ac
as a workaround until/unless a generic __DARWIN__ attribute can
be added.