source: general/prog/fpc.xml@ 8034a2b

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

Use fpcbuild package istead of source-only package

  • Property mode set to 100644
File size: 13.7 KB
Line 
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
17 <!ENTITY fpc-src-dl "https://mirror.freemirror.org/pub/fpc/dist/&freepascal-version;/source/fpcbuild-&freepascal-version;.tar.gz">
18 <!ENTITY fpc-src-md5sum "3681ae4a208be4f64ec65e832a9a702d">
19 <!ENTITY fpc-src-size "80.2 MB">
20 <!ENTITY fpc-src-bldsize "x.x MB">
21
22 <!ENTITY fpc-tmp-target "/opt/fpc-temp">
23]>
24
25<!--
26 TODO:
27
28 Rebuild itself
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
53 <sect2 id="fpc-bin" xreflabel="FPC Binary" role="package">
54 <title>Binary FreePascal Information</title>
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>
75 - that was in Nov. 1990. This toolbox is available for own
76 programs, too.
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>
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.
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>
176
177 <bridgehead renderas="sect3">FreePascal Dependencies</bridgehead>
178 <para role="required">
179 <xref linkend="gdb"/> (with static library libgdb.a)
180 </para>
181
182 <para condition="html" role="usernotes">User Notes:
183 <ulink url="&blfs-wiki;/fpc"/></para>
184
185 </sect2>
186
187 <sect2 role="installation">
188 <title>Installation of FreePascal</title>
189
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>
203 </note>
204
205 <para>
206 Begin by extracting the appropriate binary tarball for your
207 architecture and changing to the extracted directory. This
208 extraction is performed within the extracted source directory.
209 Install the binary <application>FreePascal</application> and
210 remove some unused files with the following commands:
211 </para>
212
213<screen><userinput>case "$(uname -m)" in
214 i?86)
215 tar -xf ../../fpc-&freepascal-bin-version;.i386-linux.tar &amp;&amp;
216 cd fpc-&freepascal-bin-version;.i386-linux
217 ;;
218 x86_64)
219 tar -xf ../../fpc-&freepascal-bin-version;-x86_64-linux.tar &amp;&amp;
220 cd fpc-&freepascal-bin-version;-x86_64-linux
221 ;;
222esac &amp;&amp;
223rm demo.tar.gz &amp;&amp;
224rm doc-pdf.tar.gz &amp;&amp;
225sed -e 's;PREFIX=/usr;test -z "$PREFIX" \&amp;\&amp; &amp;;' -i install.sh</userinput></screen>
226
227 <para>
228 Prepare the install directory for the temporary compiler and
229 make it writable to the current user by executing as the
230 <systemitem class="username">root</systemitem> user:
231 </para>
232
233<screen role="root"><userinput>install -dm755 -o $(id -u) &fpc-tmp-target;</userinput></screen>
234
235 <para>
236 Install the temporary compiler:
237 </para>
238
239<screen><userinput>yes "" | { PREFIX=&fpc-tmp-target; ./install.sh; }</userinput></screen>
240
241 <para>Remove the extracted binary objects:</para>
242
243<screen><userinput>cd .. &amp;&amp;
244case "$(uname -m)" in
245 i?86)
246 rm -rf fpc-&freepascal-bin-version;.i386-linux
247 ;;
248 x86_64)
249 rm -rf fpc-&freepascal-bin-version;-x86_64-linux
250 ;;
251esac &amp;&amp;
252export PATH=&fpc-tmp-target;/bin:$PATH</userinput></screen>
253
254 <para>
255 The binary version is now installed in
256 <filename class="directory">&fpc-tmp-target;</filename> and
257 can be used to create the compiler and utilities from source.
258 </para>
259
260 <para>
261 Fix invalid path for man pages:
262 </para>
263
264<screen><userinput>sed -e "/^INSTALL_MANDIR=/ s;/man;/share/man;" \
265 -i install/man/Makefile</userinput></screen>
266
267 <para>
268 If building on i686 systems (32-bit), a patch is required
269 to overcome an issue with glibc-2.34.
270 </para>
271
272<screen><userinput>cd fpcsrc &amp;&amp;
273patch -Np1 -i ../../fpc-&freepascal-version;-glibc_2.34-1.patch &amp;&amp;
274cd ..</userinput></screen>
275
276 <para>
277 Compile the <application>FreePascal</application> compiler
278 and tools by executing the following commands:
279 </para>
280
281<screen><userinput>make clean &amp;&amp;
282make OVERRIDEVERSIONCHECK=1 build</userinput></screen>
283
284 <para>
285 Install the <application>FreePascal</application> compiler
286 and tools by executing the following commands as the
287 <systemitem class="username">root</systemitem> user. Make sure
288 that the temporary compiler is in <envar>PATH</envar>:</para>
289
290<screen role="root"><userinput>make -j1 PREFIX=/usr install &amp;&amp;
291case "$(uname -m)" in
292 i?86)
293 ln -svf /usr/lib/fpc/&freepascal-version;/ppc386 /usr/bin/
294 ;;
295 x86_64)
296 ln -svf /usr/lib/fpc/&freepascal-version;/ppcx64 /usr/bin/
297 ;;
298esac</userinput></screen>
299
300 <para>
301 Now that the compiler has been created from source, the temporary
302 compiler in <filename class="directory">&fpc-tmp-target;</filename>
303 can be removed. Execute the following commands as the
304 <systemitem class="username">root</systemitem> user:
305 </para>
306
307<screen role="root"><userinput>rm -rf /etc/fppkg* &amp;&amp;
308rm -rf /etc/fpc.* &amp;&amp;
309rm -rf $HOME/{.fppkg,.fpc.cfg,.config/fppkg.cfg} &amp;&amp;
310rm -rf &fpc-tmp-target;</userinput></screen>
311
312 <para>
313 You may also want to remove the <filename class="directory">&fpc-tmp-target;</filename>
314 entry from <envar>PATH</envar> now.
315 </para>
316 </sect2>
317
318 <sect2 role="configuration">
319 <title>Configuring FreePascal</title>
320
321 <para>
322 A default configuration file <filename>/etc/fpc.cfg</filename>
323 can be created by a tool which is part of the compiler suite.
324 Generate the default config file as the
325 <systemitem class="username">root</systemitem> user:
326 </para>
327
328<screen role="root"><userinput>/usr/lib/fpc/&freepascal-version;/samplecfg /usr/lib/fpc/&freepascal-version; /etc &amp;&amp;
329cat &gt;&gt; /etc/fpc.cfg &lt;&lt;EOF
330#ifdef cpux86_64
331# for x86_64 use -fPIC by default
332-Cg
333#endif
334EOF</userinput></screen>
335
336 <para>
337 If you are going to use QT (most likely when building Lazarus
338 with the QT library), add the QT library path to the config as the
339 <systemitem class="username">root</systemitem> user:
340 </para>
341
342<screen role="root"><userinput>sed -e "/^-Fl\/usr\/lib\/fpc/a -Fl/opt/qt5/lib" \
343 -i /etc/fpc.cfg</userinput></screen>
344
345 <para>
346 It is highly recommended that the compiler sources are available
347 for later use. Since the sources are available on disk already
348 they can be used but some binaries built in the source tree
349 should be removed first:
350 </para>
351
352<screen><userinput>make clean</userinput></screen>
353
354 <para>
355 To copy the source, execute the following command as the
356 <systemitem class="username">root</systemitem> user:
357 </para>
358
359<screen role="root"><userinput>mv fpcsrc /usr/lib/fpc/src</userinput></screen>
360
361 </sect2>
362
363 <sect2 role="content">
364 <title>Contents</title>
365
366 <segmentedlist>
367 <segtitle>Installed Program</segtitle>
368 <segtitle>Installed Libraries</segtitle>
369 <segtitle>Installed Directories</segtitle>
370
371 <seglistitem>
372 <seg>fpc, fp, samplecfg, ...</seg>
373 <seg>None</seg>
374 <seg>/usr/lib/fpc</seg>
375 </seglistitem>
376 </segmentedlist>
377
378 <variablelist>
379 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
380 <?dbfo list-presentation="list"?>
381 <?dbhtml list-presentation="table"?>
382
383 <varlistentry id="i-fp">
384 <term><command>fp</command></term>
385 <listitem>
386 <para>
387 FreePascal text based IDE
388 </para>
389 <indexterm zone="fpc i-fp">
390 <primary sortas="b-fp">fp</primary>
391 </indexterm>
392 </listitem>
393 </varlistentry>
394
395 <varlistentry id="i-fpc">
396 <term><command>fpc</command></term>
397 <listitem>
398 <para>
399 FreePascal compiler frontend
400 </para>
401 <indexterm zone="fpc i-fpc">
402 <primary sortas="b-fpc">fpc</primary>
403 </indexterm>
404 </listitem>
405 </varlistentry>
406
407 <varlistentry id="i-fpcmake">
408 <term><command>fpcmake</command></term>
409 <listitem>
410 <para>
411 FreePascal make utility
412 </para>
413 <indexterm zone="fpc i-fpcmake">
414 <primary sortas="b-fpcmake">fpcmake</primary>
415 </indexterm>
416 </listitem>
417 </varlistentry>
418
419 <varlistentry id="i-samplecfg">
420 <term><command>samplecfg</command></term>
421 <listitem>
422 <para>
423 Utility to create a default configuration file
424 </para>
425 <indexterm zone="fpc i-samplecfg">
426 <primary sortas="b-samplecfg">samplecfg</primary>
427 </indexterm>
428 </listitem>
429 </varlistentry>
430
431 </variablelist>
432
433 </sect2>
434
435</sect1>
Note: See TracBrowser for help on using the repository browser.