Adding a Package

This page describes how to create and build a LibreELEC package and assumes that a build environment has been prepared.

tar has been selected to illustrate the process.

To illustrate the process, the package is built for the RPi2 LibreELEC project. Build commands are therefore prepended with:

PROJECT=RPi2 ARCH=arm

The template below is a good starting point. Copy it to LibreELEC.tv/packages/ELECtronLibre/tar/package.mk.

PKG_NAME=""
PKG_VERSION=""
#PKG_ARCH="any"
PKG_LICENSE=""
PKG_SITE=""
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain"
PKG_SHORTDESC=""
#PKG_AUTORECONF="yes"

PKG_CONFIGURE_OPTS_TARGET="--help"

Use information from the tar site to fill-in the template. Refer to package.mk for a detailed description of the variables.

PKG_NAME="tar"
PKG_VERSION="1.29"
#PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_SITE="http://savannah.gnu.org/projects/tar/"
PKG_URL="http://ftp.gnu.org/gnu/tar/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_SHORTDESC="tar is an archiver program"
#PKG_AUTORECONF="yes"

PKG_CONFIGURE_OPTS_TARGET="--help"

Build the package to determine configuration parameters:

PROJECT=RPi2 ARCH=ARM scripts/build tar

This first builds the toolchain, which takes quite a long time, and then yields:

...
`configure' configures GNU tar 1.29 to adapt to many kinds of systems.

Usage: /home/awiouy/LibreELEC.tv/build.LibreELEC-RPi2.arm-8.0-devel/tar-1.29/configure [[OPTION]]... [[VAR=VALUE]]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [[disabled]]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [[configure|dir or `..']]

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [[/usr/local]]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [[PREFIX]]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [[EPREFIX/bin]]
  --sbindir=DIR           system admin executables [[EPREFIX/sbin]]
  --libexecdir=DIR        program executables [[EPREFIX/libexec]]
  --sysconfdir=DIR        read-only single-machine data [[PREFIX/etc]]
  --sharedstatedir=DIR    modifiable architecture-independent data [[PREFIX/com]]
  --localstatedir=DIR     modifiable single-machine data [[PREFIX/var]]
  --libdir=DIR            object code libraries [[EPREFIX/lib]]
  --includedir=DIR        C header files [[PREFIX/include]]
  --oldincludedir=DIR     C header files for non-gcc [[/usr/include]]
  --datarootdir=DIR       read-only arch.-independent data root [[PREFIX/share]]
  --datadir=DIR           read-only architecture-independent data [[DATAROOTDIR]]
  --infodir=DIR           info documentation [[DATAROOTDIR/info]]
  --localedir=DIR         locale-dependent data [[DATAROOTDIR/locale]]
  --mandir=DIR            man documentation [[DATAROOTDIR/man]]
  --docdir=DIR            documentation root [[DATAROOTDIR/doc/tar]]
  --htmldir=DIR           html documentation [[DOCDIR]]
  --dvidir=DIR            dvi documentation [[DOCDIR]]
  --pdfdir=DIR            pdf documentation [[DOCDIR]]
  --psdir=DIR             ps documentation [[DOCDIR]]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

System types:
  --build=BUILD     configure for building on BUILD [[guessed]]
  --host=HOST       cross-compile to build programs to run on HOST [[BUILD]]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[[=ARG]]  include FEATURE [[ARG=yes]]
  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --disable-silent-rules  verbose build output (undo: "make V=0")
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-dependency-tracking
                          speeds up one-time build
  --disable-largefile     omit support for large files
  --disable-acl           do not support ACLs
  --enable-gcc-warnings   turn on many GCC warnings (for developers; best with
                          GNU make)
  --disable-rpath         do not hardcode runtime library paths
  --disable-nls           do not use Native Language Support
  --enable-backup-scripts Create and install backup and restore scripts

Optional Packages:
  --with-PACKAGE[[=ARG]]    use PACKAGE [[ARG=yes]]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --without-posix-acls    do not use POSIX.1e access control lists
  --without-included-regex
                          don't compile regex; this is the default on systems
                          with recent-enough versions of the GNU C Library
                          (use with caution on other systems).
  --without-selinux       do not use SELinux, even on systems with SELinux
  --with-packager         String identifying the packager of this software
  --with-packager-version Packager-specific version information
  --with-packager-bug-reports
                          Packager info for bug reports (URL/e-mail/...)
  --with-rmt=FILE         Use FILE as the default `rmt' program. Do not build
                          included copy of `rmt'.
  --without-xattrs        don't use linux extended attributes
  --with-compress=PROG    use PROG as compress compressor program
  --with-gzip=PROG        use PROG as gzip compressor program
  --with-bzip2=PROG       use PROG as bzip2 compressor program
  --with-lzip=PROG        use PROG as lzip compressor program
  --with-lzma=PROG        use PROG as lzma compressor program
  --with-lzop=PROG        use PROG as lzop compressor program
  --with-xz=PROG          use PROG as xz compressor program
  --with-gnu-ld           assume the C compiler uses GNU ld [[default=no]]
  --with-libiconv-prefix[[=DIR]]  search for libiconv in DIR/include and DIR/lib
  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
  --with-libintl-prefix[[=DIR]]  search for libintl in DIR/include and DIR/lib
  --without-libintl-prefix     don't search for libintl in includedir and libdir

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  YACC        The `Yet Another Compiler Compiler' implementation to use.
              Defaults to the first program found out of: `bison -y', `byacc',
              `yacc'.
  YFLAGS      The list of arguments that will be passed by default to $YACC.
              This script will default YFLAGS to the empty string to avoid a
              default value of `-d' given by some make applications.
  CPP         C preprocessor
  DEFAULT_RMT_DIR
              Define full file name of the directory where to install `rmt'.
              (default: $(libexecdir))
  RSH         Configure absolute path to default remote shell binary
  DEFAULT_ARCHIVE_FORMAT
              Set the default archive format. Allowed values are: V7, OLDGNU,
              USTAR, POSIX, GNU. Default is GNU
  DEFAULT_ARCHIVE
              Set the name of the default archive (default: -)
  DEFAULT_BLOCKING
              Define default blocking factor (default: 20)
  DEFAULT_QUOTING_STYLE
              Set the default quoting style. Allowed values are: literal,
              shell, shell-always, c, escape, locale, clocale . Default is
              "escape".

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <bug-tar@gnu.org>.
GNU tar home page: <http://www.gnu.org/software/tar/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.

Update the PKG_CONFIGURE_OPTS_TARGET variable for corresponding effect, for example:

  • tar should not interfere with tar shipped with LibreELEC (–program-prefix='gnu-')
  • tar should be self-contained (–enable-static –disable-shared, not documented in the previous section)
PKG_NAME="tar"
PKG_VERSION="1.29"
#PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_SITE="http://savannah.gnu.org/projects/tar/"
PKG_URL="http://ftp.gnu.org/gnu/tar/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_SHORTDESC="tar is an archiver program"
#PKG_AUTORECONF="yes"

PKG_CONFIGURE_OPTS_TARGET="--program-prefix='gnu-' \
                           --enable-static --disable-shared"

Build the package:

PROJECT=RPi2 ARCH=ARM scripts/build tar

Include the Package in a Custom Build

Wrap the Package in an Addon

Work in progress

Submit the Package to LibreELEC