source: general/prog/fpc.xml@ 179da23c

lazarus
Last change on this file since 179da23c was 179da23c, checked in by Thomas Trepl (Moody) <thomas@…>, 2 years ago

Fixes on FP

  • Property mode set to 100644
File size: 14.0 KB
RevLine 
[679dc07]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY fpc-bin-x86-dl "https://mirror.freemirror.org/pub/fpc/dist/&freepascal-bin-version;/x86_64-linux/fpc-&freepascal-bin-version;-x86_64-linux.tar">
8 <!ENTITY fpc-bin-x86-md5sum "519c5e0b9e7b61c07d61511a52aaecaa">
9 <!ENTITY fpc-bin-x86-size "80.4 MB">
10 <!ENTITY fpc-bin-x86-bldsize "x.x MB">
11
12 <!ENTITY fpc-bin-i686-dl "https://mirror.freemirror.org/pub/fpc/dist/&freepascal-bin-version;/i386-linux/fpc-&freepascal-bin-version;.i386-linux.tar">
13 <!ENTITY fpc-bin-i686-md5sum "2d9dece3f2c83a82cb07e422e59ca91e">
14 <!ENTITY fpc-bin-i686-size "146.7 MB">
15 <!ENTITY fpc-bin-i686-bldsize "x.x MB">
16
[179da23c]17 <!ENTITY fpc-src-dl "https://sourceforge.net/projects/freepascal/files/Source/&freepascal-version;/fpc-&freepascal-version;.source.tar.gz">
18 <!ENTITY fpc-src-md5sum "e7649ad0fc9230fdd9493a7fcabbd426">
19 <!ENTITY fpc-src-size "52.2 MB">
[679dc07]20 <!ENTITY fpc-src-bldsize "x.x MB">
21
22 <!ENTITY fpc-tmp-target "/opt/fpc-temp">
23]>
24
25<!--
26 TODO:
[8034a2b]27
28 Rebuild itself
[679dc07]29 The instructions below does the bootstrap by using a
30 binary package to compile the compiler.
31 I've never tested whether the built compiler is capable
32 to recompile itself, maybe it work, maybe not. With the
33 compiler which is installed, building QT5PAS and Lazarus
34 (the Delphi-like GUI) with QT or GTK2 toolkits does work.
35
36 We definitly should test this and maybe tweak the instructions
37 to do a correct build to enable this.
38-->
39
40<sect1 id="fpc" xreflabel="FreePascal-&freepascal-version;">
41 <?dbhtml filename="fpc.html"?>
42
43 <sect1info>
44 <date>$Date$</date>
45 </sect1info>
46
47 <title>FreePascal-&freepascal-version;</title>
48
49 <indexterm zone="java">
50 <primary sortas="a-java">FreePascal Binary</primary>
51 </indexterm>
52
[00cbc797]53 <sect2 id="fpc-bin" xreflabel="FPC Binary" role="package">
54 <title>Binary FreePascal Information</title>
[679dc07]55
56 <para>
57 FreePascal is a compiler software used to translate Pascal
58 source code to executable programs. An introductory Pascal
59 program looks like:
60 </para>
61
62<screen><literal>program Hello;
63begin
64 writeln('Hello world!');
65end.</literal></screen>
66
67 <para>
68 The <application>FreePascal</application> package does not only
69 contain the compiler itself but also a complete semi-graphical,
70 text based IDE. This IDE can be operated using keyboard commands
71 and by mouse interaction. The IDE is constructed with a toolkit
72 previously named <application>Turbo Vision</application> which
73 was introduced by Borland somewhere back in the MS-DOS age
74 together with <application>Turbo Pascal 6.0</application>
[00cbc797]75 - that was in Nov. 1990. This toolbox is available for own
76 programs, too.
[679dc07]77 </para>
78
79 <para>
80 Creating the <application>FreePascal</application> compiler from
81 source requires a <application>FreePascal</application> compiler
82 to be available. This is a circular dependency which can be
83 solved by using a precompiled package.
84 </para>
85
86 <para>
87 To start, we set up a binary installation of <application>FreePascal</application>
[00cbc797]88 created by the FreePascal development team. It is installed in
89 the <filename>/opt</filename> directory. Using this temporary
90 compiler installation, the compiler can be created from source.
91 After this step is done, the temporary compiler can be easily
92 removed.
[679dc07]93 </para>
94
95 &lfs110a_checked;
96
97 <bridgehead renderas="sect3">Binary Package Information</bridgehead>
98 <itemizedlist spacing="compact">
99 <listitem>
100 <para>
101 Binary download (x86): <ulink url="&fpc-bin-i686-dl;"/>
102 </para>
103 </listitem>
104 <listitem>
105 <para>
106 Download MD5 sum: &fpc-bin-i686-md5sum;
107 </para>
108 </listitem>
109 <listitem>
110 <para>
111 Download size (binary): &fpc-bin-i686-size;
112 </para>
113 </listitem>
114 <listitem>
115 <para>
116 Estimated disk space required: &fpc-bin-i686-bldsize;
117 </para>
118 </listitem>
119 </itemizedlist>
120 <itemizedlist spacing="compact">
121 <listitem>
122 <para>
123 Binary download (x86_64): <ulink url="&fpc-bin-x86-dl;"/>
124 </para>
125 </listitem>
126 <listitem>
127 <para>
128 Download MD5 sum: &fpc-bin-x86-md5sum;
129 </para>
130 </listitem>
131 <listitem>
132 <para>
133 Download size (binary): &fpc-bin-x86-size;
134 </para>
135 </listitem>
136 <listitem>
137 <para>
138 Estimated disk space required: &fpc-bin-x86-bldsize;
139 </para>
140 </listitem>
141 </itemizedlist>
142
143 <bridgehead renderas="sect3">Source Package Information</bridgehead>
144 <itemizedlist spacing="compact">
145 <listitem>
146 <para>
147 Source download: <ulink url="&fpc-src-dl;"/>
148 </para>
149 </listitem>
150 <listitem>
151 <para>
152 Download MD5 sum: &fpc-src-md5sum;
153 </para>
154 </listitem>
155 <listitem>
156 <para>
157 Download size (binary): &fpc-src-size;
158 </para>
159 </listitem>
160 <listitem>
161 <para>
162 Estimated disk space required: &fpc-src-bldsize;
163 </para>
164 </listitem>
165 </itemizedlist>
166
167 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
168 <itemizedlist spacing="compact">
169 <listitem>
170 <para>
171 Optional patch (Required if building on i686 systems):
172 <ulink url="&patch-root;/fpc-&freepascal-version;-glibc_2.34-1.patch"/>
173 </para>
174 </listitem>
175 </itemizedlist>
[904df6ec]176
177 <bridgehead renderas="sect3">FreePascal Dependencies</bridgehead>
[679dc07]178 <para role="required">
[904df6ec]179 <xref linkend="gdb"/> (with static library libgdb.a)
[679dc07]180 </para>
[904df6ec]181
182 <para condition="html" role="usernotes">User Notes:
183 <ulink url="&blfs-wiki;/fpc"/></para>
184
[679dc07]185 </sect2>
186
187 <sect2 role="installation">
188 <title>Installation of FreePascal</title>
189
[85d9842]190 <note>
191 <para>
192 While installation it is required to have administrator
193 privileges. It is assumed that the current user is allowed
194 to use <command>sudo</command> to gain full privileges.
195 </para>
196 <para>
197 Even a temporary binary compiler must be installed prior to
198 compile the compiler from the source, it is assumed that the
199 <application>FreePascal</application> sources has been
200 extracted and the current directory has been changed to it just
201 like as usual.
202 </para>
[ebc3421]203 <para>
204 In case there is a <application>FreePascal</application>
205 compiler installed allready, the temporary binary is not
206 required. The installed compiler should be appropriate to
207 compile the sources if the installed version is not too old.
208 </para>
[85d9842]209 </note>
210
[679dc07]211 <para>
212 Begin by extracting the appropriate binary tarball for your
[85d9842]213 architecture and changing to the extracted directory. This
214 extraction is performed within the extracted source directory.
215 Install the binary <application>FreePascal</application> and
216 remove some unused files with the following commands:
[679dc07]217 </para>
218
[85d9842]219<screen><userinput>case "$(uname -m)" in
220 i?86)
221 tar -xf ../../fpc-&freepascal-bin-version;.i386-linux.tar &amp;&amp;
222 cd fpc-&freepascal-bin-version;.i386-linux
223 ;;
224 x86_64)
225 tar -xf ../../fpc-&freepascal-bin-version;-x86_64-linux.tar &amp;&amp;
226 cd fpc-&freepascal-bin-version;-x86_64-linux
227 ;;
228esac &amp;&amp;
229rm demo.tar.gz &amp;&amp;
230rm doc-pdf.tar.gz &amp;&amp;
231sed -e 's;PREFIX=/usr;test -z "$PREFIX" \&amp;\&amp; &amp;;' -i install.sh</userinput></screen>
[679dc07]232
[85d9842]233 <para>
234 Prepare the install directory for the temporary compiler and
235 make it writable to the current user by executing as the
236 <systemitem class="username">root</systemitem> user:
237 </para>
[679dc07]238
[85d9842]239<screen role="root"><userinput>install -dm755 -o $(id -u) &fpc-tmp-target;</userinput></screen>
240
241 <para>
242 Install the temporary compiler:
243 </para>
[679dc07]244
[85d9842]245<screen><userinput>yes "" | { PREFIX=&fpc-tmp-target; ./install.sh; }</userinput></screen>
[679dc07]246
247 <para>Remove the extracted binary objects:</para>
248
249<screen><userinput>cd .. &amp;&amp;
[85d9842]250case "$(uname -m)" in
251 i?86)
252 rm -rf fpc-&freepascal-bin-version;.i386-linux
253 ;;
254 x86_64)
255 rm -rf fpc-&freepascal-bin-version;-x86_64-linux
256 ;;
[8034a2b]257esac &amp;&amp;
258export PATH=&fpc-tmp-target;/bin:$PATH</userinput></screen>
[679dc07]259
260 <para>
261 The binary version is now installed in
[85d9842]262 <filename class="directory">&fpc-tmp-target;</filename> and
263 can be used to create the compiler and utilities from source.
[679dc07]264 </para>
[8034a2b]265
266 <para>
267 Fix invalid path for man pages:
268 </para>
269
270<screen><userinput>sed -e "/^INSTALL_MANDIR=/ s;/man;/share/man;" \
271 -i install/man/Makefile</userinput></screen>
272
[679dc07]273 <para>
274 If building on i686 systems (32-bit), a patch is required
[85d9842]275 to overcome an issue with glibc-2.34.
[679dc07]276 </para>
277
[8034a2b]278<screen><userinput>cd fpcsrc &amp;&amp;
[179da23c]279patch -Np1 -i ../../fpc-&freepascal-version;-glibc_2.34-2.patch &amp;&amp;
[8034a2b]280cd ..</userinput></screen>
[679dc07]281
282 <para>
283 Compile the <application>FreePascal</application> compiler
284 and tools by executing the following commands:
285 </para>
286
[8034a2b]287<screen><userinput>make clean &amp;&amp;
[179da23c]288make build</userinput></screen>
[679dc07]289
290 <para>
291 Install the <application>FreePascal</application> compiler
292 and tools by executing the following commands as the
[8034a2b]293 <systemitem class="username">root</systemitem> user. Make sure
[ebc3421]294 that the temporary compiler is in <envar>PATH</envar>:
295 </para>
[679dc07]296
[8034a2b]297<screen role="root"><userinput>make -j1 PREFIX=/usr install &amp;&amp;
[679dc07]298case "$(uname -m)" in
299 i?86)
300 ln -svf /usr/lib/fpc/&freepascal-version;/ppc386 /usr/bin/
[85d9842]301 ;;
[679dc07]302 x86_64)
303 ln -svf /usr/lib/fpc/&freepascal-version;/ppcx64 /usr/bin/
[85d9842]304 ;;
[679dc07]305esac</userinput></screen>
306
307 <para>
308 Now that the compiler has been created from source, the temporary
309 compiler in <filename class="directory">&fpc-tmp-target;</filename>
310 can be removed. Execute the following commands as the
[85d9842]311 <systemitem class="username">root</systemitem> user:
312 </para>
[679dc07]313
314<screen role="root"><userinput>rm -rf /etc/fppkg* &amp;&amp;
315rm -rf /etc/fpc.* &amp;&amp;
[8034a2b]316rm -rf $HOME/{.fppkg,.fpc.cfg,.config/fppkg.cfg} &amp;&amp;
[679dc07]317rm -rf &fpc-tmp-target;</userinput></screen>
318
[8034a2b]319 <para>
320 You may also want to remove the <filename class="directory">&fpc-tmp-target;</filename>
321 entry from <envar>PATH</envar> now.
322 </para>
[679dc07]323 </sect2>
324
325 <sect2 role="configuration">
326 <title>Configuring FreePascal</title>
327
328 <para>
329 A default configuration file <filename>/etc/fpc.cfg</filename>
330 can be created by a tool which is part of the compiler suite.
331 Generate the default config file as the
332 <systemitem class="username">root</systemitem> user:
333 </para>
334
335<screen role="root"><userinput>/usr/lib/fpc/&freepascal-version;/samplecfg /usr/lib/fpc/&freepascal-version; /etc &amp;&amp;
336cat &gt;&gt; /etc/fpc.cfg &lt;&lt;EOF
337#ifdef cpux86_64
338# for x86_64 use -fPIC by default
339-Cg
340#endif
341EOF</userinput></screen>
342
343 <para>
344 If you are going to use QT (most likely when building Lazarus
345 with the QT library), add the QT library path to the config as the
346 <systemitem class="username">root</systemitem> user:
347 </para>
348
349<screen role="root"><userinput>sed -e "/^-Fl\/usr\/lib\/fpc/a -Fl/opt/qt5/lib" \
350 -i /etc/fpc.cfg</userinput></screen>
351
[00cbc797]352 <para>
353 It is highly recommended that the compiler sources are available
[8034a2b]354 for later use. Since the sources are available on disk already
355 they can be used but some binaries built in the source tree
356 should be removed first:
357 </para>
358
359<screen><userinput>make clean</userinput></screen>
360
361 <para>
362 To copy the source, execute the following command as the
[00cbc797]363 <systemitem class="username">root</systemitem> user:
364 </para>
365
[8034a2b]366<screen role="root"><userinput>mv fpcsrc /usr/lib/fpc/src</userinput></screen>
[00cbc797]367
[679dc07]368 </sect2>
369
[904df6ec]370 <sect2 role="content">
371 <title>Contents</title>
372
373 <segmentedlist>
374 <segtitle>Installed Program</segtitle>
375 <segtitle>Installed Libraries</segtitle>
376 <segtitle>Installed Directories</segtitle>
377
378 <seglistitem>
[85d9842]379 <seg>fpc, fp, samplecfg, ...</seg>
[904df6ec]380 <seg>None</seg>
[8034a2b]381 <seg>/usr/lib/fpc</seg>
[904df6ec]382 </seglistitem>
383 </segmentedlist>
384
385 <variablelist>
386 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
387 <?dbfo list-presentation="list"?>
388 <?dbhtml list-presentation="table"?>
389
390 <varlistentry id="i-fp">
391 <term><command>fp</command></term>
392 <listitem>
393 <para>
394 FreePascal text based IDE
395 </para>
396 <indexterm zone="fpc i-fp">
397 <primary sortas="b-fp">fp</primary>
398 </indexterm>
399 </listitem>
400 </varlistentry>
401
402 <varlistentry id="i-fpc">
403 <term><command>fpc</command></term>
404 <listitem>
405 <para>
406 FreePascal compiler frontend
407 </para>
408 <indexterm zone="fpc i-fpc">
409 <primary sortas="b-fpc">fpc</primary>
410 </indexterm>
411 </listitem>
412 </varlistentry>
413
414 <varlistentry id="i-fpcmake">
415 <term><command>fpcmake</command></term>
416 <listitem>
417 <para>
418 FreePascal make utility
419 </para>
420 <indexterm zone="fpc i-fpcmake">
421 <primary sortas="b-fpcmake">fpcmake</primary>
422 </indexterm>
423 </listitem>
424 </varlistentry>
425
[85d9842]426 <varlistentry id="i-samplecfg">
427 <term><command>samplecfg</command></term>
428 <listitem>
429 <para>
430 Utility to create a default configuration file
431 </para>
432 <indexterm zone="fpc i-samplecfg">
433 <primary sortas="b-samplecfg">samplecfg</primary>
434 </indexterm>
435 </listitem>
436 </varlistentry>
437
[904df6ec]438 </variablelist>
439
440 </sect2>
441
[679dc07]442</sect1>
Note: See TracBrowser for help on using the repository browser.