Commit f5548973 authored by Yang Tse's avatar Yang Tse
Browse files

Daniel Johnson provided a shell script that will perform all the steps needed

to build a Mac OS X fat ppc/i386 or ppc64/x86_64 libcurl.framework
parent 07dc741e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@

                                  Changelog

Yang Tse (23 Feb 2009)
- Daniel Johnson provided a shell script that will perform all the steps needed
  to build a Mac OS X fat ppc/i386 or ppc64/x86_64 libcurl.framework

Daniel Stenberg (23 Feb 2009)
- I renamed everything in the windows builds files that used the name 'curllib'
  to the proper 'libcurl' as clearly this caused confusion.

MacOSX-Framework

0 → 100755
+49 −0
Original line number Diff line number Diff line
#!/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
+3 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ This release includes the following bugfixes:
 o FTP with the multi interface no longer kills the control connection as
   easily on transfer failures
 o compilation halting when using VS2008 to build a Windows 2000 target
 o ease creation of libcurl Mac OS X Framework

This release includes the following known bugs:

@@ -51,6 +52,7 @@ advice from friends like these:
 Lisa Xu, Daniel Fandrich, Craig A West, Alexey Borzov, Sharad Gupta,
 Peter Sylvester, Chad Monroe, Markus Moeller, Yang Tse, Scott Cantor,
 Patrick Scott, Hidemoto Nakada, Jocelyn Jaubert, Andre Guibert de Bruet,
 Kamil Dudka, Patrik Thunstrom, Linus Nielsen Feltzing, Mark Incley
 Kamil Dudka, Patrik Thunstrom, Linus Nielsen Feltzing, Mark Incley,
 Daniel Johnson

        Thanks! (and sorry if I forgot to mention someone)

lib/libcurl.framework.make

deleted100644 → 0
+0 −139
Original line number Diff line number Diff line
# to build Mac OS X framework call the following line with the directory set
# properly to lib:
# make build -e -f libcurl.framework.make
TMP_DIR = ../lib/.lib
LIB_DIR = ../lib

# Sets the SDK. 10.4u.sdk is the minimum for building a Universal Binary.
SDK = /Developer/SDKs/MacOSX10.4u.sdk

# Sets the minimum OSX version where the framework will work.
ENVP = MACOSX_DEPLOYMENT_TARGET=10.3

# for debug symbols add the -g option.  Remove the -O2 option for best debugging.
# Can be compiled with -O3 optimizations.
C_OPTIONS = -isysroot $(SDK) \
	-fno-common \
	-Os \
	-DHAVE_CONFIG_H \
	-DPIC \
	-I../lib \
	-I../include \
	-Wall \
	-arch ppc \
	-arch i386

LIBRARIES = $(SDK)/usr/lib/libssl.dylib \
	$(SDK)/usr/lib/libcrypto.dylib \
	-lz 

# These libtool options are needed for a framework.
# @executable_path tells the application that links to this library where to find it.
# On Mac OS X frameworks are usually iniside the application bundle in a frameworks folder.
# Define a seg1addr so prebinding does not overlap with other frameworks or bundles.
# For prebinding 0x10400000 was chosen a bit at random.  
# If this overlaps one of you current libs just change in the makefile. 
# This address is safe for all built in frameworks.  
LINK_OPTIONS = \
	-Wl,-syslibroot,$(SDK) \
	-arch ppc \
	-arch i386 \
	-prebind \
	-seg1addr 0x10400000 \
	-dynamiclib \
	-install_name @executable_path/../Frameworks/libcurl.framework/libcurl

# This is the file list.  It is not dynamically generated so this must be updated if new files are added to the build.
OBJECTS = $(TMP_DIR)/base64.o \
	$(TMP_DIR)/connect.o \
	$(TMP_DIR)/content_encoding.o \
	$(TMP_DIR)/cookie.o \
	$(TMP_DIR)/curl_addrinfo.o \
	$(TMP_DIR)/dict.o \
	$(TMP_DIR)/easy.o \
	$(TMP_DIR)/escape.o \
	$(TMP_DIR)/file.o \
	$(TMP_DIR)/formdata.o \
	$(TMP_DIR)/ftp.o \
	$(TMP_DIR)/getenv.o \
	$(TMP_DIR)/getinfo.o \
	$(TMP_DIR)/gtls.o \
	$(TMP_DIR)/hash.o \
	$(TMP_DIR)/hostares.o \
	$(TMP_DIR)/hostasyn.o \
	$(TMP_DIR)/hostip.o \
	$(TMP_DIR)/hostip4.o \
	$(TMP_DIR)/hostip6.o \
	$(TMP_DIR)/hostsyn.o \
	$(TMP_DIR)/hostthre.o \
	$(TMP_DIR)/http.o \
	$(TMP_DIR)/http_chunks.o \
	$(TMP_DIR)/http_digest.o \
	$(TMP_DIR)/http_negotiate.o \
	$(TMP_DIR)/http_ntlm.o \
	$(TMP_DIR)/if2ip.o \
	$(TMP_DIR)/inet_ntop.o \
	$(TMP_DIR)/inet_pton.o \
	$(TMP_DIR)/krb4.o \
	$(TMP_DIR)/ldap.o \
	$(TMP_DIR)/llist.o \
	$(TMP_DIR)/md5.o \
	$(TMP_DIR)/memdebug.o \
	$(TMP_DIR)/mprintf.o \
	$(TMP_DIR)/multi.o \
	$(TMP_DIR)/netrc.o \
	$(TMP_DIR)/parsedate.o \
	$(TMP_DIR)/progress.o \
	$(TMP_DIR)/rawstr.o \
	$(TMP_DIR)/security.o \
	$(TMP_DIR)/select.o \
	$(TMP_DIR)/sendf.o \
	$(TMP_DIR)/share.o \
	$(TMP_DIR)/speedcheck.o \
	$(TMP_DIR)/sslgen.o \
	$(TMP_DIR)/ssluse.o \
	$(TMP_DIR)/strequal.o \
	$(TMP_DIR)/strerror.o \
	$(TMP_DIR)/strtok.o \
	$(TMP_DIR)/strtoofft.o \
	$(TMP_DIR)/telnet.o \
	$(TMP_DIR)/tftp.o \
	$(TMP_DIR)/timeval.o \
	$(TMP_DIR)/transfer.o \
	$(TMP_DIR)/url.o \
	$(TMP_DIR)/version.o \
	$(TMP_DIR)/splay.o \
	$(TMP_DIR)/socks.o 

build: $(TMP_DIR) $(LIB_DIR) $(LIB_DIR)/libcurl.framework

$(TMP_DIR) :
	mkdir -p $(TMP_DIR)

$(LIB_DIR) :
	mkdir -p $(LIB_DIR)
	
# This builds the framework structure and links everything properly	
$(LIB_DIR)/libcurl.framework: $(OBJECTS) $(LIB_DIR)/libcurl.plist
	mkdir -p $(LIB_DIR)/libcurl.framework/Versions/A/Resources
	 $(ENVP) $(CC) $(LINK_OPTIONS) $(LIBRARIES) $(OBJECTS) \
		-o $(LIB_DIR)/libcurl.framework/Versions/A/libcurl
	cp $(LIB_DIR)/libcurl.plist $(LIB_DIR)/libcurl.framework/Versions/A/Resources/Info.plist
	mkdir -p $(LIB_DIR)/libcurl.framework/Versions/A/Headers
	cp $(LIB_DIR)/../include/curl/*.h $(LIB_DIR)/libcurl.framework/Versions/A/Headers
	cd $(LIB_DIR)/libcurl.framework; \
	   ln -fs Versions/A/libcurl libcurl; \
	   ln -fs Versions/A/Resources Resources; \
	   ln -fs Versions/A/Headers Headers
	cd $(LIB_DIR)/libcurl.framework/Versions; \
	   ln -fs A Current

$(OBJECTS) : $(TMP_DIR)/%.o: $(LIB_DIR)/%.c 
	$(CC) $(C_OPTIONS) -c $< -o $@

clean:
	rm -fr $(LIB_DIR)/libcurl.framework
	rm -f $(OBJECTS)