Debian package source: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | Once a [[Debian upstream]] is ready, it is possible to make a source package from it. This is the role of the maintainer. | |
| 2 | 2 | ||
| 3 | 3 | ### Requesting help | |
| 4 | 4 | ||
| 5 | 5 | You can request that someone would make the source package with an RFP bug: <https://wiki.debian.org/RFP> | |
| 6 | 6 | ||
| 7 | 7 | It will be useful to the maintainer to know about the dependencies necessary to compile a Lazarus project: | |
| 8 | 8 | ||
| 9 | 9 | - `fpc, lcl, lazarus` for all projects | |
| 10 | 10 | - `libqt5pas-dev` if the project uses Qt5 | |
| 11 | 11 | ||
| 12 | 12 | Though in practice, it is likely that you will have to make the package source yourself. Debian provides a number of tools to build and test a source package, as well as documentation on the process (see Further reading below). | |
| 13 | 13 | ||
| 14 | 14 | ### debian directory | |
| 15 | 15 | ||
| 16 | 16 | If you will do the role of the maintainer, or if you would like to check required dependencies, you will need to add the `debian` folder (in lowercase). Here is the minimal structure: | |
| 17 | 17 | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 18 | + | ```text | |
| 19 | + | debian | |
| 20 | + | ├─ changelog # changes with previous version | |
| 21 | + | ├─ control # description of Debian packages | |
| 22 | + | ├─ copyright # copyright information of the source code | |
| 23 | + | ├─ rules # build script | |
| 24 | + | ├─ watch # file to check for latest version | |
| 25 | + | ├─ source | |
| 26 | + | │ └─ format # format of this package source | |
| 27 | + | └─ upstream | |
| 28 | + | └─ metadata # upstream repository information | |
| 29 | + | ``` | |
| 28 | 30 | ||
| 29 | 31 | #### changelog | |
| 30 | 32 | ||
| 31 | 33 | The first changelog of your program should be something like (spaces are important): | |
| 32 | 34 | ||
| 33 | - | ||
| 35 | + | ```text | |
| 36 | + | myproject (1.0-1) unstable; urgency=medium | |
| 34 | 37 | ||
| 35 | - | ||
| 38 | + | * Initial release. (Closes: #ITP_NUMBER) | |
| 36 | 39 | ||
| 37 | - | ||
| 40 | + | -- Firstname Lastname <email@server.com> Sun, 1 Nov 2020 15:01:00 +0100 | |
| 41 | + | ``` | |
| 38 | 42 | ||
| 39 | 43 | Of course you need to specify *myproject*, *ITP_NUMBER*, *Firstname*, *Lastname*, email and date. The version of the upstream program here is supposed to be 1.0 but it can be otherwise. The "-1" specifies the version of the package source as there a may be newer version of the package source but based on the same upstream version, in order to fix bugs for example. | |
| 40 | 44 | ||
| 41 | 45 | You may not have an ITP number yet, as it is a number you will get when you make the request for your package to be added to Debian. If you would like to be the maintainer, here is an example of e-mail to send. In this case the ITP number is 972503: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=972503> | |
| 42 | 46 | ||
| 43 | 47 | #### control | |
| 44 | 48 | ||
| 45 | 49 | This file gives all the information on the Debian packages, what is needed to build it, etc. This format is a bit different from the one found inside the [[Debian package structure|.deb files]]. | |
| 46 | 50 | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 51 | + | ```text | |
| 52 | + | Source: myproject | |
| 53 | + | Section: graphics | |
| 54 | + | Priority: optional | |
| 55 | + | Maintainer: Firstname Lastname <email@server.com> | |
| 56 | + | Build-Depends: fpc, lcl, lazarus, libqt5pas-dev, debhelper-compat (= 13) | |
| 57 | + | Rules-Requires-Root: no | |
| 58 | + | Standards-Version: 4.5.0 | |
| 59 | + | Homepage: https://mywebsite/myproject | |
| 60 | + | Vcs-Git: https://github.com/myorg/myproject.git | |
| 61 | + | Vcs-Browser: https://github.com/myorg/myproject | |
| 57 | 62 | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - | ||
| 63 | - | ||
| 63 | + | Package: myproject | |
| 64 | + | Architecture: any | |
| 65 | + | Depends: ${misc:Depends}, ${shlibs:Depends} | |
| 66 | + | Conflicts: myoldproject | |
| 67 | + | Description: Short description | |
| 68 | + | More details, blablabla | |
| 69 | + | ``` | |
| 64 | 70 | ||
| 65 | 71 | Here we suppose it is a graphics application using qt5 and with its repository on GitHub. If the project does not use qt5, you can remove the build-dependency `libqt5pas-dev`. | |
| 66 | 72 | ||
| 67 | 73 | Note that the empty line is important. It introduces one package and there can be multiple packages in one package source, for example one for each widgetset and one common package. | |
| 68 | 74 | ||
| 69 | 75 | #### copyright | |
| 70 | 76 | ||
| 71 | 77 | Basically a copyright file contains a reference to all copyrights in the source code, as well as a global copyright for the package and for the debian folder. If you include custom packages in your upstream (that are statically linked), you need to specify the copyright for them as well. The first part of the file looks like this: | |
| 72 | 78 | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - | ||
| 79 | + | ```text | |
| 80 | + | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | |
| 81 | + | Upstream-Name: mypackage | |
| 82 | + | Upstream-Contact: Firstname Lastname <email@server.com> | |
| 83 | + | Source: https://github.com/myorg/myproject | |
| 77 | 84 | ||
| 78 | - | ||
| 79 | - | ||
| 80 | - | ||
| 85 | + | Files: * | |
| 86 | + | Copyright: 2011-2020 Firstname Lastname <email@server.com> | |
| 87 | + | License: GPL-3+ | |
| 81 | 88 | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - | ||
| 89 | + | Files: debian/* | |
| 90 | + | Copyright: 2011-2020 Maintainer <email@server.com> | |
| 91 | + | License: GPL-3+ | |
| 85 | 92 | ||
| 86 | - | ||
| 87 | - | ||
| 88 | - | ||
| 93 | + | Files: custompackage1/* | |
| 94 | + | Copyright: 2012 Author <mail@server.com> | |
| 95 | + | License: LGPL-2+ | |
| 96 | + | ``` | |
| 89 | 97 | ||
| 90 | 98 | Then the file contains an empty line and the description of the licenses. Those descriptions are also separated by empty lines. | |
| 91 | 99 | ||
| 92 | 100 | Make sure you look for all mention of copyright in the source code (using grep or search in files). Even if the code is opensource, it is better to provide the full name of the person that created the files in the first place and the year. This can be needed for legal purposes as writing the copyright statement in a digital file counts as declaring the copyright. It is valid up to 70 years after the death of the copyright owner. This is based on the American legislation though other legislations may apply as well. For example, in French legislation, there is no need to declare a copyright, just being identified as the author is sufficient. | |
| 93 | 101 | ||
| 94 | 102 | File format documentation: <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/> | |
| 95 | 103 | ||
| 96 | 104 | Complete list of licenses: <https://spdx.org/licenses/> and <https://spdx.org/licenses/exceptions-index.html> | |
| 97 | 105 | ||
| 98 | 106 | ##### LGPL-2 | |
| 99 | 107 | ||
| 100 | 108 | This is the license for libraries that can be used with commercial projects. With Lazarus, you need to add the linking exception, but it is not part of the SPDX list, so I would add it in the license description (second paragraph). | |
| 101 | 109 | ||
| 102 | - | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - | ||
| 107 | - | ||
| 108 | - | ||
| 109 | - | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - | ||
| 120 | - | ||
| 121 | - | ||
| 122 | - | ||
| 123 | - | ||
| 124 | - | ||
| 125 | - | ||
| 126 | - | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - | ||
| 110 | + | ``` pascal | |
| 111 | + | License: LGPL-2 | |
| 112 | + | This program is free software; you can redistribute it and/or modify | |
| 113 | + | it under the terms of the GNU Lesser General Public License as published | |
| 114 | + | by the Free Software Foundation; version 2, with the following modification: | |
| 115 | + | . | |
| 116 | + | As a special exception, the copyright holders of this library give you | |
| 117 | + | permission to link this library with independent modules to produce an | |
| 118 | + | executable, regardless of the license terms of these independent modules, | |
| 119 | + | and to copy and distribute the resulting executable under terms of your choice, | |
| 120 | + | provided that you also meet, for each linked independent module, the terms | |
| 121 | + | and conditions of the license of that module. An independent module is a | |
| 122 | + | module which is not derived from or based on this library. If you modify this | |
| 123 | + | library, you may extend this exception to your version of the library, but | |
| 124 | + | you are not obligated to do so. If you do not wish to do so, delete this | |
| 125 | + | exception statement from your version. | |
| 126 | + | . | |
| 127 | + | This program is distributed in the hope that it will be useful, | |
| 128 | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 129 | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 130 | + | GNU Lesser General Public License for more details. | |
| 131 | + | . | |
| 132 | + | You should have received a copy of the GNU Lesser General Public License | |
| 133 | + | along with this program; if not, write to the Free Software Foundation, | |
| 134 | + | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 135 | + | . | |
| 136 | + | On Debian systems, the full text of the GNU Lesser General Public | |
| 137 | + | License version 2 can be found in the file | |
| 138 | + | '/usr/share/common-licenses/LGPL-2'. | |
| 139 | + | ``` | |
| 130 | 140 | ||
| 131 | 141 | ##### LGPL-2+ | |
| 132 | 142 | ||
| 133 | 143 | Same as above, but not limited to version 2. | |
| 134 | 144 | ||
| 135 | - | ||
| 136 | - | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - | ||
| 140 | - | ||
| 141 | - | ||
| 142 | - | ||
| 143 | - | ||
| 144 | - | ||
| 145 | - | ||
| 146 | - | ||
| 147 | - | ||
| 148 | - | ||
| 149 | - | ||
| 150 | - | ||
| 151 | - | ||
| 152 | - | ||
| 153 | - | ||
| 154 | - | ||
| 155 | - | ||
| 156 | - | ||
| 157 | - | ||
| 158 | - | ||
| 159 | - | ||
| 160 | - | ||
| 161 | - | ||
| 162 | - | ||
| 163 | - | ||
| 145 | + | ``` pascal | |
| 146 | + | License: LGPL-2+ | |
| 147 | + | This program is free software; you can redistribute it and/or modify | |
| 148 | + | it under the terms of the GNU Lesser General Public License as published | |
| 149 | + | by the Free Software Foundation; either version 2 of the License, or | |
| 150 | + | (at your option) any later version, with the following modification: | |
| 151 | + | . | |
| 152 | + | As a special exception, the copyright holders of this library give you | |
| 153 | + | permission to link this library with independent modules to produce an | |
| 154 | + | executable, regardless of the license terms of these independent modules, | |
| 155 | + | and to copy and distribute the resulting executable under terms of your choice, | |
| 156 | + | provided that you also meet, for each linked independent module, the terms | |
| 157 | + | and conditions of the license of that module. An independent module is a | |
| 158 | + | module which is not derived from or based on this library. If you modify this | |
| 159 | + | library, you may extend this exception to your version of the library, but | |
| 160 | + | you are not obligated to do so. If you do not wish to do so, delete this | |
| 161 | + | exception statement from your version. | |
| 162 | + | . | |
| 163 | + | This program is distributed in the hope that it will be useful, | |
| 164 | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 165 | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 166 | + | GNU Lesser General Public License for more details. | |
| 167 | + | . | |
| 168 | + | You should have received a copy of the GNU Lesser General Public License | |
| 169 | + | along with this program; if not, write to the Free Software Foundation, | |
| 170 | + | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 171 | + | . | |
| 172 | + | On Debian systems, the full text of the GNU Lesser General Public | |
| 173 | + | License version 2 can be found in the file | |
| 174 | + | '/usr/share/common-licenses/LGPL-2'. | |
| 175 | + | ``` | |
| 164 | 176 | ||
| 165 | 177 | ##### LGPL-3-linking-exception | |
| 166 | 178 | ||
| 167 | 179 | The version 3 has a specific name when there is the linking exception. | |
| 168 | 180 | ||
| 169 | - | ||
| 170 | - | ||
| 171 | - | ||
| 172 | - | ||
| 173 | - | ||
| 174 | - | ||
| 175 | - | ||
| 176 | - | ||
| 177 | - | ||
| 178 | - | ||
| 179 | - | ||
| 180 | - | ||
| 181 | - | ||
| 182 | - | ||
| 183 | - | ||
| 184 | - | ||
| 185 | - | ||
| 186 | - | ||
| 187 | - | ||
| 188 | - | ||
| 189 | - | ||
| 190 | - | ||
| 191 | - | ||
| 192 | - | ||
| 193 | - | ||
| 194 | - | ||
| 195 | - | ||
| 196 | - | ||
| 181 | + | ``` pascal | |
| 182 | + | License: LGPL-3-linking-exception | |
| 183 | + | This program is free software; you can redistribute it and/or modify | |
| 184 | + | it under the terms of the GNU Lesser General Public License as published | |
| 185 | + | by the Free Software Foundation; version 3, with the following modification: | |
| 186 | + | . | |
| 187 | + | As a special exception, the copyright holders of this library give you | |
| 188 | + | permission to link this library with independent modules to produce an | |
| 189 | + | executable, regardless of the license terms of these independent modules, | |
| 190 | + | and to copy and distribute the resulting executable under terms of your choice, | |
| 191 | + | provided that you also meet, for each linked independent module, the terms | |
| 192 | + | and conditions of the license of that module. An independent module is a | |
| 193 | + | module which is not derived from or based on this library. If you modify this | |
| 194 | + | library, you may extend this exception to your version of the library, but | |
| 195 | + | you are not obligated to do so. If you do not wish to do so, delete this | |
| 196 | + | exception statement from your version. | |
| 197 | + | . | |
| 198 | + | This program is distributed in the hope that it will be useful, | |
| 199 | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 200 | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 201 | + | GNU Lesser General Public License for more details. | |
| 202 | + | . | |
| 203 | + | You should have received a copy of the GNU Lesser General Public License | |
| 204 | + | along with this program; if not, write to the Free Software Foundation, | |
| 205 | + | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 206 | + | . | |
| 207 | + | On Debian systems, the full text of the GNU Lesser General Public | |
| 208 | + | License version 3 can be found in the file | |
| 209 | + | '/usr/share/common-licenses/LGPL-3'. | |
| 210 | + | ``` | |
| 197 | 211 | ||
| 198 | 212 | ##### GPL-3+ | |
| 199 | 213 | ||
| 200 | 214 | This is the recommended license when possible. | |
| 201 | 215 | ||
| 202 | - | ||
| 203 | - | ||
| 204 | - | ||
| 205 | - | ||
| 206 | - | ||
| 207 | - | ||
| 208 | - | ||
| 209 | - | ||
| 210 | - | ||
| 211 | - | ||
| 212 | - | ||
| 213 | - | ||
| 214 | - | ||
| 215 | - | ||
| 216 | - | ||
| 217 | - | ||
| 218 | - | ||
| 219 | - | ||
| 216 | + | ``` pascal | |
| 217 | + | License: GPL-3+ | |
| 218 | + | This program is free software; you can redistribute it and/or modify | |
| 219 | + | it under the terms of the GNU General Public License as published by | |
| 220 | + | the Free Software Foundation; either version 3 of the License, or | |
| 221 | + | (at your option) any later version. | |
| 222 | + | . | |
| 223 | + | This program is distributed in the hope that it will be useful, | |
| 224 | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 225 | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 226 | + | GNU General Public License for more details. | |
| 227 | + | . | |
| 228 | + | You should have received a copy of the GNU General Public License along | |
| 229 | + | with this program; if not, write to the Free Software Foundation, Inc., | |
| 230 | + | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 231 | + | . | |
| 232 | + | On Debian systems, the full text of the GNU General Public | |
| 233 | + | License version 3 can be found in the file | |
| 234 | + | '/usr/share/common-licenses/GPL-3'. | |
| 235 | + | ``` | |
| 220 | 236 | ||
| 221 | 237 | #### rules | |
| 222 | 238 | ||
| 223 | 239 | The `rules` file contains build instructions. If you are building a simple package, it will be the following: | |
| 224 | 240 | ||
| 225 | - | ||
| 241 | + | ```text | |
| 242 | + | #!/usr/bin/make -f | |
| 226 | 243 | ||
| 227 | - | ||
| 228 | - | ||
| 244 | + | # see FEATURE AREAS in dpkg-buildflags(1) | |
| 245 | + | export DEB_BUILD_MAINT_OPTIONS = hardening=+all | |
| 229 | 246 | ||
| 230 | - | ||
| 231 | - | ||
| 247 | + | %: | |
| 248 | + | dh $@ --no-parallel | |
| 249 | + | ``` | |
| 232 | 250 | ||
| 233 | 251 | The `--no-parallel` flag is needed to avoid potential problems with parallel builds. | |
| 234 | 252 | ||
| 235 | 253 | #### watch | |
| 236 | 254 | ||
| 237 | 255 | The `watch` file explains how to check for latest version. For example, on GitHub, that would be: | |
| 238 | 256 | ||
| 239 | - | ||
| 240 | - | ||
| 241 | - | ||
| 257 | + | ```text | |
| 258 | + | version=4 | |
| 259 | + | opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/myproject-$1\.tar\.gz/ \ | |
| 260 | + | https://github.com/myorg/myproject/tags .*/v?(\d\S+)\.tar\.gz | |
| 261 | + | ``` | |
| 242 | 262 | ||
| 243 | 263 | The version 4 is the for the file format, not your program. You need to change the *myorg* and *myproject* to your actual project. | |
| 244 | 264 | ||
| 245 | 265 | See documentation: <https://wiki.debian.org/debian/watch> | |
| 246 | 266 | ||
| 247 | 267 | #### source/format | |
| 248 | 268 | ||
| 249 | 269 | At the moment of this writing, it is: | |
| 250 | 270 | ||
| 251 | - | ||
| 271 | + | ```text | |
| 272 | + | 3.0 (quilt) | |
| 273 | + | ``` | |
| 252 | 274 | ||
| 253 | 275 | #### upstream/metadata | |
| 254 | 276 | ||
| 255 | 277 | For a project on GitHub, that would be: | |
| 256 | 278 | ||
| 257 | - | ||
| 258 | - | ||
| 259 | - | ||
| 260 | - | ||
| 279 | + | ```text | |
| 280 | + | Bug-Database: https://github.com/myorg/myproject/issues | |
| 281 | + | Bug-Submit: https://github.com/myorg/myproject/issues/new | |
| 282 | + | Repository: https://github.com/myorg/myproject.git | |
| 283 | + | Repository-Browse: https://github.com/myorg/myproject | |
| 284 | + | ``` | |
| 261 | 285 | ||
| 262 | 286 | You may need to change those path according to the tools you are using. | |
| 263 | 287 | ||
| 264 | 288 | ### Further reading | |
| 265 | 289 | ||
| 266 | 290 | - <https://wiki.debian.org/BuildingTutorial> | |
| 267 | 291 | - <https://www.debian.org/doc/manuals/maint-guide/first.en.html> | |
| 268 | 292 | - <https://lintian.debian.org/tags.html> and <https://lintian.debian.org/sources/fpc> | |
| 269 | 293 | ||
| 270 | 294 | --- | |
| 271 | 295 | *From the Free Pascal wiki, page "Debian package source", as it stood on 2022-01-22 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
