Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to set MACOSX_DEPLOYMENT_TARGET?

The Perl community has relied on MACOSX_DEPLOYMENT_TARGET=10.3 for all builds of Perl for, well, a long time. But now, with the El Capitan beta, it no longer works. It seems as though they should bump it up, but to what? Is there a way to programmatically set it to whatever is the earliest version supported by the release of OS X on which Perl is currently being built? Or is there some other way to set it dynamically? Or must it be static and updated periodically? If the latter, how does it affect builds on older versions of OS X?

like image 971
theory Avatar asked Aug 28 '15 22:08

theory


2 Answers

This should be a fairly simple change in hints/darwin.sh, that checks what OSX version is running and sets MACOSX_DEPLOYMENT_TARGET accordingly.

Perl is an Open Source project, and as such always short on developer time. If you were to make a patch for this and submit it to p5p, I'm sure it would be greatly appreciated.

like image 93
Calle Dybedahl Avatar answered Sep 25 '22 10:09

Calle Dybedahl


Accepted @Calle-Dybedahl's answer, as it's technically correct. Perl 5 Core Hacker Jarkko Hietaniemi pushed this solution, which proved to be a bit more complicated than you might expect at a glance. The basic recipe he came down on was:

For OS X 10.6 or above, do not any more use the MACOSX_DEPLOYMENT_TARGET, the toolchains should work fine without. Until now the deployment target was hardwired to 10.3. This logic comes from RT#117433.

For OS X releases from 10.3 until 10.5, no change, still using the MACOSX_DEPLOYMENT_TARGET=10.3 for linking.

For OS X releases before 10.3, no change, still not using the MACOSX_DEPLOYMENT_TARGET=10.3.

New: always add -mmacosx-version-min to ccflags and ldflags from the env var $MACOSX_DEPLOYMENT_TARGET, if set. If the var is not set, set the min from the OS X version, from sw_vers(1). Setting the var should become handy for people building and packaging Perl for earlier OS X versions.

like image 34
theory Avatar answered Sep 22 '22 10:09

theory