Sign in Join
Wiki copytemporary

objectivepascal: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11> **Warning:** This information would be appear to be out of date.
22
33## Version References
44
55This article makes reference to various versions (in scripts and commands) that may not be the most current. Please verify they are correct on your system before trying any of the commands.
66
77- 2.4.2 - The base install of FPC (used for bootstrapping the installation of the latest version)
88- 2.5.1 - The latest version of FPC used for compiling Objective Pascal (macOS and iOS)
99- iPhoneOS4.2.sdk - The latest iOS SDK which is compatible with the translated headers.
1010
1111## Downloading Sources
1212
1313Before 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.
1414
1515To check out the FPC sources for the first time use the command:
1616
17-`svn co `[`http://svn.freepascal.org/svn/fpc/trunk`](http://svn.freepascal.org/svn/fpc/trunk)` /Developer/ObjectivePascal/fpc`
17+```text
18+svn co http://svn.freepascal.org/svn/fpc/trunk /Developer/ObjectivePascal/fpc
19+```
1820
1921To update the FPC sources from a previous download use the command:
2022
21-`svn up `[`http://svn.freepascal.org/svn/fpc/trunk`](http://svn.freepascal.org/svn/fpc/trunk)` /Developer/ObjectivePascal/fpc`
23+```text
24+svn up http://svn.freepascal.org/svn/fpc/trunk /Developer/ObjectivePascal/fpc
25+```
2226
2327## Building the compiler for Mac OS X development
2428
25291\) Download the latest version of FPC and Xcode developer tools then install.
2630
2731- <http://www.freepascal.org/down/i386/macosx-ftp.freepascal.org.var>
2832- <http://developer.apple.com/devcenter/mac>
2933
30342\) Download the latest version of the sources (see #Downloading Sources)
3135
32363\) Build the Intel compiler to `/usr/local/lib/fpc/2.5.1/ppc386`
3337
34-`cd /Developer/ObjectivePascal/fpc`\
35-`sudo make distclean -j 3`\
36-`sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" distclean all -j 2`\
37-`` sudo make FPC=`pwd`/compiler/ppc386 install ``
38+```text
39+cd /Developer/ObjectivePascal/fpc
40+sudo make distclean -j 3
41+sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" distclean all -j 2
42+sudo make FPC=`pwd`/compiler/ppc386 install
43+```
3844
39454\) Build the PPC compiler to `/usr/local/lib/fpc/2.5.1/ppcppc`.
4046
41-`cd /Developer/ObjectivePascal/fpc`\
42-`sudo make distclean -j 3`\
43-`sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" distclean CPU_TARGET=powerpc all -j 2`\
44-`` sudo make FPC=`pwd`/compiler/ppcppc CROSSINSTALL=1 install ``\
45-`sudo mv /usr/local/lib/fpc/2.5.1/ppcrossppc /usr/local/lib/fpc/2.5.1/ppcppc`
47+```text
48+cd /Developer/ObjectivePascal/fpc
49+sudo make distclean -j 3
50+sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" distclean CPU_TARGET=powerpc all -j 2
51+sudo make FPC=`pwd`/compiler/ppcppc CROSSINSTALL=1 install
52+sudo mv /usr/local/lib/fpc/2.5.1/ppcrossppc /usr/local/lib/fpc/2.5.1/ppcppc
53+```
4654
47555\) Build the 64-bit compiler to `/usr/local/lib/fpc/2.5.1/ppcx64`.
4856
4957cd /Developer/ObjectivePascal/fpc sudo make distclean -j 3 make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OPT="-ap" CPU_TARGET=x86_64 all -j 2 sudo make FPC=\`pwd\`/compiler/ppcx64 CROSSINSTALL=1 install sudo mv /usr/local/lib/fpc/2.5.1/ppcrossx64 /usr/local/lib/fpc/2.5.1/ppcx64
5058
5159### Cocoa Headers
5260
5361The 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`.
5462
5563## Building the compiler for iOS development
5664
5765Follow the steps below to install the ARM compiler and 386 compiler for iOS simulator. 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.
5866
59671\) 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.
6068
6169If 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.
6270
6371- <http://www.freepascal.org/down/i386/macosx-ftp.freepascal.org.var>
6472- <http://developer.apple.com/devcenter/mac> (Xcode Developer Tools)
6573
66742\) Download the latest version of the sources (see #Downloading Sources)
6775
68763\) Make **sig_cpu.inc** (a file that can not be distributed without violating the Apple user agreement) by running the command below. Please note you may need to set the path to the iOS SDK you are using by editing the variables *IPHONEINSTALLDIR* and *IPHONESDKDIR*. If the command was successful the file should exist at */Developer/ObjectivePascal/fpc/rtl/darwin/arm/sig_cpu.inc*.
6977
70-`FPCSOURCEDIR=/Developer/ObjectivePascal/fpc`\
71-`IPHONEINSTALLDIR=/Developer`\
72-`IPHONESDKDIR=iPhoneOS4.2.sdk`\
73-`IPHONEPLATFORMBASEDIR="$IPHONEINSTALLDIR"/"Platforms/iPhoneOS.platform/Developer"`\
74-`INCLUDEDIR="$IPHONEPLATFORMBASEDIR"/"SDKs/$IPHONESDKDIR/usr/include"`\
75-`STRUCTSHEADER="$INCLUDEDIR"/arm/_structs.h`\
76-`/usr/bin/gcc -I"$INCLUDEDIR" -E -D__need_mcontext_t -D__DARWIN_UNIX03 "$STRUCTSHEADER" | sed -e 's/__uint32_t/cuint32/g' -e 's/_STRUCT_ARM_EXCEPTION_STATE/__darwin_arm_exception_state/' -e 's/_STRUCT_ARM_THREAD_STATE/__darwin_arm_thread_state/' -e 's/_STRUCT_ARM_VFP_STATE/__darwin_arm_vfp_state/' -e 's/__darwin_mcontext/mcontext_t/' > "$FPCSOURCEDIR"/rtl/darwin/arm/sig_cpu.h`\
77-`/usr/local/bin/h2pas -i -o "$FPCSOURCEDIR"/rtl/darwin/arm/sig_cpu.inc "$FPCSOURCEDIR"/rtl/darwin/arm/sig_cpu.h`
78+```text
79+FPCSOURCEDIR=/Developer/ObjectivePascal/fpc
80+IPHONEINSTALLDIR=/Developer
81+IPHONESDKDIR=iPhoneOS4.2.sdk
82+IPHONEPLATFORMBASEDIR="$IPHONEINSTALLDIR"/"Platforms/iPhoneOS.platform/Developer"
83+INCLUDEDIR="$IPHONEPLATFORMBASEDIR"/"SDKs/$IPHONESDKDIR/usr/include"
84+STRUCTSHEADER="$INCLUDEDIR"/arm/_structs.h
85+/usr/bin/gcc -I"$INCLUDEDIR" -E -D__need_mcontext_t -D__DARWIN_UNIX03 "$STRUCTSHEADER" | sed -e 's/__uint32_t/cuint32/g' -e 's/_STRUCT_ARM_EXCEPTION_STATE/__darwin_arm_exception_state/' -e 's/_STRUCT_ARM_THREAD_STATE/__darwin_arm_thread_state/' -e 's/_STRUCT_ARM_VFP_STATE/__darwin_arm_vfp_state/' -e 's/__darwin_mcontext/mcontext_t/' > "$FPCSOURCEDIR"/rtl/darwin/arm/sig_cpu.h
86+/usr/local/bin/h2pas -i -o "$FPCSOURCEDIR"/rtl/darwin/arm/sig_cpu.inc "$FPCSOURCEDIR"/rtl/darwin/arm/sig_cpu.h
87+```
7888
79894\) Build the ARM cross-compiler to `/usr/local/lib/fpc/2.5.1/ppcrossarm`
8090
8191- Currently, 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>.
8292
83-`cd /Developer/ObjectivePascal/fpc`\
84-`export IPHONEPLATFORMBASEDIR=/Developer/Platforms/iPhoneOS.platform/Developer`\
85-`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`\
86-`` 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 ``\
87-`sudo ln -sf ../lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm`
93+```text
94+cd /Developer/ObjectivePascal/fpc
95+export IPHONEPLATFORMBASEDIR=/Developer/Platforms/iPhoneOS.platform/Developer
96+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
97+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
98+sudo ln -sf ../lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm
99+```
88100
891015\) Build the Intel compiler for iOS Simulator `/usr/local/lib/fpc/2.5.1/ppc386`
90102
91-`cd /Developer/ObjectivePascal/fpc`\
92-`make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim all`\
93-`sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim install CROSSINSTALL=1`
103+```text
104+cd /Developer/ObjectivePascal/fpc
105+make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim all
106+sudo make FPC=/usr/local/lib/fpc/2.4.2/ppc386 OS_TARGET=iphonesim install CROSSINSTALL=1
107+```
94108
95109### iOS Headers
96110
97111The 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.
98112
99-`cd /Developer/ObjectivePascal/fpc/packages/cocoaint/utils`\
100-`./make-ios-headers.sh`
113+```text
114+cd /Developer/ObjectivePascal/fpc/packages/cocoaint/utils
115+./make-ios-headers.sh
116+```
101117
102118The headers will be parsed and saved into `/Developer/ObjectivePascal/fpc/packages/cocoaint/utils/uikit-skel/src`.
103119
104120### Compiling iOS Sources
105121
106122These 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.
107123
108124- Example command for iOS simulator
109125
110-`/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`
126+``` pascal
127+/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
128+```
111129
112130- Example command for iOS device
113131
114-`/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`
132+``` pascal
133+/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
134+```
115135
116136---
117137*From the Free Pascal wiki, page "objectivepascal", as it stood on 2021-01-05 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
118138Category: Historical
119139Category: iOS
120140Category: macOS

Back to history