[sword-devel] Compile Sword as Universal on Mac

Manfred Bergmann bergmannmd at yahoo.de
Sun Oct 14 23:22:34 MST 2007


Hi.

No, that's no correct. You can build universal binaries on every  
machine be it PPC or Intel.

Below is an excerpt of the MacSword Sword library build script which  
builds first PPC against 10.3.9 SDK and then Intel against 10.4u SDK  
and then the two binaries are bound together with "lipo" tool.
Mac OSX itself then finds out which binary version it needs.

------------------------------------
# build stuff
if [ $PPC -eq 1 ] || [ $FAT -eq 1 ]; then
	cd trunk
	#make clean
	./autogen.sh
	export CC=gcc
	export CXX=g++
	export SDK=/Developer/SDKs/MacOSX10.3.9.sdk
	if [ $DEBUG -eq 1 ]; then
		export CFLAGS="-nostdinc -O0 -g -arch ppc -B$SDK/usr/include/gcc -B 
$SDK/usr/lib/gcc -isystem$SDK/usr/include -isystem$SDK/usr/include/gcc/ 
darwin/4.0 -I$SDK/usr/include/gcc/darwin/4.0/c++ -I$SDK/usr/include/ 
gcc/darwin/4.0/c++/backward -I$SDK/usr/include/gcc/darwin/4.0/c++/i686- 
apple-darwin8 -I$PPCPREFIX/include"
	else
		export CFLAGS="-nostdinc -O2 -g0 -arch ppc -B$SDK/usr/include/gcc -B 
$SDK/usr/lib/gcc -isystem$SDK/usr/include -isystem$SDK/usr/include/gcc/ 
darwin/4.0 -I$SDK/usr/include/gcc/darwin/4.0/c++ -I$SDK/usr/include/ 
gcc/darwin/4.0/c++/backward -I$SDK/usr/include/gcc/darwin/4.0/c++/i686- 
apple-darwin8 -I$PPCPREFIX/include"
	fi
	export CXXFLAGS="$CFLAGS"
	export LDFLAGS="-Wl,-syslibroot,$SDK"
	#export PATH=$PATH:$PPCPREFIX/bin
	./configure --prefix=$PPCPREFIX --with-zlib --with-conf --without- 
curl --disable-shared --disable-utilities
	make all install
	cd $BDIR
	# copy to result dir
	cp $PPCPREFIX/lib/lib$APP.a $RESULTPREFIX/lib/lib$APP-$VERS-ppc.a
fi

# then build intel version to SDK 10.4u
if [ $INTEL -eq 1 ]|| [ $FAT -eq 1 ]; then
	#cd $APP-$VERS
	cd trunk
	make clean
	./autogen.sh
	export CC=gcc
	export CXX=g++
	export SDK=/Developer/SDKs/MacOSX10.4u.sdk
	if [ $DEBUG -eq 1 ]; then
		export CFLAGS="-nostdinc -O0 -g -arch i386 -B$SDK/usr/include/gcc -B 
$SDK/usr/lib/gcc -isystem$SDK/usr/include -isystem$SDK/usr/include/gcc/ 
darwin/4.0 -I$SDK/usr/include/gcc/darwin/4.0/c++ -I$SDK/usr/include/ 
gcc/darwin/4.0/c++/backward -I$SDK/usr/include/gcc/darwin/4.0/c++/i686- 
apple-darwin8 -I$INTELPREFIX/include"
	else
		export CFLAGS="-nostdinc -O2 -g0 -arch i386 -B$SDK/usr/include/gcc -B 
$SDK/usr/lib/gcc -isystem$SDK/usr/include -isystem$SDK/usr/include/gcc/ 
darwin/4.0 -I$SDK/usr/include/gcc/darwin/4.0/c++ -I$SDK/usr/include/ 
gcc/darwin/4.0/c++/backward -I$SDK/usr/include/gcc/darwin/4.0/c++/i686- 
apple-darwin8 -I$INTELPREFIX/include"
	fi
	export CXXFLAGS="$CFLAGS"
	export LDFLAGS="-Wl,-syslibroot,$SDK"
	#export PATH=$PATH:$INTELPREFIX/bin
	./configure --prefix=$INTELPREFIX --with-zlib --with-conf --without- 
curl --disable-shared --disable-utilities
	make all install
	cd $BDIR
	# copy to result dir
	cp $INTELPREFIX/lib/lib$APP.a $RESULTPREFIX/lib/lib$APP-$VERS-intel.a

	# only for fat version
	if [ $FAT -eq 1 ]; then
		# creating result
		# build fat binary with lipo
		lipo -create $RESULTPREFIX/lib/lib$APP-$VERS-ppc.a $RESULTPREFIX/lib/ 
lib$APP-$VERS-intel.a -output $RESULTPREFIX/lib/lib$APP-$VERS-fat.a
	fi
fi

---------------------------------------------

Regards,
Manfred



Am 14.10.2007 um 21:36 schrieb Maurits Obbink:

> Dominic,
>
> I think you need an Intel Mac to build a Univesal Binary.
>
> regards,
>
> Maurits Obbink
>
> Dominic Tubach wrote:
>> Thanks for the answer. I thought that this is the way, but do you  
>> know which
>> are the parameters I have to use? On the G4 I have access to I get  
>> a PPC only
>> lib without parameters.
>>
>> Dominic
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list