Skip to content

Commit 7c7f834

Browse files
committed
debian: Extending build instructions for DEB_BUILD_OPTIONS
1 parent d9d2d66 commit 7c7f834

File tree

1 file changed

+87
-34
lines changed

1 file changed

+87
-34
lines changed

docs/src/code/building-linuxcnc.adoc

Lines changed: 87 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ http://buildbot.linuxcnc.org
1818
For the impatient, try this:
1919

2020
----
21-
$ git clone https://github.com/LinuxCNC/linuxcnc.git linuxcnc-dev
22-
$ cd linuxcnc-dev/src
21+
$ git clone https://github.com/LinuxCNC/linuxcnc.git linuxcnc-source-dir
22+
$ cd linuxcnc-source-dir/src
2323
$ ./autogen.sh
2424
$ ./configure --with-realtime=uspace
2525
$ make
@@ -125,7 +125,7 @@ It takes many optional arguments.
125125
List all arguments to `src/configure` by running this:
126126

127127
-----
128-
$ cd linuxcnc-dev/src
128+
$ cd linuxcnc-source-dir/src
129129
$ ./configure --help
130130
-----
131131

@@ -142,8 +142,7 @@ The most commonly used arguments are:
142142
these real-time kernels will also be enabled.
143143

144144
`--with-realtime=/usr/realtime-$VERSION`::
145-
Build for the RTAI realtime platform using the older "kernel realtime"
146-
model.
145+
Build for the RTAI realtime platform using the older "kernel realtime" model.
147146
This requires that you have an RTAI kernel and the RTAI modules
148147
installed in `/usr/realtime-$VERSION`. The resulting LinuxCNC
149148
executables will only run on the specified RTAI kernel. As of
@@ -180,7 +179,7 @@ Building just a specific target::
180179
executable by running:
181180
+
182181
-----
183-
$ cd linuxcnc-dev/src
182+
$ cd linuxcnc-source-dir/src
184183
$ make ../bin/froboz
185184
-----
186185

@@ -214,7 +213,7 @@ The first step is generating the Debian package scripts and meta-data
214213
from the git repo by running this:
215214

216215
----
217-
$ cd linuxcnc-dev/debian
216+
$ cd linuxcnc-source-dir/debian
218217
$ ./configure uspace
219218
$ cd ..
220219
----
@@ -235,21 +234,22 @@ $ dpkg-buildpackage -b -uc
235234

236235
[NOTE]
237236
====
238-
`dpkg-buildpackage` needs to run from the `linuxcnc-dev` directory, *not* from `linuxcnc-dev/debian`. +
237+
`dpkg-buildpackage` needs to run from the `linuxcnc-source-dir` directory, *not* from `linuxcnc-source-dir/debian`. +
239238
`dpkg-buildpackage` takes an optional argument `-jN` (where N is a number). This enables to run multiple jobs simultaneously.
240239
====
241240

242241
[[debian-configure-arguments]]
243-
==== `debian/configure` arguments
242+
==== LinuxCNC's `debian/configure` arguments
244243

245-
The `debian/configure` script configures the Debian packaging.
246-
It must be run before `dpkg-checkbuilddeps` and `dpkg-buildpackage` can be run.
244+
The LinuxCNC source tree has a debian directory with all the info about how the Debian package shall be built,
245+
but some key files within are only distributed as templates. The `debian/configure` script readies those build instructions
246+
for the regular Debian packaging utilities and must thus be run prior to `dpkg-checkbuilddeps` or `dpkg-buildpackage`.
247247

248-
It takes a single argument which specifies the realtime or non-realtime platform to build for.
249-
The normal values for this argument are:
248+
The `debian/configure` script takes a single argument which specifies the underlying realtime or non-realtime platform to build for.
249+
The regular values for this argument are:
250250

251251
`no-docs`::
252-
Skip building documentation.
252+
Skip building documentation.
253253

254254
`uspace`::
255255
Configure the Debian package for Preempt-RT realtime or for
@@ -286,36 +286,43 @@ If you want just the traditional RTAI "kernel module" realtime, use
286286
the test suite.
287287

288288
[[Satisfying-Build-Dependencies]]
289-
== Satisfying Build Dependencies
289+
==== Satisfying Build Dependencies
290290

291-
On Debian-based platforms we provide packaging meta-data that knows
292-
what external software packages need to be installed in order to build
293-
LinuxCNC. This is called the Build Dependencies of LinuxCNC. You can
294-
use this meta-data to easily list the required packages missing from
295-
your build system.
291+
On Debian-based platforms we provide packaging meta-data that knows what
292+
external software packages need to be installed in order to build LinuxCNC.
293+
This is called the Build Dependencies of LinuxCNC. These differ between
294+
platforms that LinuxCNC is configured for, so first run the following code
295+
sniplet in the root of your LinuxCNC git checkout to generate its Debian
296+
package meta-data:
296297

297-
Debian systems provide a program called `dpkg-checkbuilddeps` that
298+
-----
299+
$ cd linuxcnc-source-dir/debian
300+
$ ./configure uspace
301+
$ cd ..
302+
-----
303+
304+
This generates the file `debian/control` in a user-readable yaml-format
305+
which lists the build-dependencies close to the top.
306+
You can use this meta-data to easily list the required packages missing from
307+
your build system. You may decide to manually inspecting those files if you
308+
have a good understanding what is already installed.
309+
310+
Alternatively, Debian systems provide a program called `dpkg-checkbuilddeps` that
298311
parses the package meta-data and compares the packages listed as build
299312
dependencies against the list of installed packages, and tells you
300-
what's missing.
313+
what's missing. Also, `dpkg-buildpackage` would inform you about what is missing,
314+
and it should be fine, but it reports missing build-deps only after patches in debian/patches
315+
are applied (if any), and if you are new to Linux and git version management,
316+
for a clean start it may be preferable to check first.
301317

302-
First, install the `dpkg-checkbuilddeps` program by running:
318+
Hereto, install the `dpkg-checkbuilddeps` program by running:
303319

304320
-----
305321
$ sudo apt-get install dpkg-dev
306322
-----
307323

308-
Then ask your LinuxCNC git checkout to generate its Debian package
309-
meta-data:
310-
311-
-----
312-
$ cd linuxcnc-dev/debian
313-
$ ./configure uspace
314-
$ cd ..
315-
-----
316-
317324
Finally ask `dpkg-checkbuilddeps` to do its job (note that it needs to
318-
run from the `linuxcnc-dev` directory, *not* from `linuxcnc-dev/debian`):
325+
run from the `linuxcnc-source-dir` directory, *not* from `linuxcnc-source-dir/debian`):
319326

320327
-----
321328
$ dpkg-checkbuilddeps
@@ -326,7 +333,53 @@ on your system, but that are not installed yet. Install them all with
326333
`sudo apt-get install`, followed by the package names.
327334

328335
You can rerun `dpkg-checkbuilddeps` any time you want, to list any
329-
missing packages.
336+
missing packages, which has no effect on the source tree.
337+
338+
==== Options for `dpkg-buildpackage`
339+
340+
For a typical Debian package to build, you would run dpkg-buildpackage without any arguments.
341+
As introduced above, the command has two extra options passed to it.
342+
Like for all good Linux tools, the man page has all the details with `man dpkg-buildpackage`.
343+
344+
`-uc`:: Do not sign the resulting binaries. You would want to sign your packages with a GPG key of yours only if you would wanted to distribute them to others. Having that option not set and then failing to sign the package would not affect the .deb file.
345+
346+
`-b`:: Only compiled the architecture-dependent packages (like the `linuxcnc` binaries and GUIs). This is very helpful to avoid compiling what is hardware-independent, which for LinuxCNC is the documentation. That documentation is available online anyway.
347+
348+
If you happen to run into difficulties while compiling, check the LinuxCNC forum online.
349+
Currently emerging is the support for the DEB_BUILD_OPTIONS environment variable.
350+
Set it to
351+
352+
`nodocs`:: to skip the building of the documentation. This is yet mostly untested, the `-b` flag to dpkg-buildpackage has the same effect, albeit formally a different semantics.
353+
354+
`nocheck`:: to skip the self-tests of the LinuxCNC build process. This has no notable speed advantage but reduces the demand for a few software packages that may not be available for your system, i.e. the xvfb in particular. Do not set this unless running into difficulties with the dependencies.
355+
356+
An environment variable can be set together with the execution of the command, e.g.
357+
----
358+
DEB_BUILD_OPTIONS=nodocs,nocheck dpkg-buildpackage -uc -b
359+
----
360+
would combine all the options introduced in this section.
361+
362+
==== Installing self-built Debian packages
363+
364+
A Debian package can be recognised by its .deb extension. The tool installing it,
365+
`dpkg` is part of every Debian installation. The .deb files created by `dpkg-buildpacakge`
366+
are found in the directoy above the linuxcnc-source-dir, i.e. in `..`.
367+
To see what files are provided in a package, run
368+
369+
----
370+
dpkg -c ../linuxcnc-uspace*.deb
371+
----
372+
373+
The version of LinuxCNC will be part of the file name, which is meant to be matched by the asterisk.
374+
There may be too many files listed to fit on your screen.
375+
If you cannot scroll up in your terminal then add `| more` to that command to have its output passed through a so-called "pager".
376+
Quit with "q".
377+
378+
To install the packages, run
379+
380+
----
381+
sudo dpkg -i ../linuxcnc*.deb
382+
----
330383

331384
[[Setting-up-the-environment]]
332385
== Setting up the environment

0 commit comments

Comments
 (0)