source: general/prog/fpc.xml@ 85d9842

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

Fix instuctions to install fpc

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