Difference between revisions of "objectivepascal"
Line 52: | Line 52: | ||
2) Download the latest version of the sources (see [[#Downloading Sources]]) | 2) Download the latest version of the sources (see [[#Downloading Sources]]) | ||
− | 3 | + | 3) Build the ARM cross-compiler. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* In the examples below the ''iPhoneOS4.2.sdk'' SDK is used but you should change this to the SDK version which you installed from Xcode. | * In the examples below the ''iPhoneOS4.2.sdk'' SDK is used but you should change this to the SDK version which you installed from Xcode. | ||
Line 71: | Line 64: | ||
sudo ln -sf ../lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm | sudo ln -sf ../lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm | ||
− | + | 4) Build the 386 compiler for iOS Simulator. | |
cd /Developer/ObjectivePascal/fpc | cd /Developer/ObjectivePascal/fpc | ||
make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim all | make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim all | ||
sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim install CROSSINSTALL=1 | sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim install CROSSINSTALL=1 | ||
+ | |||
+ | === iOS Headers === | ||
+ | |||
+ | The iOS headers must be manually generated using a script as they can not be legally distributed in translated Pascal form. The SDK used to parse the sources may not be the latest version of the SDK you installed from Xcode. Check that you have the SDK version used in the script ''make-ios-headers.sh'' before trying this step. | ||
+ | |||
+ | cd /Developer/ObjectivePascal/fpc/packages/cocoaint/utils | ||
+ | ./make-ios-headers.sh | ||
+ | |||
+ | The headers will be parsed and saved into <tt>/Developer/ObjectivePascal/fpc/packages/cocoaint/utils/uikit-skel/src</tt>. | ||
=== Compiling iOS sources === | === Compiling iOS sources === |
Revision as of 05:53, 23 April 2011
Downloading Sources
Before building any compilers you must download the FPC sources from SVN. This page references the standard location of /Developer/ObjectivePascal/fpc for all the FPC sources and you may need to create the /Developer/ObjectivePascal directory before going any further.
To check out the FPC sources for the first time use the command:
svn co http://svn.freepascal.org/svn/fpc/trunk /Developer/ObjectivePascal/fpc
To update the FPC sources from a previous download use the command:
svn up http://svn.freepascal.org/svn/fpc/trunk /Developer/ObjectivePascal/fpc
Building the compiler for Cocoa development
1) Download the latest version of FPC and Xcode developer tools then install. The examples below assumes the latest version is 2.4.2 but you may need to change this to which ever version is current at the time of installing.
- http://www.freepascal.org/down/i386/macosx-ftp.freepascal.org.var
- http://developer.apple.com/devcenter/mac
1) Download the latest version of the sources (see #Downloading Sources)
2) Build the Intel compiler to /usr/local/lib/fpc/2.5.1/ppc386
cd /Developer/ObjectivePascal/fpc sudo make distclean -j 3 sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" distclean all -j 2 sudo make FPC=`pwd`/compiler/ppc386 install
3) Build the PPC cross-compiler to /usr/local/lib/fpc/2.5.1/ppcppc. If you don't wish to build universal binaries or PPC-only binaries you can skip this step.
cd /Developer/ObjectivePascal/fpc sudo make distclean -j 3 sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" distclean CPU_TARGET=powerpc all -j 2 sudo make FPC=`pwd`/compiler/ppcppc CROSSINSTALL=1 install sudo mv /usr/local/lib/fpc/2.5.1/ppcrossppc /usr/local/lib/fpc/2.5.1/ppcppc
Cocoa Headers
The most recent version of the translated Cocoa headers (which are guaranteed to compile with that version) are location in the FPC distribution at /Developer/ObjectivePascal/fpc/packages/cocoaint/src. If you need newer headers you will need to parse them manually using the framework parser located at /Developer/ObjectivePascal/fpc/packages/cocoaint/utils/parser.php.
Building the compiler for iOS development
Follow the steps below to install the ARM compiler and 386 compiler for iOS simulator. The commands below utilize the standard location of /Developer/ObjectivePascal/fpc which contains all FPC sources related to Objective Pascal development.
1) Download the latest version of FPC and Xcode developer tools (with iOS SDK) then install. Please note you must start with a standard (unchanged) installation of Xcode developer tools and iOS SDK.
If you installed Xcode into another location than the default location /Developer you will need to change the paths below and in any other scripts you may run. Make sure if you installed into another location the path does not contain spaces.
- http://www.freepascal.org/down/i386/macosx-ftp.freepascal.org.var
- http://developer.apple.com/devcenter/mac
2) Download the latest version of the sources (see #Downloading Sources)
3) Build the ARM cross-compiler.
- In the examples below the iPhoneOS4.2.sdk SDK is used but you should change this to the SDK version which you installed from Xcode.
- If you are using Xcode 3.2.6+ or Xcode 4+, currently you first have to apply a patch to the FPC sources as explained at http://bugs.freepascal.org/view.php?id=19196
- copy /Developer/FreePascalCompiler/2.4.2/Source/rtl/darwin/arm/sig_cpu.inc to /Developer/ObjectivePascal/fpc/rtl/darwin/arm (that file was generated when you installed the FPC iPhone SDK integration kit)
cd /Developer/ObjectivePascal/fpc export IPHONEPLATFORMBASEDIR=/Developer/Platforms/iPhoneOS.platform/Developer make FPC=/usr/local/lib/fpc/2.4.2/ppc386 CPU_TARGET=arm CROSSOPT="-FD${IPHONEPLATFORMBASEDIR}/usr/bin -XR${IPHONEPLATFORMBASEDIR}/SDKs/iPhoneOS4.2.sdk/ -ap -Cfvfpv2" all sudo make FPC=`pwd`/compiler/ppcrossarm OPT="-ap" CPU_TARGET=arm CROSSOPT="-FD${IPHONEPLATFORMBASEDIR}/usr/bin -XR${IPHONEPLATFORMBASEDIR}/SDKs/iPhoneOS4.2.sdk/ -ap" install CROSSINSTALL=1 sudo ln -sf ../lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm
4) Build the 386 compiler for iOS Simulator.
cd /Developer/ObjectivePascal/fpc make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim all sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim install CROSSINSTALL=1
iOS Headers
The iOS headers must be manually generated using a script as they can not be legally distributed in translated Pascal form. The SDK used to parse the sources may not be the latest version of the SDK you installed from Xcode. Check that you have the SDK version used in the script make-ios-headers.sh before trying this step.
cd /Developer/ObjectivePascal/fpc/packages/cocoaint/utils ./make-ios-headers.sh
The headers will be parsed and saved into /Developer/ObjectivePascal/fpc/packages/cocoaint/utils/uikit-skel/src.
Compiling iOS sources
These are example commands you can use to compile iOS programs from the command line. Change the path of the iOS SDK to the version which you generated the headers for.
- Compile for iOS simulator
/usr/local/lib/fpc/2.5.1/ppcross386 -XX -Tiphonesim -Fu/Developer/ObjectivePascal/fpc/packages/cocoaint/utils/uikit-skel/src -XR/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk program.pas
- Compile for iOS device
/usr/local/lib/fpc/2.5.1/ppcrossarm -XX -Cfvfpv2 -Fu/Developer/ObjectivePascal/fpc/packages/cocoaint/utils/uikit-skel/src -FD/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin -XR/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk program.pas