Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-developer:package-policies [2020/03/04 17:40] – [OpenWrt packages] adamkpickering | docs:guide-developer:package-policies [2021/10/15 08:32] (current) – ↷ Links adapted because of a move operation bobafetthotmail | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| Almost all pieces of software found in a typical OpenWrt firmware image are | Almost all pieces of software found in a typical OpenWrt firmware image are | ||
| - | provided by such a package with notable exception being the Linux kernel itself. | + | provided by such a package with a notable exception being the Linux kernel itself. |
| The term //OpenWrt package// may either refer to one of two things: | The term //OpenWrt package// may either refer to one of two things: | ||
| Line 10: | Line 10: | ||
| * an OpenWrt //source package// which essentially is a directory consisting of: | * an OpenWrt //source package// which essentially is a directory consisting of: | ||
| - | * an //OpenWrt package Makefile// describing the acquisition, | + | * an //OpenWrt package Makefile// describing the acquisition, |
| - | * an optional | + | * a supplemental directory with //OpenWrt package patches// which modify the acquired source code (optional) |
| - | * optionally further, | + | * other static files that go with the package, such as init script files, default configurations, |
| * an OpenWrt //binary package//, which is a GNU tar compatible archive containing binary executable software artifacts and the accompanying //package control files// for installation on a running system, similar to the '' | * an OpenWrt //binary package//, which is a GNU tar compatible archive containing binary executable software artifacts and the accompanying //package control files// for installation on a running system, similar to the '' | ||
| Line 78: | Line 78: | ||
| Patch files must be in //unified diff// format and carry the extension '' | Patch files must be in //unified diff// format and carry the extension '' | ||
| The file names must also carry a numerical prefix to denote the order in which the patch | The file names must also carry a numerical prefix to denote the order in which the patch | ||
| - | files must be applied. Patch file names should be short and concise and avoid special | + | files must be applied. |
| - | characters such as white spaces, special | + | Patch file names should be concise and avoid characters |
| Suitable patch file names could look like: | Suitable patch file names could look like: | ||
| Line 87: | Line 87: | ||
| * '' | * '' | ||
| - | It is recommended to use [[docs: | + | It is recommended to use [[docs: |
| === The src directory === | === The src directory === | ||
| Line 104: | Line 104: | ||
| ==== Feature Considerations ==== | ==== Feature Considerations ==== | ||
| - | Many OpenWrt supported devices still have only a few megabytes of flash and ram available which makes it important to shrink the packages as much as possible. Opt for the lowest common denominator whenever possible. | + | Many OpenWrt supported devices still have only a few megabytes of flash and RAM available which makes it important to shrink the packages as much as possible. Opt for the lowest common denominator whenever possible. |
| Some general considerations when packaging a new piece of software are: | Some general considerations when packaging a new piece of software are: | ||
| Line 111: | Line 111: | ||
| * Minimize external dependencies - try to avoid optional external dependencies whenever possible. An extreme example is '' | * Minimize external dependencies - try to avoid optional external dependencies whenever possible. An extreme example is '' | ||
| * Modularize packages - if the software you're packaging supports and uses plugins then put those plugins into separate binary package declarations instead of lumping them all together along with the main program. This way you can externalize dependencies and move them into the plugin packages instead of having them in the main component, which makes the package usable on a wider range of targets because users can omit parts with large dependencies. | * Modularize packages - if the software you're packaging supports and uses plugins then put those plugins into separate binary package declarations instead of lumping them all together along with the main program. This way you can externalize dependencies and move them into the plugin packages instead of having them in the main component, which makes the package usable on a wider range of targets because users can omit parts with large dependencies. | ||
| - | * Try to rely on standard facilities - instead of requiring extra programs to implement tasks like user context switching, use the '' | + | * Try to rely on standard facilities - instead of requiring extra programs to implement tasks like user context switching, use the '' |
| Often it is tempting to add various '' | Often it is tempting to add various '' | ||
| Line 127: | Line 127: | ||
| Since contributors likely do not have a formal contract with OpenWrt to develop packages, they cannot disclaim their own copyrights and assign them to the project. | Since contributors likely do not have a formal contract with OpenWrt to develop packages, they cannot disclaim their own copyrights and assign them to the project. | ||
| - | When adding new packages please don't simply copy the statement from another package but add either your own in the form: | + | When adding new packages, please don't simply copy the statement from another package but add either your own in the form: |
| # Copyright (C) 2016 Joe Random < | # Copyright (C) 2016 Joe Random < | ||
| Line 135: | Line 135: | ||
| ==== Versioning ==== | ==== Versioning ==== | ||
| - | There are a number of Makefile variables influencing the visible version of the resulting packages. When packaging upstream release tarballs, the '' | + | There are a number of Makefile variables influencing the visible version of the resulting packages. When packaging upstream release tarballs, the '' |
| + | For example, if the '' | ||
| - | When there are no upstream release tarballs available or when software is packaged straight from a source code repository, the '' | + | When there are no upstream release tarballs available or when software is packaged straight from a source code repository, the '' |
| + | For example, if the '' | ||
| The build system will combine these variables into a common version identifier and truncate the revision identifier if needed. Given the values in the example, the resulting version identifier will be '' | The build system will combine these variables into a common version identifier and truncate the revision identifier if needed. Given the values in the example, the resulting version identifier will be '' | ||
| Line 161: | Line 163: | ||
| === Mirror Sites === | === Mirror Sites === | ||
| - | The use of mirror sites for tarball download locations is encouraged and helps to reduce the traffic load on upstream project sites. When choosing mirrors for a package, please try to ensure that: | + | The use of mirror sites for tarball download locations is encouraged and helps to reduce the traffic load on upstream project sites. When choosing mirrors for a package, please try to ensure that the mirror is: |
| - | * The mirror is officially endorsed by the upstream project (e.g. mentioned on their download page) | + | * officially endorsed by the upstream project (E.G. mentioned on their download page). |
| - | * Is well reachable by people from a wide range of different locations | + | * well reachable by people from a wide range of different locations. |
| - | * Is using proper SSL certificates when operating | + | * using proper SSL certificates when using HTTPS. |
| - | * Is hosting the most current version of the software in question. | + | * hosting the most current version of the software in question. |
| - | Multiple mirrors can be specified in a package Makefile by assigning a white-space separated list of URLs to the '' | + | Multiple mirrors can be specified in a package Makefile by assigning a white-space separated list of URLs to the '' |
| + | It is a good convention to assign the upstream project site itself to the end of the mirror list. | ||
| + | This provides | ||
| Try to limit the amount of mirror sites to 3 to 5 different locations, including the main download site. | Try to limit the amount of mirror sites to 3 to 5 different locations, including the main download site. | ||
| Line 199: | Line 203: | ||
| In some cases it is possible to arrange things before e.g. the | In some cases it is possible to arrange things before e.g. the | ||
| '' | '' | ||
| - | or echo values into stampfiles. In such cases it is permissible to | + | or echo values into stampfiles. In such cases, it is permissible to |
| redefine the recipe in order to achieve the desired result. Use the | redefine the recipe in order to achieve the desired result. Use the | ||
| default implementations of the macros to call the original behaviour | default implementations of the macros to call the original behaviour | ||
| Line 247: | Line 251: | ||
| Due to the complex nature of the GNU autoconf/ | Due to the complex nature of the GNU autoconf/ | ||
| - | * Never patch the generated / shipped '' | + | * Never patch the generated / shipped '' |
| * Make '' | * Make '' | ||
| * Pre-seed '' | * Pre-seed '' | ||
| - | * Never trust shipped '' | + | * Never trust shipped '' |
| ===== Dependencies ===== | ===== Dependencies ===== | ||
| Line 271: | Line 275: | ||
| dynamic runtime requirements. | dynamic runtime requirements. | ||
| - | //Runtime dependencies// | + | //Runtime dependencies// |
| instructing the package manager to fetch and install the listed dependencies before installing | instructing the package manager to fetch and install the listed dependencies before installing | ||
| the binary package itself. A //runtime dependency// | the binary package itself. A //runtime dependency// | ||
| Line 319: | Line 323: | ||
| ==== ABI Version ==== | ==== ABI Version ==== | ||
| - | Setting an '' | + | Setting an '' |
| to track the value of this variable and trigger recompilations in all packages depending on | to track the value of this variable and trigger recompilations in all packages depending on | ||
| this library package whenever the value is incremented. This is useful to force re-linking of | this library package whenever the value is incremented. This is useful to force re-linking of | ||
| Line 336: | Line 340: | ||
| Example: when '' | Example: when '' | ||
| changed from '' | changed from '' | ||
| - | from '' | + | from '' |
| '' | '' | ||
| on '' | on '' | ||
| Line 342: | Line 346: | ||
| When a shared library is packaged, the '' | When a shared library is packaged, the '' | ||
| '' | '' | ||
| - | contained within the binary package. The '' | + | contained within the binary package. The '' |
| '' | '' | ||
| - | within the library, | + | within the library, |
| symbols. | symbols. | ||
| Line 401: | Line 405: | ||
| ==== Development Files ==== | ==== Development Files ==== | ||
| - | Source packages defining binary packages | + | Source packages defining binary packages |
| - | recipe | + | recipe |
| A typical '' | A typical '' | ||
| header files and, in case they' | header files and, in case they' | ||