source: rtems-docs/rsb/source-builder.rst @ e52906b

5
Last change on this file since e52906b was e52906b, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:06

Simplify SPDX-License-Identifier comment

  • Property mode set to 100644
File size: 8.9 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2012, 2016 Chris Johns <chrisj@rtems.org>
4
5RTEMS Source Builder
6====================
7
8The RTEMS Source Builder or RSB is a tool to build packages from source. It is
9used by the RTEMS project to build it's compilers and OS. The RSB helps
10consolidate the details you need to build a package from source in a controlled
11and verifiable way. The tool is aimed at developers of software who use tool
12sets for embedded development. The RSB is not limited to building tools just
13for RTEMS, you can build bare metal development environments.
14
15Embedded development typically uses cross-compiling tool chains, debuggers, and
16debugging aids. Together we call these a **tool set**. The RTEMS Source Builder
17is designed to fit this specific niche but is not limited to it. The RSB can be
18used outside of the RTEMS project and we welcome this.
19
20The RTEMS Source Builder is typically used to build a set of tools or a **build
21set**. A **build set** is a collection of packages and a package is a specific
22tool, for example gcc or gdb, or library. The RTEMS Source Builder attempts to
23support any host environment that runs Python and you can build the package
24on. The RSB is not some sort of magic that can take any piece of source code
25and make it build. Someone at some point in time has figured out how to build
26that package from source and taught this tool.
27
28The RTEMS Source Builder has been tested on:
29
30- ArchLinux
31- CentOS
32- Fedora
33- Raspbian
34- Ubuntu (includes XUbuntu)
35- Linux Mint
36- openSUSE
37- FreeBSD
38- NetBSD
39- MacOS
40- Windows
41
42.. topic:: Setting up your Host
43
44   :ref:`Hosts` details setting up hosts.
45
46The RTEMS Source Builder has two types of configuration data. The first is the
47*build set*. A *build set* describes a collection of packages that define a set
48of tools you would use when developing software for RTEMS. For example the
49basic GNU tool set is binutils, gcc, and gdb and is the typical base suite of
50tools you need for an embedded cross-development type project. The second type
51of configuration data is the configuration files and they define how a package
52is built. Configuration files are scripts loosely based on the RPM spec file
53format and they detail the steps needed to build a package. The steps are
54*preparation*, *building*, and *installing*. Scripts support macros, shell
55expansion, logic, includes plus many more features useful when build packages.
56
57The RTEMS Source Builder does not interact with any host package management
58systems. There is no automatic dependence checking between various packages you
59build or packages and software your host system you may have installed. We
60assume the build sets and configuration files you are using have been created
61by developers who do. Support is provided for package config or ``pkgconfg``
62type files so you can check and use standard libraries if present. If you have
63a problem please ask on our :r:list:`devel`.
64
65.. comment: TBD: The section "Installing and Tar Files" does not exist.
66
67This documentation caters for a range of users from new to experienced RTEMS
68developers who want to understand the RTEMS Source Builder. New users
69who just want to build tools should follow the Quick Start section in
70the User's Guide.  Users building a binary tool set for release can
71read the "Installing and Tar Files". Users wanting to run and test
72bleeding edge tools or packages, or wanting update or extend the RSB's
73configuration can read the remaining sections.
74
75.. topic:: Bug Reporting
76
77   If you think you have found a problem please see :ref:`Bugs, Crashes, and
78   Build Failures`.
79
80Why Build from Source?
81----------------------
82
83The RTEMS Source Builder is not a replacement for the binary install systems
84you have with commercial operating systems or open source operating system
85distributions. Those products and distributions are critically important and
86are the base that allows the RSB to work. The RTEMS Source Builder sits
87somewhere between you manually entering the commands to build a tool set and a
88tool such as ``yum`` or ``apt-get`` to install binary packages made
89specifically for your host operating system. Building manually or installing a
90binary package from a remote repository are valid and real alternatives. The
91RSB provides the specific service of repeatably being able to build tool sets
92from source code. The process leaves you with the source code used to build
93the tools and the ability to rebuilt it.
94
95If you are developing a system or product that has a long shelf life or is used
96in a critical piece of infrastructure that has a long life cycle being able to
97build from source is important. It insulates the project from the fast ever
98changing world of the host development machines. If your tool set is binary and
99you have lost the ability to build it you have lost a degree of control and
100flexibility open source gives you. Fast moving host environments are
101fantastic. We have powerful multi-core computers with huge amounts of memory
102and state of the art operating systems to run on them however the product or
103project you are part of may need to be maintained well past the life time of
104these host. Being able to build from source an important and critical part of
105this process because you can move to a newer host and create an equivalent tool
106set.
107
108Building from source provides you with control over the configuration of the
109package you are building. If all or the most important dependent parts are
110built from source you limit the exposure to host variations. For example the
111GNU C compiler (gcc) currently uses a number of 3rd party libraries internally
112(gmp, mpfr, etc). If your validated compiler generating code for your target
113processor is dynamically linked against the host's version of these libraries
114any change in the host's configuration may effect you. The changes the host's
115package management system makes may be perfectly reasonable in relation to the
116distribution being managed however this may not extend to you and your
117tools. Building your tools from source and controlling the specific version of
118these dependent parts means you are not exposing yourself to unexpected and
119often difficult to resolve problems. On the other side you need to make sure
120your tools build and work with newer versions of the host operating
121system. Given the stability of standards based libraries like ``libc`` and ever
122improving support for standard header file locations this task is becoming
123easier.
124
125The RTEMS Source Builder is designed to be audited and incorporated into a
126project's verification and validation process. If your project is developing
127critical applications that needs to be traced from source to executable code in
128the target, you need to also consider the tools and how to track them.
129
130If your IT department maintains all your computers and you do not have suitable
131rights to install binary packages, building from source lets you create your
132own tool set that you install under your home directory. Avoiding installing
133any extra packages as a super user is always helpful in maintaining a secure
134computing environment.
135
136History
137-------
138
139The RTEMS Source Builder is a stand alone tool based on another tool called the
140*SpecBuilder* written by Chris Johns. The *SpecBuilder* was written around 2010
141for the RTEMS project to provide Chris with a way to build tools on hosts that
142did not support RPMs. At the time the RTEMS tools maintainer only supported
143*spec* files and these files held all the vital configuration data needed to
144create suitable tool sets. The available SRPM and *spec* files by themselves
145where of little use because a suitable ``rpm`` tool was needed to use them. At
146the time the available versions of ``rpm`` for a number of non-RPM hosts were
147broken and randomly maintained. The solution Chris settled on was to use the
148*spec* files and to write a Python based tool that parsed the *spec* file
149format creating a shell script that could be run to build the package. The
150approach proved successful and Chris was able to track the RPM version of the
151RTEMS tools on a non-RPM host for a number of years.
152
153The *SpecBuilder* tool did not build tools or packages unrelated to the RTEMS
154Project where no suitable *spec* file was available so another tool was
155needed. Rather than start again Chris decided to take the parsing code for the
156*spec* file format and build a new tool called the RTEMS Source Builder.
157
158Controlling the Tools Build
159---------------------------
160
161Build sets can be controlled via the command line to enable and disable various
162features. There is no definitive list of build options that can be listed
163because they are implemented with the configuration scripts. The best way to
164find what is available is to grep the configuration files. for ``with`` and
165``without``.
166
167Following are currently available:
168
169``--without-rtems``
170  Do not build RTEMS when building an RTEMS build set.
171
172``--without-cxx``
173  Do not build a C++ compiler.
174
175``--with-ada``
176  Attempt to build an Ada compiler.  You need a native GNAT installed.
177
178``--with-fortran``
179  Attempt to build a Fortran compiler.
180
181``--with-objc``
182  Attempt to build a C++ compiler.
183
184
Note: See TracBrowser for help on using the repository browser.