2015-12-05 14:52:09 +01:00
|
|
|
/**
|
2015-11-17 15:19:55 +01:00
|
|
|
* @defgroup pkg Packages
|
|
|
|
* @{
|
|
|
|
* @brief External libraries and applications
|
2021-04-20 14:57:11 +02:00
|
|
|
* @details What are packages? RIOT packages:
|
|
|
|
* * pull a specific tested version most often from the (a) origin source
|
|
|
|
* * patch them to match the RIOT architecture
|
|
|
|
* * provide a specific tested configuration
|
|
|
|
* (such configuration may enable or disable features)
|
|
|
|
* * integrate the packages build process into the RIOT one
|
|
|
|
* * they have RIOT tests and/or examples to test/build them
|
2015-11-17 15:19:55 +01:00
|
|
|
*
|
|
|
|
* Using packages
|
|
|
|
* ==============
|
|
|
|
* To add a package to the list of compiled modules you have to add it to the
|
2022-01-19 10:15:52 +01:00
|
|
|
* `USEPKG` macro in your application's Makefile:
|
2015-11-17 15:19:55 +01:00
|
|
|
*
|
|
|
|
* ~~~~~~~~ {.mk}
|
|
|
|
* USEPKG += <pkg_name>
|
|
|
|
* ~~~~~~~~
|
|
|
|
*
|
2020-06-29 11:57:22 +02:00
|
|
|
* When the package can be built out-of-source, the source code of external
|
|
|
|
* packages is fetched in a global location in:
|
|
|
|
*
|
|
|
|
* ~~~~~~~~ {.mk}
|
2023-05-16 22:16:43 +02:00
|
|
|
* $(PKGDIRBASE)/$(PKG_NAME)
|
2020-06-29 11:57:22 +02:00
|
|
|
* ~~~~~~~~
|
|
|
|
*
|
2020-06-23 19:17:25 +02:00
|
|
|
* When out-of-source build is not possible (for example because the package
|
2020-06-29 11:57:22 +02:00
|
|
|
* build system doesn't allow it), the source code is fetched in the build
|
|
|
|
* directory of the application under:
|
|
|
|
*
|
|
|
|
* ~~~~~~~~ {.mk}
|
|
|
|
* $(BINDIR)/pkg/$(PKG_NAME)
|
|
|
|
* ~~~~~~~~
|
|
|
|
*
|
|
|
|
* In this case, the source and the build directory are the same (currently,
|
2021-10-05 11:26:52 +02:00
|
|
|
* this only applies to the micropython package).
|
2020-06-23 19:17:25 +02:00
|
|
|
*
|
2015-11-17 15:19:55 +01:00
|
|
|
* Porting an external library
|
|
|
|
* ===========================
|
|
|
|
* Structure of a package
|
|
|
|
* ----------------------
|
|
|
|
* This module provides porting information for libraries and applications to use
|
|
|
|
* with RIOT (to build an external module). If you'd like to add a package to RIOT
|
|
|
|
* you need to add a directory with the name of your package to this directory.
|
2018-09-19 20:08:06 +02:00
|
|
|
* This directory should contain at least one file:
|
2015-11-17 15:19:55 +01:00
|
|
|
*
|
|
|
|
* * **Makefile**: A Makefile describing how to get the upstream application,
|
|
|
|
* apply the patch and how to build the package as a RIOT module.
|
|
|
|
* A rough template for several methods of acquiring a package is provided in
|
2019-10-28 21:24:58 +01:00
|
|
|
* `pkg/Makefile.git` and `pkg/Makefile.http`.
|
2015-11-17 15:19:55 +01:00
|
|
|
*
|
2022-01-19 10:15:52 +01:00
|
|
|
* If your port or the package provide header files, you need to update the
|
|
|
|
* `INCLUDES` variable in the package's `Makefile.include`:
|
|
|
|
*
|
|
|
|
* ~~~~~~~~ {.mk}
|
|
|
|
* INCLUDES += -I$(RIOTPKG)/<pkg_name>/include # headers provided by the port
|
|
|
|
* INCLUDES += -I$(PKGDIRBASE)/<pkg_name> # headers provided by the package
|
|
|
|
* ~~~~~~~~
|
|
|
|
*
|
2018-09-19 20:08:06 +02:00
|
|
|
* Patch files can be included in a `patches` directory in the package dir.
|
|
|
|
* These are applied to the upstream package to make it build with RIOT.
|
|
|
|
*
|
2015-11-17 15:19:55 +01:00
|
|
|
* Creating a patch with git
|
|
|
|
* -------------------------
|
|
|
|
* Assuming your upstream library resides in a git repository, you can create the
|
|
|
|
* patch files as follows:
|
|
|
|
* * checkout the targeted version of the upstream application
|
|
|
|
* * create a new branch (e.g. `riot-port`)
|
|
|
|
* * conduct necessary changes (e.g. edit, add, or remove some files)
|
|
|
|
* * commit your changes using `git commit`
|
|
|
|
* * create the patch files using `git format-patch -n riot-port`
|
2018-09-19 20:08:06 +02:00
|
|
|
* * move the resulting patch files to the patches directory of your package.
|
2022-02-01 20:37:24 +01:00
|
|
|
*
|
|
|
|
* Packages outside of RIOTPKG
|
|
|
|
* ---------------------------
|
|
|
|
* It can be beneficial to create packages outside of the RIOT tree. For example
|
|
|
|
* if one is working on new packages that aren't ready to be committed to
|
|
|
|
* upstream or if an application needs its own unique packages. For this, one
|
|
|
|
* can use the `EXTERNAL_PKG_DIRS` make variable. It works similar to the way
|
|
|
|
* [external modules](src/creating-modules.html#modules-outside-of-riotbase) are
|
|
|
|
* handled. In your application's Makefile, in addition to adding the package
|
|
|
|
* name to `USEPKG` as shown above, add the path to a folder that contains your
|
|
|
|
* external packages:
|
|
|
|
*
|
|
|
|
* ~~~~~~~~ {.mk}
|
|
|
|
* EXTERNAL_PKG_DIRS += <PATH_TO_FOLDER_CONTAINING_PACKAGES>
|
|
|
|
* ~~~~~~~~
|
|
|
|
*
|
|
|
|
* The path is allowed to be relative to the application's directory.
|
|
|
|
*
|
|
|
|
* ***NOTE:*** The name of an external package must be unique (both in regard to
|
|
|
|
* other external packages, as well to native RIOT packages). Additionally, the
|
|
|
|
* directory containing the packages must match the package name, e.g. package
|
|
|
|
* `foo`must be located in `<PATH_IN_EXTERNAL_PKG_DIRS>/foo`.
|
|
|
|
*
|
|
|
|
* An example can be found in
|
2023-05-13 18:55:47 +02:00
|
|
|
* [`tests/build_system/external_pkg_dirs`](https://github.com/RIOT-OS/RIOT/tree/master/tests/build_system/external_pkg_dirs)
|
2022-02-01 20:37:24 +01:00
|
|
|
*
|
|
|
|
* RIOT welcomes new and useful packages. If you'd like to share your work,
|
|
|
|
* consider [contributing](https://github.com/RIOT-OS/RIOT/tree/master/CONTRIBUTING.md).
|
|
|
|
*
|
2015-11-17 15:19:55 +01:00
|
|
|
* @}
|
2015-12-05 14:52:09 +01:00
|
|
|
*/
|