diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 98 | ||||
-rwxr-xr-x | packaging/macosx/osx-app.sh | 14 |
3 files changed, 112 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 04be30ba21..f594530a65 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1138,7 +1138,7 @@ osx-app: $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) packaging/macosx/Info.plist rm -rf $(stagedir) ; \ $(MAKE) DESTDIR=$(stagedir) install; \ cd $(srcdir)/packaging/macosx ; \ - ./osx-app.sh -bp ../staging/$(PACKAGE).inst$(bindir) ; \ + ./osx-app.sh @OSX_APP_FLAGS@ -bp ../staging/$(PACKAGE).inst$(bindir) ; \ else \ echo "Error: OS X packaging tools not found." ; \ echo "Package build abandoned." ; \ diff --git a/configure.ac b/configure.ac index efe3ef6aef..cdbce88b80 100644 --- a/configure.ac +++ b/configure.ac @@ -688,6 +688,13 @@ bar(void) # open-source application in favor of various frameworks that are # OS X-only. # +# Also, let the user to specify an OS X release to use as a deplayment +# target; if they specify that we should have a deployment target but +# don't specify the deployment target, pick the OS version on which +# the build is being done. This also causes the build to be done +# against an SDK rather than against the headers and libraries in +# /usr/include and /usr/lib. +# case "$host_os" in darwin*) AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-deprecated-declarations) @@ -924,11 +931,102 @@ darwin*) LIBS="$LIBS $COREFOUNDATION_FRAMEWORKS" AC_CHECK_FUNCS(CFPropertyListCreateWithStream) LIBS="$ac_save_LIBS" + + # + # Get the OS X major version number. + # (We quote the command so that we can use autoconf's M4 + # quoting characters, [ and ], in the sed expression.) + # + [os_version=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`] + + AC_ARG_ENABLE(osx-deploy-target, + AC_HELP_STRING( [--enable-osx-deploy-target], + [choose an OS X deployment target @<:@default=none@:>@]), + [ + if test $enableval = no + then + deploy_target= + elif test $enableval = yes + then + deploy_target=$os_version + else + deploy_target="$enableval" + fi + ],[ + deploy_target= + ]) + AC_MSG_CHECKING([what deployment target to use]) + if test -z "$deploy_target" + then + AC_MSG_RESULT(none) + OSX_DEPLOY_TARGET= + else + AC_MSG_RESULT($deploy_target) + + case $deploy_target in + + 10.0|10.1|10.2) + # + # I'm not sure this would even work. + # + AC_ERROR([$deploy_target not supported as a deployment target]) + ;; + + 10.3) + # + # XXX - never tested. + # + SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk" + ;; + + *) + # + # XXX - for 10.4, do we need 10.4u? We're + # not currently doing fat builds (we'd need + # fat versions of the support libraries for + # that to be useful), but, if we do, we'd + # need to use 10.4u. + # + for i in /Developer/SDKs \ + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ + /Library/Developer/CommandLineTools/SDKs + do + if test -d "$i"/"MacOSX$deploy_target.sdk" + then + SDKPATH="$i"/"MacOSX$deploy_target.sdk" + break + fi + done + if test -z "$SDKPATH" + then + AC_MSG_ERROR([couldn't find the SDK for OS X $deploy_target]) + fi + ;; + esac + + # + # Add -isysroot flags to use the SDK. + # + CFLAGS="-isysroot $SDKPATH $CFLAGS" + CPPFLAGS="-isysroot $SDKPATH $CPPFLAGS" + LDFLAGS="-isysroot $SDKPATH $LDFLAGS" + + # + # Add a -sdkroot flag to use with osx-app.sh. + # + OSX_APP_FLAGS="-sdkroot $SDKPATH" + + # + # XXX - do we need this to build the Wireshark wrapper? + # + OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target" + fi ;; esac AC_SUBST(APPLICATIONSERVICES_FRAMEWORKS) AC_SUBST(SYSTEMCONFIGURATION_FRAMEWORKS) AC_SUBST(COREFOUNDATION_FRAMEWORKS) +AC_SUBST(OSX_APP_FLAGS) dnl Look in /usr/local for header files and libraries ? dnl XXX FIXME don't include /usr/local if it is already in the system diff --git a/packaging/macosx/osx-app.sh b/packaging/macosx/osx-app.sh index 8227f2a1a1..e3bcd69a37 100755 --- a/packaging/macosx/osx-app.sh +++ b/packaging/macosx/osx-app.sh @@ -91,9 +91,11 @@ OPTIONS specify the path to Info.plist. Info.plist can be found in the base directory of the source code once configure has been run. + -sdkroot + specify the root of the SDK to use EXAMPLE - $0 -s -l /opt/local -bp ../../Build/bin -p Info.plist + $0 -s -l /opt/local -bp ../../Build/bin -p Info.plist -sdkroot /Developer/SDKs/MacOSX10.5.sdk " } @@ -117,6 +119,9 @@ do -h|--help) help exit 0 ;; + -sdkroot) + sdkroot="$2" + shift 1 ;; *) echo "Invalid command line option: $1" exit 2 ;; @@ -160,6 +165,13 @@ else EXTRALIBS="" fi +# Set the SDK root, if an SDK was specified. +# (-sdk is only supported by the xcodebuild in the version of the +# developer tools that came with Snow Leopard and later versions) +if [ ! -z "$sdkroot" ] +then + XCODEFLAGS="$XCODEFLAGS SDKROOT=$sdkroot" +fi # Package always has the same name. Version information is stored in # the Info.plist file which is filled in by the configure script. |