tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lang/gcc12 on mac



* On 2024-06-23 at 22:29 BST, Jason Bacon wrote:

On 6/23/24 12:48, Jonathan Perkin wrote:
* On 2024-06-23 at 13:21 BST, Jason Bacon wrote:

+.if !defined(CLTOOLS_VERSION)
+CLTOOLS_VERSION!=      pkgutil
--pkg-info=com.apple.pkg.CLTools_Executables | awk '$$1 == "version:" {
print $2 }'
+.endif

This isn't accurate, on my host it returns the same as you, but I do not use this, I use Xcode installed under /Applications which is a completely different version.

I would do it based on CC_VERSION, which needs some work for clang. Ideally I'd like to see it be the same as OPSYS_VERSION where we can perform numeric comparisons rather than string matching.


CC_VERSION seems to be clang-15.0.0 for both SDK 13.3 and 14.4.

Running the following to get all predefined cpp macros:

cc -dM -E -x c /dev/null

The only difference in the output for 13.3 and 14.4 is

< #define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 130300
< #define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ 130300
---
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 140000
#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ 140000

If you're trying to differentiate between SDKs rather than compilers then yeh we could do it based on one of those macros. Something like this:

  --- mk/platform/Darwin.mk	29 Apr 2024 13:57:55 -0000	1.140
  +++ mk/platform/Darwin.mk	24 Jun 2024 08:16:59 -0000
  @@ -134,0 +135,5 @@
  +.if !defined(OSX_SDK_VERSION)
  +OSX_SDK_VERSION!=	${CC} -isysroot ${OSX_SDK_PATH} -dM -E -x c /dev/null | awk '/OS_VERSION_MIN/ {print $$3}'
  +MAKEFLAGS+=		OSX_SDK_VERSION=${OSX_SDK_VERSION}
  +.endif
  +

Seems to work correctly with overriding MACOSX_DEPLOYMENT_TARGET and OSX_SDK_PATH:

  $ bmake -v OSX_SDK_VERSION
  140000

  $ bmake MACOSX_DEPLOYMENT_TARGET=12.3 -v OSX_SDK_VERSION
  120300

  $ bmake OSX_SDK_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -v OSX_SDK_VERSION
  110300

Cheers,

--
Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
Open Source Complete Cloud   www.tritondatacenter.com


Home | Main Index | Thread Index | Old Index