Wireshark-dev: Re: [Wireshark-dev] MacOS/X builds
From: Guy Harris <[email protected]>
Date: Tue, 6 Jul 2010 10:44:57 -0700
On Jul 6, 2010, at 10:19 AM, Sake Blok wrote:

> On 6 jul 2010, at 13:13, Sake Blok wrote:
> 
>> On 6 jul 2010, at 12:07, Stig Bjørlykke wrote:
>> 
>>> On Tue, Jul 6, 2010 at 12:01 PM, Sake Blok <[email protected]> wrote:
>>>> I'm starting to build Wireshark on my MacBook. It all compiles well, but when I do 'make osx-install' the created Wireshark.app does not execute.
>>> 
>>> I'm using the attached patch to build on my system (OSX 10.6.4).
>> 
>> Great, that did the trick. I think we need to make SDKROOT determined at compile time so that the automated builds don't show the same problem...
> 
> I can add a line determining which SDK to use in "packaging/macosx/osx-app.sh" (there is already some version dependent stuff in there), but I have no idea which OSX versions need which SDK dir. Does anybody have an idea?

Ultimately, I think we should add a couple of configure script options - one to control which version of OS X should be the "deployment target" (meaning the minimum version of the OS on which the build is supposed to work), and another to control whether to do a universal build or not.

If you don't specify --with-osx-deploy-target, it'll do an ordinary build of the sort we do now, meaning it might not run on older versions - even older versions of the same major version (e.g., a build on 10.x.y might not run on 10.x.z if z < y).

If you specify --with-osx-deploy-target, but don't specify a specific deployment target, it'll pick the current OS major version as the deployment target:

	os_version=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`

(although that might require some tweaking to handle 10.5, 10.6, etc. rather than 10.5.1, 10.6.2, etc.).

If you specify --with-osx-deploy-target=10.x, it'll make that the deployment target.

If you don't specify --enable-osx-universal, it won't do a universal build - it'll just build for the default target (PPC or x86 depending on the machine on which you're building, 32-bit prior to 10.6, 64-bit in 10.6 if you're building on a 64-bit machine).

Based on the deployment target and universal flags, select the SDK and the set of architectures for which to compile:

	if --with-osx-deploy-target wasn't specified, don't use an SDK, and, based on the universal option and the OS on which you're running, choose the architectures:

	10.0 - 10.3 - no universal builds

	10.4, 10.5 - if universal, build with "-arch ppc -arch i386" (I think BPF is sufficiently broken in 64-bit mode in Leopard that you can't use it - I guess we could try building a 32-bit dumpcap and building the rest universal, but I'll leave that for the next staget of this project)

	10.6 and later - if universal, build with "-arch x86_64 -arch i386" (PPC no longer supported);

	if --with-osx-deploy-target was specified, based on the deployment target and the universal option, choose the SDK and architectures:

	10.0 - 10.3 - no universal builds, SDK is, I think, /Developer/SDKs/MacOSX10.x.sdk

	10.4 - if universal, use /Developer/SDKs/MacOSX10.4u.sdk and build with "-arch ppc -arch i386", otherwise use /Developer/SDKs/MacOSX10.4.sdk or, if necessary, /Developer/SDKs/MacOSX10.4u.sdk if you're building on x86 (I don't remember whether, on x86 machines, you'd need to build with /Developer/SDKs/MacOSX10.4u.sdk even if you're building an x86-only binary)

	10.5 - use /Developer/SDKs/MacOSX10.5.sdk whether universal or not, build with "-arch i386 -arch ppc" if universal;

	10.6 and later - use /Developer/SDKs/MacOSX10.x.sdk, build with "-arch x86_64 -arch i386" if universal.

Modify packaging/macosx/osx-app.sh to use the specified root as the SDK, by setting XCODEFLAGS to include "SDKROOT={path to SDK}" (Snow Leopard and later support "-sdk" in xcodebuild, but older versions don't).

Don't set SDKROOT in packaging/macosx/ScriptExec/ScriptExec.xcodeproj/project.pbxproj.

There are probably more changes needed; I have a tree in which I'm working on this, but it's not done yet.