update CONTRIBUTING.md

Added basic version of contributor's checklist of things to pay
attention for when submitting a pull request.
This commit is contained in:
Leonid Pliushch 2021-12-26 17:37:53 +02:00
parent d6b41e1806
commit f3ce15f951
No known key found for this signature in database
GPG Key ID: 45F2964132545795
1 changed files with 112 additions and 0 deletions

View File

@ -155,6 +155,118 @@ Do not send disruptive changes, like without reason reverting commits or
deleting files, creating spam content, etc. Authors of such pull requests may
be blocked from contributing to [Termux](https://github.com/termux) project.
### Submitting new packages: checklist
Besides [packaging policy](#packaging-policy), there is a number of typical
mistakes that could be made when submittung a pull request with new package.
Pay attention to things listed below.
1. **Versioning: format**
Package versions must begin with a number and should not contain special
characters except `.` (dot), `-` (minus), `+` (plus). Under certain cases
the colon symbol (`:`) is allowed - for specifying epoch.
Examples of valid version specification: `1.0`, `20201001`, `10a`.
2. **Versioning: if using specific Git commit**
`TERMUX_PKG_VERSION` must contain a commit date in case if you are using
specific Git commit. Date format should be `YYYY.MM.DD` or `YYYYMMDD`.
Never use Git hash, branch name or something else that can break version
tracking in package manager!
3. **Source URL**
Source URL must be deterministic and guarantee that it always pointing
on content matching version specified in `TERMUX_PKG_VERSION` and
checksum in `TERMUX_PKG_SHA256`. In very rare cases we could make
exception, but don't expect that it will apply to your pull request.
Don't hardcode version in source code URL. Reference it through variable
`${TERMUX_PKG_VERSION}` and remember that Bash supports slicing and
other ways to manipulate content referenced through variables.
4. **Dependencies: build tools**
Don't specify common build tools in package dependencies. This includes
packages like `autoconf`, `automake`, `bison`, `clang`, `ndk-sysroot`
and many others.
5. **Dependencies: build & run time**
`TERMUX_PKG_DEPENDS` should contain only dependencies required during
package run time.
All dependencies that are used only during build time, for example
static libraries, should be specified in `TERMUX_PKG_BUILD_DEPENDS`.
6. **Patches: format**
Patches are standard diff output generated by GNU diff or Git. Please
avoid editing patches by hand, especially if you don't understand
format internals.
Patch is typically created by
```
diff -uNr sourcedir sourcedir.mod > filename.patch
```
7. **Patches: hardcoded path references**
Software often relies on paths defined by Filesystem Hierarchy Standard:
* `/bin`
* `/etc`
* `/home`
* `/run`
* `/sbin`
* `/tmp`
* `/usr`
* `/var`
These paths do not exist in Termux and have been replaced by prefixed
equivalents. Termux installation prefix is
```
/data/data/com.termux/files/usr
```
and can be considered as virtual rootfs.
Home directory is stored outside of prefix:
```
/data/data/com.termux/files/home
```
Don't hardcode home and prefix, use shortcuts `@TERMUX_HOME@` and
`@TERMUX_PREFIX@` respectively. Patch files are preprocessed before
being applied.
Directories `/run` and `/sbin` should be replaced by
`@TERMUX_PREFIX@/var/run` and `@TERMUX_PREFIX@/bin` respectively.
8. **Build configuration: compiler flags**
You should not touch `CFLAGS`, `CXXFLAGS`, `CPPFLAGS` or `LDFLAGS`
variables unless this is necessary to make build working.
9. **Build configuration: autotools**
The `build-package.sh` does pretty much work to properly configure
package builds using GNU Autotools. Therefore you do not need to
specify flags like
* `--prefix`
* `--host`
* `--build`
* `--disable-nls`
* `--disable-rpath`
and some others.
Additional options to `./configure` can be passed through variable
`TERMUX_PKG_EXTRA_CONFIGURE_ARGS`.
***
# Working with packages