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://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 | <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;
|
---|
63 | begin
|
---|
64 | writeln('Hello world!');
|
---|
65 | end.</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 | <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>
|
---|
209 | </note>
|
---|
210 |
|
---|
211 | <para>
|
---|
212 | Begin by extracting the appropriate binary tarball for your
|
---|
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:
|
---|
217 | </para>
|
---|
218 |
|
---|
219 | <screen><userinput>case "$(uname -m)" in
|
---|
220 | i?86)
|
---|
221 | tar -xf ../../fpc-&freepascal-bin-version;.i386-linux.tar &&
|
---|
222 | cd fpc-&freepascal-bin-version;.i386-linux
|
---|
223 | ;;
|
---|
224 | x86_64)
|
---|
225 | tar -xf ../../fpc-&freepascal-bin-version;-x86_64-linux.tar &&
|
---|
226 | cd fpc-&freepascal-bin-version;-x86_64-linux
|
---|
227 | ;;
|
---|
228 | esac &&
|
---|
229 | rm demo.tar.gz &&
|
---|
230 | rm doc-pdf.tar.gz &&
|
---|
231 | sed -e 's;PREFIX=/usr;test -z "$PREFIX" \&\& &;' -i install.sh</userinput></screen>
|
---|
232 |
|
---|
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>
|
---|
238 |
|
---|
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>
|
---|
244 |
|
---|
245 | <screen><userinput>yes "" | { PREFIX=&fpc-tmp-target; ./install.sh; }</userinput></screen>
|
---|
246 |
|
---|
247 | <para>Remove the extracted binary objects:</para>
|
---|
248 |
|
---|
249 | <screen><userinput>cd .. &&
|
---|
250 | case "$(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 | ;;
|
---|
257 | esac &&
|
---|
258 | export PATH=&fpc-tmp-target;/bin:$PATH</userinput></screen>
|
---|
259 |
|
---|
260 | <para>
|
---|
261 | The binary version is now installed in
|
---|
262 | <filename class="directory">&fpc-tmp-target;</filename> and
|
---|
263 | can be used to create the compiler and utilities from source.
|
---|
264 | </para>
|
---|
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 |
|
---|
273 | <para>
|
---|
274 | If building on i686 systems (32-bit), a patch is required
|
---|
275 | to overcome an issue with glibc-2.34.
|
---|
276 | </para>
|
---|
277 |
|
---|
278 | <screen><userinput>cd fpcsrc &&
|
---|
279 | patch -Np1 -i ../../fpc-&freepascal-version;-glibc_2.34-2.patch &&
|
---|
280 | cd ..</userinput></screen>
|
---|
281 |
|
---|
282 | <para>
|
---|
283 | Compile the <application>FreePascal</application> compiler
|
---|
284 | and tools by executing the following commands:
|
---|
285 | </para>
|
---|
286 |
|
---|
287 | <screen><userinput>make clean &&
|
---|
288 | make build</userinput></screen>
|
---|
289 |
|
---|
290 | <para>
|
---|
291 | Install the <application>FreePascal</application> compiler
|
---|
292 | and tools by executing the following commands as the
|
---|
293 | <systemitem class="username">root</systemitem> user. Make sure
|
---|
294 | that the temporary compiler is in <envar>PATH</envar>:
|
---|
295 | </para>
|
---|
296 |
|
---|
297 | <screen role="root"><userinput>make -j1 PREFIX=/usr install &&
|
---|
298 | case "$(uname -m)" in
|
---|
299 | i?86)
|
---|
300 | ln -svf /usr/lib/fpc/&freepascal-version;/ppc386 /usr/bin/
|
---|
301 | ;;
|
---|
302 | x86_64)
|
---|
303 | ln -svf /usr/lib/fpc/&freepascal-version;/ppcx64 /usr/bin/
|
---|
304 | ;;
|
---|
305 | esac</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
|
---|
311 | <systemitem class="username">root</systemitem> user:
|
---|
312 | </para>
|
---|
313 |
|
---|
314 | <screen role="root"><userinput>rm -rf /etc/fppkg* &&
|
---|
315 | rm -rf /etc/fpc.* &&
|
---|
316 | rm -rf $HOME/{.fppkg,.fpc.cfg,.config/fppkg.cfg} &&
|
---|
317 | rm -rf &fpc-tmp-target;</userinput></screen>
|
---|
318 |
|
---|
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>
|
---|
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 &&
|
---|
336 | cat >> /etc/fpc.cfg <<EOF
|
---|
337 | #ifdef cpux86_64
|
---|
338 | # for x86_64 use -fPIC by default
|
---|
339 | -Cg
|
---|
340 | #endif
|
---|
341 | EOF</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 |
|
---|
352 | <para>
|
---|
353 | It is highly recommended that the compiler sources are available
|
---|
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
|
---|
363 | <systemitem class="username">root</systemitem> user:
|
---|
364 | </para>
|
---|
365 |
|
---|
366 | <screen role="root"><userinput>mv fpcsrc /usr/lib/fpc/src</userinput></screen>
|
---|
367 |
|
---|
368 | </sect2>
|
---|
369 |
|
---|
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>
|
---|
379 | <seg>fpc, fp, samplecfg, ...</seg>
|
---|
380 | <seg>None</seg>
|
---|
381 | <seg>/usr/lib/fpc</seg>
|
---|
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 |
|
---|
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 |
|
---|
438 | </variablelist>
|
---|
439 |
|
---|
440 | </sect2>
|
---|
441 |
|
---|
442 | </sect1>
|
---|