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