From 832beb9955b992afa044daafc502f790bb49f874 Mon Sep 17 00:00:00 2001 From: Jens Rehsack Date: Sun, 22 Feb 2015 14:23:33 +0100 Subject: [PATCH 2/2] very first step to tidy up mess around sdk to use According to [1] and how Perl and most XS modules are implemented, none of them are using conditionals to prove API availability. Therefore, it's reasonable to rely on the sdk available for the system. For future improvements, this hint's file should distinguish between SDKROOT for the base-sdk to use and MACOSX_DEPLOYMENT_SDK for weak linking following [2]. But it's important to add appropriate environment variables to $cc invocation, either. 1) https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html 2) http://stackoverflow.com/questions/13964742/sdkroot-path-for-latest-sdk Signed-off-by: Jens Rehsack --- hints/darwin.sh | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/hints/darwin.sh b/hints/darwin.sh index fec05fd..9437fc2 100644 --- a/hints/darwin.sh +++ b/hints/darwin.sh @@ -3,6 +3,26 @@ # Wilfredo Sanchez ## +# table from pkgsrc/mk/platform/Darwin.mk +# OS, Kernel, Xcode Version +# Note that Xcode gets updates on older systems sometimes. +# pkgsrc generally expects that the most up-to-date xcode available for +# an OS version is installed +# +# Codename OS Kernel Xcode +# Cheetah 10.0.x 1.3.1 +# Puma 10.1 1.4.1 +# 10.1.x 5.x.y +# Jaguar 10.2.x 6.x.y +# Panther 10.3.x 7.x.y +# Tiger 10.4.x 8.x.y 2.x (gcc 4.0, 4.0.1 from 2.2) +# Leopard 10.5.x 9.x.y 3.x (gcc 4.0.1, 4.0.1 and 4.2.1 from 3.1) +# Snow Leopard 10.6.x 10.x.y 3.2+ (gcc 4.0.1 and 4.2.1) +# Lion 10.7.x 11.x.y 4.1 (llvm gcc 4.2.1) +# Mountain Lion 10.8.x 12.x.y 4.5 (llvm gcc 4.2.1) +# Mavericks 10.9.x 13.x.y 6 (llvm clang 6.0) +# Yosemite 10.10.x 14.x.y 6 (llvm clang 6.0) + ## # Paths ## @@ -205,8 +225,21 @@ case "$osvers" in # https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html lddlflags="${ldflags} -bundle -undefined dynamic_lookup" case "$ld" in - *MACOSX_DEVELOPMENT_TARGET*) ;; - *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;; + *MACOSX_DEPLOYMENT_TARGET*) ;; + *) + if test -x /usr/bin/xcrun; then + SDK_VERSION="`/usr/bin/xcrun --show-sdk-version 2>/dev/null`" + else + # one with ppc mac and/or *Leopard x86 should add patterns for both + # if ccflags/ldflags contain "-m32", appropriate fallback should be chosen either + # otherwise: packaging people could provide suitable ld command + case "`uname -m`" in + *x86_64*) SDK_VERSION="10.7" ;; + *) SDK_VERSION="10.3" ;; + esac + fi + ld="env MACOSX_DEPLOYMENT_TARGET=${SDK_VERSION} ${ld}" + ;; esac ;; esac -- 1.9.3 (Apple Git-50)