Sunday, January 4, 2009

UICatalog : Makefile for Apple sample iPhone SDK code

To check out UICatalog from Apple developer website or from here
svn co -r16 http://apiexplorer.googlecode.com/svn/trunk/UICatalog UICatalog

The modification here is to show how to change the xib file to iphone code (as in revision 17) here
http://code.google.com/p/apiexplorer/source/detail?r=17

Furthermore, if you checkout the revision 18, you can have the ldid binary and Makefiles for installation to iPhone /Applications folder
Mac : (using Makefile.mac and ldid_mac)
Linux toolchain : (using Makefile.linux and ldid_linux)
iPhone gcc : (using Makefile.iphone and please install ldid package in Cydia)

Instructions to compile using Makefile for UICatalog under Mac
(1) Checkout revision 18
svn co -r18 http://apiexplorer.googlecode.com/svn/trunk/UICatalog UICatalog

(2) Install respring in iPhone (if haven't done so) assume your iphone ip is 10.0.2.2
make install_respring -f Makefile.mac IPHONE_IP=10.0.2.2

(3) modify the IPHONE_IP (to the actual IP address of iPhone) in Makefile.mac
IPHONE_IP=10.0.2.2

(4) make & install
make -f Makefile.mac
make install -f Makefile.mac


If you want to install your Mac / Linux public key in iPhone so as to avoid typing password using ssh, please refer to my previous post here

Instructions to compile using Makefile for UICatalog under Linux toolchain

Please refer to these two articles in how to install toolchain in Linux
http://iphonesdkdev.blogspot.com/2008/11/upgrade-vmware-image-to-ubuntu-810-for.html
http://iphonesdkdev.blogspot.com/2008/10/how-to-install-llvm-gcc-for-iphone-sdk.html

(1) Checkout revision 18
svn co -r18 http://apiexplorer.googlecode.com/svn/trunk/UICatalog UICatalog

(2) Install respring in iPhone (if haven't done so) assume your iphone ip is 10.0.2.2
make install_respring -f Makefile.linux IPHONE_IP=10.0.2.2

(3) modify the IPHONE_IP (to the actual IP address of iPhone) and toolchain (to the toolchain folder location) in Makefile.linux
IPHONE_IP=10.0.2.2
toolchain=/usr/toolchain2


(4) make & install
make -f Makefile.linux
make install -f Makefile.linux


If you want to install your Mac / Linux public key in iPhone so as to avoid typing password using ssh, please refer to my previous post here

Instructions to compile using Makefile for UICatalog under iPhone gcc
Assume already install iphone gcc, ldid, make and subversion packages in Cydia and also have sdk headers / lib files

(1) Checkout revision 18
svn co -r18 http://apiexplorer.googlecode.com/svn/trunk/UICatalog UICatalog

(2) Install respring in iPhone (if haven't done so)
make install_respring -f Makefile.iphone

(3) modify the SDK (to the sdk headers and lib files location) in Makefile.iphone
SDK = /var/toolchain2/sys20

(4) make & install
make -f Makefile.iphone
make install -f Makefile.iphone


P.S. There is a great tool here to convert .xib / *.nib to .m
see here
http://github.com/akosma/nib2objc/tree/master


If you need to compile ldid in Intel machine, here is how

wget http://svn.telesphoreo.org/trunk/data/ldid/ldid-1.0.476.tgz
tar -zxf ldid-1.0.476.tgz
cd ldid-1.0.476
g++ -I . -o util/ldid{,.cpp} -x c util/{lookup2,sha1}.c
sudo cp -a util/ldid /usr/bin


For PowerPC, you need the patch file here
http://fink.cvs.sourceforge.net/viewvc/*checkout*/fink/dists/10.4/unstable/crypto/finkinfo/ldid.patch?revision=1.1

and to apply the patch before compilation, use this

curl -O http://svn.telesphoreo.org/trunk/data/ldid/ldid-1.0.476.tgz
tar -zxf ldid-1.0.476.tgz
wget -qO- http://fink.cvs.sourceforge.net/viewvc/*checkout*/fink/dists/10.4/unstable/crypto/finkinfo/ldid.patch?revision=1.1 | patch -p0
cd ldid-1.0.476
g++ -I . -o util/ldid{,.cpp} -x c util/{lookup2,sha1}.c
sudo cp -a util/ldid /usr/bin


Updates : The source of of ldid is moved to here
wget http://www.telesphoreo.org/export/477/trunk/data/ldid/ldid-1.0.476.tgz
or updated one here
wget http://svn.telesphoreo.org/trunk/data/ldid/ldid-1.0.610.tgz

Updates : If you compiled it in cgywin, you need to add (uint32_t) in the source code ldid.cpp that has ambiguous overload call error message like this

error: call of overloaded 'Swap(int)' is ambiguous






1 comment:

Ed Bomke said...

Thanks a lot for the useful tips.