2020-04-28 01:37:34 +02:00
# Contributing
2020-06-19 17:06:28 +02:00
Termux is an open source application and it is built on users' contributions.
However, most of work is done by Termux maintainers on their spare time and
therefore only priority tasks are being completed.
2020-04-28 01:37:34 +02:00
2020-06-19 17:20:59 +02:00
Developer's wiki is available at https://github.com/termux/termux-packages/wiki.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
## How you can contribute to Termux project
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
- **Reporting issues**
2020-06-19 17:06:28 +02:00
2021-07-31 17:36:43 +02:00
If you have found issue, let the community know about it.
2020-06-19 17:06:28 +02:00
2021-07-31 17:36:43 +02:00
Please be prepared that issue may not be resolved immediately. We will ignore
statements like "solve it quickly", "urgently need solution" and so on. Be
patient.
2020-04-28 01:37:34 +02:00
2021-10-09 13:55:21 +02:00
Avoid digging and commenting in old, already closed issues. Read them carefully
\- likely they already give solution. If it didn't worked, only then open a new
one. Note that we will lock down issues that are really outdated.
2021-07-31 17:36:43 +02:00
You may report only issues happening within our official packages. Do not
submit issues happening in third-party software - we will ignore them.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
Bugs reports for legacy Termux installations (Android 5.x / 6.x) are not
accepted. We already dropped support for these Android OS versions.
2020-06-19 17:06:28 +02:00
2021-07-31 17:36:43 +02:00
- **Examining existing packages for potential issues**
2020-06-19 17:06:28 +02:00
2021-07-31 17:36:43 +02:00
There could be undiscovered bugs in packages. For example: unspecified
dependencies, unprefixed hardcoded FHS paths, crashes, etc.
2020-10-01 13:02:46 +02:00
2021-07-31 17:36:43 +02:00
If you can't submit a pull request with patches fixing the problem, you can
open new [issue ](https://github.com/termux/termux-packages/issues/new/choose ).
2020-10-01 13:02:46 +02:00
2021-07-31 17:36:43 +02:00
- **Fixing known bugs**
2020-10-01 13:02:46 +02:00
2021-07-31 17:36:43 +02:00
Take a look at https://github.com/termux/termux-packages/issues. There many
issue tickets having tag `bug report` or `help wanted` . They all are waiting
to be resolved.
2020-10-01 13:02:46 +02:00
2021-07-31 17:36:43 +02:00
- **Submitting new packages**
2020-12-30 13:26:47 +01:00
2021-07-31 17:36:43 +02:00
There are lots of unresolved [package requests ](https://github.com/termux/termux-packages/issues?q=is%3Aissue+is%3Aopen+label%3A%22package+request%22 ).
Pay attention to tickets having tag `help wanted` .
2020-10-01 13:02:46 +02:00
2021-07-31 17:36:43 +02:00
- **Keeping existing packages up-to-date**
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
Packages do not update themselves on their own. Someone needs to update build
script and patches. Usually they are handled by maintainers but things are
often outdated.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
See [Updating packages ](#updating-packages ) for details.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
- **Hosting a package repository mirror**
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
Termux generates lots of traffic. Mirrors help to reduce load on primary
server, provide better download speeds and eliminate single point of failure.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
- **Donate**
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
See https://github.com/termux/termux-packages/wiki/Donate for details.
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
## Requesting new package
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
If you are looking for specific package and didn't find it included in our
repositories, you can request it.
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
Open a new [issue ](https://github.com/termux/termux-packages/issues/new/choose )
filling the `package request` template. You will need to provide at least
package description and its home page and URL to source repository. Remember
that your request will not be processed immediately.
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
Requested package must comply with our [packaging policy ](#packaging-policy ).
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
## Packaging policy
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
There are already more than 1000 packages added to Termux repositories. All
of them needs to be maintained, kept up-to-date. Unlike the major distributions,
our developers team is small and we also limited on server disk space.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
In order to provide service at reasonable quality, requested packages should
met these conditions:
- **Packages must be active, well-known projects**
Software available in major Linux distributions has more chances to be
included into Termux repositories. We will not accept outdated, dead projects
as well as projects which do not have active community.
- **Packages must be licensed under widely recognized open source license**
Software should be licensed under Apache, BSD, GNU GPL, MIT or other well
known open source license. Software which is open source but is distributed
under non-free conditions is processed on individual basis.
Software which is either closed-source, contain binary-only components or
is distributed under End User License Agreement is not accepted.
- **Not installable through cpan, gem, npm, or pip**
These packages should be installable through `cpan` , `gem` , `npm` , `pip` and
so on.
Packaging modules for Perl, Ruby, Node.js, Python is problematic, especially
2021-08-01 15:06:00 +02:00
when it comes to cross-compiling native extensions.
- **Not taking too much disk space**
The size of resulting package should be less than 100 MiB.
Since software is being compiled for 4 CPU architectures (aarch64, arm,
i686, x86_64), effective disk usage is 4 times bigger than size of single
.deb file. We are limited on disk space and prefer many small packages
over one big.
Exceptions are made on individual basis and only for packages providing
important functionality.
2021-07-31 17:36:43 +02:00
- **Not serving duplicated functionality**
Please avoid submitting packages which duplicate functionality of already
present ones.
The more useless packages in repositories, the less overall packaging and
service quality - *remembering that our resources are limited?*
- **Not serving hacking, phishing, spamming, spying, ddos functionality**
We do not accept packages which serve solely destructive or privacy violation
purposes, including but not limited to pentesting, phishing, bruteforce,
sms/call bombing, DDoS attaks, OSINT.
## Submitting pull requests
Contributors take the all responsibility for their submissions. Maintainers may
provide some help with fixing your pull request or give some recommendations,
but that DOES NOT mean they will do all work instead of you.
**Minimal requirements:**
- Experience with Linux distribution like Debian (preferred), Arch, Fedora, etc.
- Experience with compiling software from source.
- Good shell scripting skills.
- You have read https://github.com/termux/termux-packages/wiki.
If you never used Linux distribution or Termux was your first experience with
Linux environment, we strongly recommending to NOT send pull requests since
we will reject low quality work.
Do not forget about [packaging policy ](#packaging-policy ) when submitting a
new package, as your pull request will be closed without merge.
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.
***
# Working with packages
All software available in Termux repositories aims to be compatible with Android
OS and is built by Android NDK. This often introduces compatibility issues as
Android (specifically Termux) is not a standard platform. Do not expect there
are exist package recipes available out-of-box.
## Basics
Each package is a defined through the `build.sh` script placed into directory
`./packages/<name>/` where `<name>` is the actual name of package in lower case.
File `build.sh` is a shell (Bash) script that defines some properties like
dependencies, description, home page through environment variables. Sometimes
it also used to override default packaging steps defined in our build system.
Here is example of `build.sh` :
```.sh
TERMUX_PKG_HOMEPAGE=https://example.com
TERMUX_PKG_DESCRIPTION="Termux package"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@github"
2020-06-19 16:07:13 +02:00
TERMUX_PKG_VERSION=1.0
2021-07-31 17:36:43 +02:00
TERMUX_PKG_SRCURL=https://example.com/sources-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=0000000000000000000000000000000000000000000000000000000000000000
TERMUX_PKG_DEPENDS="libiconv, ncurses"
2020-04-28 01:37:34 +02:00
```
2021-07-31 17:36:43 +02:00
It can contain some additional variables:
- `TERMUX_PKG_BUILD_IN_SRC=true`
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
Use this variable if package supports in-tree builds only, for example if
package uses raw Makefile instead of build system like CMake.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
- `TERMUX_PKG_PLATFORM_INDEPENDENT=true`
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
This variable specifies that package is platform-independent and can run
on any device regardless of CPU architecture.
2020-06-19 16:07:13 +02:00
2021-07-31 17:36:43 +02:00
`TERMUX_PKG_LICENSE` should specify the license using SPDX license identifier
or can contain values "custom" or "non-free". Multiple licenses should be
separated by commas.
2020-04-28 01:37:34 +02:00
2021-07-31 17:36:43 +02:00
`TERMUX_PKG_SRCURL` should contain URL only for the official source bundle.
Use of forks is allowed only under a good reason.
More about `build.sh` variables you can read on [developer's wiki ](https://github.com/termux/termux-packages/wiki/Creating-new-package#table-of-available-package-control-fields ).
## Updating packages
[![asciicast ](https://asciinema.org/a/gVwMqf1bGbqrXmuILvxozy3IG.svg )](https://asciinema.org/a/gVwMqf1bGbqrXmuILvxozy3IG?autoplay=1& speed=2.0)
You can check which packages are out-of-date by visiting Termux page on
[Repology ](https://repology.org/projects/?inrepo=termux&outdated=1 ).
2020-06-19 16:27:05 +02:00
2021-10-05 22:53:47 +02:00
### General package update procedure
Usually to update packages you need to just modify few variables and commit
the changes.
1. Assign the new version value to `TERMUX_PKG_VERSION` . Be careful to not
remove the epoch (numbered prefix, e.g `1:` , `2:` ) accidentally.
2. If there is `TERMUX_PKG_REVISION` variable set, remove it. Revision
should be set only for subsequent package builds within the same version.
3. Download the source code archive and compute SHA-256 checksum:
```
cd ./packages/${YOUR_PACKAGE}
(source build.sh 2>/dev/null; curl -LO "$TERMUX_PKG_SRCURL")
```
4. Assign the new checksum value to `TERMUX_PKG_SHA256` .
2021-07-31 17:36:43 +02:00
### Dealing with patch errors
2020-06-19 16:27:05 +02:00
2020-06-19 17:06:28 +02:00
Major changes introduced to packages often make current patches incompatible
with newer package version. Unfortunately, there no universal guide about
fixing patch issues as workaround is always based on changes introduced to
the new source code version.
2020-06-19 16:27:05 +02:00
Here are few things you may to try:
2020-06-19 17:06:28 +02:00
1. If patch fixing particular known upstream issue, check the project's VCS
for commits fixing the issue. There is a chance that patch is no longer
needed.
2020-06-19 16:27:05 +02:00
2020-06-19 17:06:28 +02:00
2. Inspecting the failed patch file and manually applying changes to source
code. Do so only if you understand the source code and changes introduced
by patch.
2020-06-19 16:27:05 +02:00
Regenerate patch file, e.g. with:
```
diff -uNr package-1.0 package-1.0.mod > previously-failed-patch-file.patch
```
2020-06-19 17:06:28 +02:00
Always check the CI (Github Actions) status for your pull request. If it fails,
then either fix or close it. Maintainers can fix it on their own, if issues are
minor. But they won't rewrite whole your submission.
2021-07-31 17:36:43 +02:00
## Rebuilding package with no version change
Changes to patch files and build configuration options will imply package
rebuild. In order to make package recognized as update, a build number should
be set. This is done through defining variable `TERMUX_PKG_REVISION` or
incrementing its value if already set.
`TERMUX_PKG_REVISION` should be set exactly below `TERMUX_PKG_VERSION` :
```.sh
TERMUX_PKG_VERSION=1.0
TERMUX_PKG_REVISION=4
```
If package version has been updated, `TERMUX_PKG_REVISION` should be removed.
## Downgrading the package or changing versioning scheme
If package needs to be downgraded or for versioning scheme needs to be changed,
you need to set or increment package epoch. This is needed to tell package
manager force recognize new version as package update.
Epoch should be specified in same variable as version (`TERMUX_PKG_VERSION`),
but its value will take different format (`{EPOCH}:{VERSION}`):
```.sh
TERMUX_PKG_VERSION=1:5.0.0
```
Note that if you are not @termux collaborator, pull request must contain a
*description* why you are submitting a package downgrade. All pull requests
which submit package downgrading without any serious reason will be rejected.
## Common build issues
```
No files in package. Maybe you need to run autoreconf -fi before configuring?
```
Means that build system cannot find the Makefile. Depending on project, there
are some tips for trying:
- Set `TERMUX_PKG_BUILD_IN_SRC=true` - applicable to Makefile-only projects.
- Run `./autogen.sh` or `autoreconf -fi` in `termux_step_pre_configure` . This
is applicable to projects that use Autotools.
```
No LICENSE file was installed for ...
```
This error happens when build system cannot find license file and it should be
specified manually through `TERMUX_PKG_LICENSE_FILE` .