cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Script to build libcurl.framework on Mac OS X

From: Daniel Johnson <daniel.johnson31_at_gmail.com>
Date: Sat, 21 Feb 2009 20:19:21 -0500

On Feb 21, 2009, at 8:06 PM, Daniel Johnson wrote:

>
> On Feb 17, 2009, at 11:16 AM, Yang Tse wrote:
>
>> 2009/2/13, Daniel Johnson wrote:
>>
>>> It would be easier and more maintainable to just incorporate
>>> framework
>>> building into the regular configure/Makefile process.
>>> [...]
>>> Apple includes a 4-way fat libcurl, but it's verison 7.16.3.
>>> [...]
>>> Anything configure checks that varies with
>>> bitness will break fat building. Otherwise, in order to build 4-
>>> way fat you
>>> would have to do two separate builds, one 32 and one 64, and
>>> combine them
>>> with /usr/bin/lipo.
>>
>> Yep, I fear that something more 'automatic' would involve running
>> configure with different arguments and build subdirectories and
>> afterwards 'something' clever to merge the resulting headers. This
>> could get a a bit messy.
>>
>> Probably it would be easier, at least as a first step to have
>> configure generate two 'universal binary' makefiles a 32-bit one
>> and a
>> 64-bit one.
>>
>> But all this is certainly much more than what I was originally asking
>> for. Simply finding out which file references were missing from
>> lib/libcurl.framework.make
>
> Ok, as a first step, here is a script that will perform all the
> steps needed to build a fat ppc/i386 libcurl.framework. It's
> designed to be run from the top source directory and will produce
> there a libcurl.framework directory. There are also instructions in
> the file for building a 64 bit version, but because of different
> values in curlbuild.h you can't combine 32 and 64 bit in the same
> framework.
>
> Daniel
>
> <build-macosx-framework.sh>

Oops, sorry. Here's the contents of the file rather than attaching it.

#!/bin/bash
# This script performs all of the steps needed to build a 32 bit
# universal binary libcurl.framework for Mac OS X 10.4 or greater.

VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p'
include/curl/curlver.h`

SDK='/Developer/SDKs/MacOSX10.4u.sdk'

MINVER='-mmacosx-version-min=10.4'

ARCHES='-arch ppc -arch i386'

# Use these values instead to produce a 64 bit framework that only
works on 10.5.
# You can't currently build a combined 32/64 framework.
#SDK='/Developer/SDKs/MacOSX10.5.sdk'
#
#MINVER='-mmacosx-version-min=10.5'
#
#ARCHES='-arch ppc64 -arch x86_64'

if test -d $SDK; then
   echo "Configuring libcurl for 32 bit universal framework..."
   ./configure --disable-dependency-tracking --disable-static --with-
gssapi \
     CFLAGS="-isysroot $SDK $ARCHES $MINVER" \
     LDFLAGS="-Wl,-syslibroot,$SDK $ARCHES $MINVER -Wl,-
headerpad_max_install_names"

   echo "Building libcurl..."
   make

   echo "Creating framework..."
   rm -r libcurl.framework
   mkdir -p libcurl.framework/Versions/A/Resources
   cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl
   install_name_tool -id @executable_path/../Frameworks/
libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/
libcurl
   /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist
>libcurl.framework/Versions/A/Resources/Info.plist
   mkdir -p libcurl.framework/Versions/A/Headers
   cp include/curl/*.h libcurl.framework/Versions/A/Headers
   cd libcurl.framework
   ln -fs Versions/A/libcurl libcurl
   ln -fs Versions/A/Resources Resources
   ln -fs Versions/A/Headers Headers
   cd Versions
   ln -fs A Current

   echo "libcurl.framework is built and can now be included in other
projects."
else
   echo "Building libcurl.framework requires Mac OS X 10.4 or later
with the MacOSX10.4u SDK installed."
fi
Received on 2009-02-22