Skip to content
Twisted Pair in my Hair edited this page Aug 29, 2019 · 13 revisions

instructions for maintainers

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)

  1. create a directory on the top level of this repo (the name of the directory is the name of the package)
  2. create opkg directory inside your package directory
  3. create control, rules and source files in the opkg directory according to the guidelines bellow:

control

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

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, use tar.xz, if not available, use tar.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} in MD5)

rules

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 in opkg directory and apply with patch -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 or meson if it doesn't hurt required feature set
  • if multiple build systems are available for a package, prefer ninja (use ninjahelper wrapper)
  • if using autotools, always execute autoreconf -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 by libtool

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
Clone this wiki locally