5 kx
5 kx # [Build System](https://radix.pro/build-system/)
5 kx
5 kx **Build System** is a set of Makefiles and utilities organized within one directory which is mounted
5 kx into the source tree of the developed product.
5 kx
5 kx > The main purpose of the **Build System** is automating all stages of software solution development,
5 kx > from arrangement of source code from third-party developers usage to publication of own deliverable
5 kx > distributive.
5 kx
5 kx The fundamental principle of **Build System** is described in the
5 kx [Build System Internals](https://radix.pro/build-system/internals/#fundamental_principle) section and
5 kx in the [doc/PRINCIPLE*](doc/PRINCIPLE.md) files of this repository.
5 kx
5 kx
5 kx ## Table of contents
5 kx
5 kx * [Quick start](#user-content-quick-start)
5 kx * [Documentation](#user-content-documentation)
5 kx * [Community](#user-content-community)
5 kx * [Creators](#user-content-creators)
5 kx
5 kx
5 kx ## Quick start
5 kx
5 kx All steps described below are considered in the [Build System in Practice](https://radix.pro/build-system/practice/)
5 kx section on the main [Radix.pro](https://radix.pro) site. To create first package using
5 kx [Build System](https://radix.pro/build-system/) we have to perform following steps:
5 kx
5 kx * [Install CCACHE](#user-content-install-ccache)
5 kx * [Getting Toolchains](#user-content-getting-toolchains)
5 kx * [Create a First Package](#user-content-first-package)
5 kx
5 kx
5 kx ### Install CCACHE
5 kx
5 kx To speed up the building process we strongly recommend to set up **CCACHE**(**1**) utility. Almost all **Linux**
5 kx distributions have this utility by default.
5 kx
5 kx We described **CCACHE** setup process in the [Build System Overview](https://radix.pro/build-system/overview/#ccache)
5 kx section and here we have to notice that the directory */opt/extra/ccache* is a default place of the **CCACHE** data.
5 kx If you want to use another directory for **CCACHE** data then you have to change the value of **CACHED_CC_OUTPUT**
5 kx variable in the [constants.mk](constants.mk) file. Of course all developers should to have permissions to access
5 kx this directory.
5 kx
5 kx Before start the first build process you have to create **CCACHE** data directory on behalf of superuser:
5 kx
5 kx ```Bash
5 kx $ sudo mkdir -p /opt/extra/ccache
5 kx $ sudo chown -R developer:developers /opt/extra
5 kx ```
5 kx
5 kx Where **developers** - is a name your developers group and **developer** - is a name of some user who is
5 kx a member of **developers** group.
5 kx
5 kx
5 kx ### Getting Toolchains
5 kx
5 kx First of all we have to create toolchains directory on the developer machine. The default path to toolchains
5 kx is defined by **TOOLCHAINS_BASE_PATH** variable in the [constants.mk](constants.mk) file. The access permissions
5 kx should be given to developers by the superuser:
5 kx
5 kx ```Bash
5 kx $ sudo mkdir -p /opt/toolchain
5 kx $ sudo chown -R developer:developers /opt/toolchain
5 kx ```
5 kx
5 kx In principle no additional actions from the user is not required. The fact is that if before the start
5 kx of assembly the first package the required toolchain will not be found in the appropriate directory then
5 kx the **build system will** start downloading the needed toolchain from **FTP**-server and at the end of the
5 kx downloading the **build system** unpacks the toolchain to the */opt/toolchain* directory.
5 kx
5 kx Also the toolchains installation can be done manualy. To do this you have to perform a set of commands
5 kx like following:
5 kx
5 kx ```Bash
5 kx $ cd /opt/toolchain
5 kx $ wget ftp://ftp.radix.pro/toolchains/x86_64/1.7.0/arm-RK328X-linux-glibc-1.7.0.tar.gz
5 kx $ tar xzf arm-RK328X-linux-glibc-1.7.0.tar.gz
5 kx ```
5 kx
5 kx for each needed toolchain.
5 kx
5 kx
5 kx ### First Package
5 kx
5 kx Consider the work of the **build system** on the simplest example which despite its simplicity allow us
5 kx to explore all of main stages of creating distributable packages.
5 kx
5 kx Let us create a project directory:
5 kx
5 kx ```Bash
5 kx $ mkdir project
5 kx $ cd project
5 kx ```
5 kx
5 kx Clone the **build system** repository:
5 kx
5 kx ```Bash
5 kx $ git clone https://github.com/radix-platform/build-system.git
5 kx ```
5 kx
5 kx At this stage we do not want to create a new package from scratch and consider a complete package from
6 kx [Radix cross Linux](https://csvn.radix.pro/radix/system/) repository. Let it be **pkgtools**. The **pkgtools** -
5 kx is a base package which does not require the downloading any sources as they already present in the
6 kx **build system**. In addition, **pkgtools** does not depend on any packages in the system and we
5 kx already have all needed tools presented on the developer's machine.
5 kx
5 kx So, to obtain the necessary files we have to check out */base* directory from repository:
5 kx
5 kx ```Bash
6 kx $ svn co svn://svn.radix.pro/radix/system/trunk/base base
5 kx ```
5 kx
5 kx Let's change current directory to *base/pkgtool*:
5 kx
5 kx ```Bash
5 kx $ cd base/pkgtool
5 kx ```
5 kx
5 kx and create our first package:
5 kx
5 kx
5 kx ```Bash
5 kx $ HARDWARE=ffrk3288 make
5 kx ```
5 kx
5 kx At the end of build process the **build system** displays a message indicating that the **pkgtool** package
5 kx has been successfully installed into *dist/rootfs/rk328x-glibc/ffrk3288* directory which created especially
5 kx as the working image of the target root file system:
5 kx
5 kx ```
5 kx Package creation complete.
5 kx
5 kx #######
5 kx ####### Install packages into 'dist/rootfs/rk328x-glibc/ffrk3288/...' file system...
5 kx #######
5 kx
5 kx Installing package pkgtool...
5 kx |======================================================================|
5 kx
5 kx pkgtool 1.1.0 (Package Tools)
5 kx
5 kx This is a set of scripts used for package creation, install, etc.
5 kx
5 kx
5 kx
5 kx
5 kx
5 kx
5 kx
5 kx
5 kx Uncompressed Size: 168K
5 kx Compressed Sise: 24K
5 kx |======================================================================|
5 kx
5 kx make[2]: Leaving directory `project/base/pkgtool'
5 kx make[1]: Leaving directory `project/base/pkgtool'
5 kx $
5 kx ```
5 kx
5 kx This process considered in more details in the [Build System in Practice](https://radix.pro/build-system/practice/#first_package)
5 kx section at the main [Radix.pro](https://radix.pro/) site.
5 kx
5 kx
5 kx ## Documentation
5 kx
5 kx **Build System**'s documentation is present on the main [Radix.pro](https://radix.pro) site
5 kx in the [Build System](https://radix.pro/build-system) section.
5 kx
5 kx
5 kx ## Community
5 kx
5 kx Get updates on **Build System**'s development and chat with the project maintainers and community members.
5 kx
5 kx * Read and subscribe to [The Official Radix.pro Blog](https://radix.pro/blog/).
5 kx * Follow [Radix cross Linux on VKontakte](https://vk.com/rclinux).
5 kx
5 kx
5 kx ## Versioning
5 kx
5 kx For transparency into our release cycle and in striving to maintain backward compatibility,
5 kx **Build System** is maintained under [the Semantic Versioning guidelines](http://semver.org/)
5 kx excluding additional labels such as pre-release suffixes.
5 kx
5 kx See [the Versioning section](https://radix.pro/build-system/overview/#versioning) on the main
5 kx [Radix.pro](https://radix.pro) site.
5 kx
5 kx Release announcement posts will be available on [the Official Radix.pro Blog](https://radix.pro/blog/) and
5 kx on the [Community](#user-content-community) sites.
5 kx
5 kx
5 kx ## Copyright and license
5 kx
5 kx Code and documentation copyright 2009-2023 Andrey V. Kosteltsev.
5 kx Code and documentation released under [the **Radix.pro** License](LICENSE).