Subject: Re: pkg/32971: cad/qcad macros undefined on MacOS X
To: None <>
From: John D. Baker <>
List: pkgsrc-bugs
Date: 03/04/2006 02:26:29
On Thu, 2 Mar 2006 wrote:

>  On Thu, Mar 02, 2006 at 11:00:00PM +0000, wrote:
>  > Building cad/qcad on MacOS X fails as follows:
>  This should be fixed in response to pkg/32924, is your tree current? Do you
>  use 2005Q4?

Please note that this PR is very different from pkg/32924.  In that one,
the pkgsrc/cad/qcad/Makefile omitted "Darwin" as a valid BSD-type OS
preventing any _attempt_ to build qcad.  That has been fixed, and the
subsequent phases of the process progress up to the "build" phase.

This PR, then, refers to failure due to errors _during_ the build phase.
The key feature is that during the build of 'rappwin.cpp', _both_
"RUNNING_LINUX" and "RUNNING_WINDOWS" are undefined/unset.  This occurs
because there is currently no way for the various conditionals in
"work/qcad-1.5.4/rprgdef.h" to detect an OS type for Darwin/MacOS X.
There is no "__DARWIN__" symbol in Apple's gcc/g++ or their related
components, even if the conditional discussed in this PR were so augmented.

Other packages that compile on Darwin/MacOS X include a "-D__DARWIN__"
in one or another compiler flag macro definitions (CFLAGS? CXXFLAGS?)
in the distribution Makefile which can then be detected by appropriate
conditional compilation directives in the sources/headers.

My workaround was to augment the conditional in rprgdef.h to include
compiler symbols that _would_ be likely to identify a MacOS X system
and cause the various distribution-defined macros to be set appropriately.

Perhaps a more complete solution would be a selectively-applied patch
if a Darwin/MacOS X system is detected to add the "-D__DARWIN__" macro
definition to an appropriate compiler flag macro in the distribution
Makefile with a suitably-augmented conditional compilation statement
in rprgdef.h?

I know it goes against policy to do platform-specific patches in the
distribution files, but is this one so different from what's already
done to detect __NetBSD__, __OpenBSD__, and __FreeBSD__?

I'm updating pkgsrc on another MacOS X system now, so I'll see if I can
create such a patch as I describe, but I wouldn't know how to make it
apply conditionally.

John D. Baker, KN5UKS                    NetBSD     Darwin/MacOS X
jdbaker(at)mylinuxisp(dot)com                 OpenBSD            FreeBSD
BSD -- It just sits there and _works_!
GPG fingerprint:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645