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 [2019/07/15 01:29] – [Downloading] Spelling memicinn19 | 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 an OpenWrt //source package// which | + | The term //OpenWrt package// may either refer to one of two things: |
| - | essentially is a directory consisting | + | |
| - | describing the acquisition, | + | |
| - | an optional supplemental directory with //OpenWrt package patches// which modify the | + | |
| - | acquired source code and optionally further, static supplemental files shipped along | + | |
| - | with the package, such as init script files, default configurations, | + | |
| - | support files. | + | |
| - | Furthermore, | ||
| - | which is a GNU tar compatible archive containing binary executable software artifacts | ||
| - | along with accompanying //package control files// for installation on a running system, | ||
| - | similar to Debian '' | ||
| - | SuSE etc. | ||
| - | OpenWrt //binary package// are almost exclusively produced from //source packages// | + | * an OpenWrt //source package// which essentially is a directory consisting of: |
| + | * an //OpenWrt package Makefile// describing the acquisition, | ||
| + | * a supplemental directory with //OpenWrt package patches// which modify the acquired source code (optional) | ||
| + | * 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 '' | ||
| + | |||
| + | OpenWrt //binary packages// are almost exclusively produced from //source packages// | ||
| by invoking either the //OpenWrt buildroot// or the //OpenWrt SDK// in order to translate | by invoking either the //OpenWrt buildroot// or the //OpenWrt SDK// in order to translate | ||
| the source package Makefile descriptions into executable binary artifacts tailored for | the source package Makefile descriptions into executable binary artifacts tailored for | ||
| a given target system. | a given target system. | ||
| - | Allthough | + | Although |
| //tar// and placing the appropriate control files in the correct directories, | //tar// and placing the appropriate control files in the correct directories, | ||
| strongly discouraged to do so since such binary packages are usually not easily | strongly discouraged to do so since such binary packages are usually not easily | ||
| - | reproducable | + | reproducible |
| Source packages are developed in multiple OpenWrt //package feeds// hosted in different | Source packages are developed in multiple OpenWrt //package feeds// hosted in different | ||
| Line 82: | 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 91: | Line 87: | ||
| * '' | * '' | ||
| - | It is adviced | + | It is recommended |
| === The src directory === | === The src directory === | ||
| Line 108: | 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 114: | Line 110: | ||
| * Do not ship man pages or documentation, | * Do not ship man pages or documentation, | ||
| * 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 | + | * 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 |
| - | * 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 131: | 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 < |
| or omit it entirely. | or omit it entirely. | ||
| Line 139: | 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 165: | 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 '' |
| - | end of the mirror list to have a canonical fallback location in case a new version has not yet propagated to all mirrors and to convey | + | 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 179: | Line 178: | ||
| ==== Building ==== | ==== Building ==== | ||
| - | The build recipes in a source package should adhere to the OpenWrt defaults as much as possible, | + | The build recipes in a source package should adhere to the OpenWrt defaults as much as possible. This ensures that source package declarations remain compact and free of copy-pasted boilerplate |
| - | this ensures that source package declarations remain compact and free of copy-pasted boilerplate | + | |
| code. | code. | ||
| Line 205: | 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 253: | 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 277: | 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 298: | Line 296: | ||
| changed APIs, removed functionality and so on. | changed APIs, removed functionality and so on. | ||
| - | While the package dependency mechanisms will ensure that the build system compiles | + | While the package dependency mechanisms will ensure that the build system compiles |
| packages before the program packages requiring them, they do not guarantee that such programs | packages before the program packages requiring them, they do not guarantee that such programs | ||
| are getting rebuilt when the library package itself is updated. | are getting rebuilt when the library package itself is updated. | ||
| Line 325: | 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 342: | Line 340: | ||
| Example: when '' | Example: when '' | ||
| changed from '' | changed from '' | ||
| - | from '' | + | from '' |
| '' | '' | ||
| on '' | on '' | ||
| Line 348: | 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 407: | 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' | ||