-
Notifications
You must be signed in to change notification settings - Fork 5
add a package
in order to add a new package to nenuzhnix you will need to create 3 files: control
, rules
and source
(technically the last one is optional if there is no external sources, but generally almost every package needs it)
- create a directory on the top level of this repo (the name of the directory is the name of the package)
- create
opkg
directory inside your package directory - create
control
,rules
andsource
files in theopkg
directory according to the guidelines bellow:
control
is a text file that describes your package. it is a key-value database with the following fields:
- Architecture:
- Depends: (optional)
- Description:
- Maintainer:
- Package:
- Provides: (optional)
- Version:
remember:
- try to keep it lowercase: avoid unnecessary capitalization in any names, descriptions and texts seen by the user
source
is a text file that describes the source of your package. it is similar design to control
file and has the following fields:
- Filename: (optional, default:
${PKG}-${VER}.tar.gz
) - MD5:
- Repo:
remember:
- for package source prefer
tar.gz
format (if not available, usetar.xz
, if not available, usetar.bz2
) - replace as much as possible with variables
${PKG}
,${VER}
,${BASEVER}
,${SUFFIX}
to the point where it gets ridiculous (bonus point if you can find${PKG}
inMD5
)
rules
is a build script for your package. it should be executable and have shebang as it's first line. it should accept build
, install
or clean
as it's first argument and fail in case anything else is used as argument.
remember:
- prefer using
#!/bin/sh -e
as shebang for this script, keep the script POSIX shell compatible
rules: build
- save your patches with
.patch
extension inopkg
directory and apply withpatch -p1
- disable rpath
- only build dynamic (shared) libraries and executables if possible, disable static build
- if multiple configure systems are available for a package, prefer
cmake
ormeson
if it doesn't hurt required feature set - if multiple build systems are available for a package, prefer
ninja
(useninjahelper
wrapper) - if using
autotools
, always executeautoreconf -f -i
before./configure
rules: install
- check that you were following filesystem guidelines when building the package
- make sure that all binaries to be included in a package are stripped and do not have debug information
- if using
autotools
, remove.la
files generated bylibtool
rules: clean
- use your build system's
clean
target if available (doesn't make much sense, but just do it)
rules skeleton (replace pkgname and use actual build, install and clean commands):
#!/bin/sh -e
PACKAGE=pkgname
case "$1" in
build)
# patch
# configure
# make
;;
install)
rm -rf /tmp/$PACKAGE
mkdir -p /tmp/$PACKAGE
export DESTDIR=/tmp/$PACKAGE
# make install
;;
clean)
# make clean
;;
*)
echo unknown argument $1
exit 1
;;
esac