Commit 072b1ad1 authored by Nick Zitzmann's avatar Nick Zitzmann
Browse files

MacOSX-Framework: Make script work in Xcode 4.0 and later

Apple made a number of changes to Xcode 4. The SDKs were moved, the entire
Developer folder was moved, and PowerPC support was removed. The script
will now adapt to those changes and should be future-proofed against
additional changes in case Apple moves the Developer folder ever again.
Also, the minimum OS X version compiler option was removed, so that the
framework can be built against the latest SDK but still run in older cats.
parent 10c1b11f
Loading
Loading
Loading
Loading
+33 −19
Original line number Diff line number Diff line
@@ -10,6 +10,10 @@
# 10.5 is the *ONLY* SDK that support PPC64 :( -- 10.6 do not have ppc64 support
#If you need to have PPC64 support then change below to 1
PPC64_NEEDED=0
# Apple does not support building for PPC anymore in Xcode 4 and later.
# If you're using Xcode 3 or earlier and need PPC support, then change
# the setting below to 1
PPC_NEEDED=0

# For me the default is to develop for the platform I am on, and if you
#desire compatibility with older versions then change USE_OLD to 1 :)
@@ -24,9 +28,16 @@ FRAMEWORK_VERSION=Versions/Release-$VERSION
# and setup the right paths to this version, leaving the system version
# "intact", so you can "fix" it later with the links to Versions/A/...


OLD_SDK=`ls  /Developer/SDKs|head -1`
NEW_SDK=`ls -r /Developer/SDKs|head -1`
DEVELOPER_PATH=`xcode-select --print-path`
# Around Xcode 4.3, SDKs were moved from the Developer folder into the
# MacOSX.platform folder
if test -d "$DEVELOPER_PATH/Platforms/MacOSX.platform/Developer/SDKs"; then
 SDK_PATH="$DEVELOPER_PATH/Platforms/MacOSX.platform/Developer/SDKs"
else
 SDK_PATH="$DEVELOPER_PATH/SDKs";
fi
OLD_SDK=`ls  $SDK_PATH|head -1`
NEW_SDK=`ls -r $SDK_PATH|head -1`

if test "0"$USE_OLD -gt 0
then
@@ -37,21 +48,24 @@ fi

MACVER=`echo $SDK32|sed -e s/[a-zA-Z]//g -e s/.\$//`

SDK32_DIR='/Developer/SDKs/'$SDK32
SDK32_DIR=$SDK_PATH/$SDK32
MINVER32='-mmacosx-version-min='$MACVER
if test $PPC_NEEDED -gt 0; then
 ARCHES32='-arch i386 -arch ppc'

else
 ARCHES32='-arch i386'
fi

if test $PPC64_NEEDED -gt 0
then
  SDK64=10.5
  ARCHES64='-arch x86_64 -arch ppc64'
  SDK64=`ls  /Developer/SDKs|grep 10.5|head -1`
  SDK64=`ls  $SDK_PATH|grep 10.5|head -1`
else
 ARCHES64='-arch x86_64'
 #We "know" that 10.4 and earlier do not support 64bit
 OLD_SDK64=`ls  /Developer/SDKs|egrep -v "10.[0-4]"|head -1`
 NEW_SDK64=`ls -r /Developer/SDKs|egrep -v "10.[0-4]"|head -1`
 OLD_SDK64=`ls  $SDK_PATH|egrep -v "10.[0-4]"|head -1`
 NEW_SDK64=`ls -r $SDK_PATH|egrep -v "10.[0-4]"|head -1`
 if test $USE_OLD -gt 0
  then
   SDK64=$OLD_SDK64
@@ -60,7 +74,7 @@ else
  fi
fi

SDK64_DIR='/Developer/SDKs/'$SDK64
SDK64_DIR=$SDK_PATH/$SDK64
MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//`

MINVER64='-mmacosx-version-min='$MACVER64
@@ -68,13 +82,13 @@ MINVER64='-mmacosx-version-min='$MACVER64
if test ! -z $SDK32; then
  echo "----Configuring libcurl for 32 bit universal framework..."
  make clean
  ./configure --disable-dependency-tracking --disable-static --with-gssapi \
    CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32 $MINVER32" \
    LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \
  ./configure --disable-dependency-tracking --disable-static --with-gssapi --with-darwinssl \
    CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32" \
    LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 -Wl,-headerpad_max_install_names" \
    CC=$CC

  echo "----Building 32 bit libcurl..."
  make
  make -j `sysctl -n hw.logicalcpu_max`

  echo "----Creating 32 bit framework..."
  rm -r libcurl.framework
@@ -91,19 +105,19 @@ if test ! -z $SDK32; then
  cd Versions
  ln -fs ${FRAMEWORK_VERSION} Current

  echo TEsting for SDK64
  echo Testing for SDK64
  if test -d $SDK64_DIR; then
  echo entering...
    popd
    make clean
    echo "----Configuring libcurl for 64 bit universal framework..."
    ./configure --disable-dependency-tracking --disable-static --with-gssapi \
      CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64 $MINVER64" \
      LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \
    ./configure --disable-dependency-tracking --disable-static --with-gssapi --with-darwinssl \
      CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64" \
      LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 -Wl,-headerpad_max_install_names" \
      CC=$CC

    echo "----Building 64 bit libcurl..."
    make
    make -j `sysctl -n hw.logicalcpu_max`

    echo "----Appending 64 bit framework to 32 bit framework..."
    cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
	<string>curl</string>

	<key>CFBundleIdentifier</key>
	<string>com.libcurl.libcurl</string>
	<string>se.haxx.curl.libcurl</string>

	<key>CFBundleVersion</key>
	<string>7.12.3</string>