Build System

Manulix, the 100% free installable LiveCD based on Linux kernel, uClibc standard C library, and GNU tools (GNU/uClibc/Linux distribution)

Packages

  • source packages (srcpkg)
  • binary packages (binpkg)

Binary packages are built to be extracted in the root directory.

Package Names

The name of binary package must follow this style:

${1}-v${2}[-${3}][-${4}][-${5}]-${6}-${7}.binpkg.${8}

The name of source package must follow this style:

${1}-v${2}[-${3}][-${4}].srcpkg.${8}
${1}
package title (gcc, binutils, libelf, etc.); note that package title must not include hyphen sign ("-"); so 'module-init-tools' is invalid title, 'module_init_tools' is
${2}
package version, must contain the preceeding 'v' character, the version number, and optionally: (dot) patch level number (dot) patch sublevel number
[ ${3} ] (optional)
additional version info
[ ${4} ] (optional)
vcs-specific version info
[ ${5} ] (optional)
build configuration (STATIC, DEBUG, etc.), only capital letters here
${6}
target architecture
${7}
target Std C Lib name
${8}
archive suffix (for example, .tar.bz2)

Scripts

Build system related scripts are:

Package-specific files

Description

[ pkginfo ] (optional)
text describing the package
srcinfo (required)
how to get the source, and where it will be obtained from
[ patchcmds ] (optional)
shell commands (executed by patch_raw_srcpkg.sh) for patching "raw" source
[ config ] (optional)
configuration file, required for some packages like kernel and uclibc
buildcmds (required)
shell commands (executed by srcpkg_to_binpkg.sh) which do actual building: configuring, compiling, linking, and installing (into "${INSTALL_PATH}", for further post-processing and packaging)
[ postcmds ] (optional)
shell commands (executed by srcpkg_to_binpkg.sh) to perform some additional tasks after build is finished
[ ppfiles ] (optional)
directory for some files which may be needed on 'patch' and 'post' stages (patch files, libraries from previous builds, etc.)

Note: srcpkg_to_binpkg.sh 2.0.0 and above cd-s to "${BUILD_FARM}/${PKG_MODE}/${BUILD_DIR}", so there's no need to put that cd on top of each buildcmds:

cd "${BUILD_FARM}/${PKG_MODE}/${BUILD_DIR}"
# Note: 'source /dev/null' fails (it is not a POSIX shell feature), but '. /dev/null' works
. "${PKGBS_DIR}"/buildcmds-"${1}"
cd "${PKGBS_DIR}"

Examples

pkginfo-wget

a non-interactive commandline tool for retrieving files using HTTP, 
HTTPS and FTP, the most widely-used Internet protocols

srcinfo-uclibc

git git://uclibc.org/uClibc.git

srcinfo-sstrip

http http://dev.gentoo.org/~solar/misc/sstrip-mjn3.c

patchcmds-autoconf

prev_wd=`pwd`
cd "${BUILD_FARM}"/autoconf-git
git_desc_version=`git describe 2>/dev/null | sed 's|/|-|'`
[ -z "${git_desc_version}" ] && git_desc_version=`git describe --tags 2>/dev/null`
[ -z "${git_desc_version}" ] && git_desc_version=`git describe --always 2>/dev/null`

cd "${BUILD_FARM}/${SRCPKG_DIR}"
sed -i "s/if test -n \"\$v\"/v=\"${git_desc_version}\"\nif test -n \"\$v\"/" ./build-aux/git-version-gen
cd "${prev_wd}"

config-uclibc

It is here.

buildcmds-git

builddir_path=`pwd`
python_is_present="yes"
which python >/dev/null 2>&1 || type python >/dev/null 2>&1 || python_is_present=""
if [ -z ${python_is_present} ]; then
  python3_bin=`which python3 2>/dev/null`
  [ -z "${python3_bin}" ] && python3_bin=`type python3 2>/dev/null | tr ' ' '\n' | grep '/' | tail -1 | sed 's/(//g' | sed 's/)//g'`
  if [ -z "${python3_bin}" ]; then
    echo "ERROR: 'python' not found. Abort."
    exit 1
  else
    cd `dirname "${python3_bin}"`
    ln -s python3 python
  fi
fi
cd "${builddir_path}"

if [ ! -f ./configure ]; then
  echo "autoreconf -vi"
  autoreconf -vi 2>&1 | sed 's/autoreconf: //' | grep -e "installing:" -e "running:"
fi

./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \
--build=${ARCH_NAME}-${VENDOR_NAME}-linux-${LIBC_NAME} \
--host=${ARCH_NAME}-${VENDOR_NAME}-linux-${LIBC_NAME} \
--with-openssl --without-curl --without-iconv --without-tcltk
if [ $? -eq 0 ]; then
  make
  if [ $? -eq 0 ]; then
    INSTALL_PATH=`pwd`/"${INSTALL_DIR}"
    mkdir "${INSTALL_DIR}" && make -s install DESTDIR="${INSTALL_PATH}"
  else
    echo "ERROR: 'make' error. Abort."
    exit 1
  fi
else
  echo "ERROR: './configure' error. Abort."
  exit 1
fi

if [ -z ${python_is_present} ]; then
  rm -f `dirname "${python3_bin}"`/python
fi

postcmds-gcc

if [ -d "${INSTALL_PATH}"/usr ]
then
  prev_wd=`pwd`
  cd "${INSTALL_PATH}"/usr/bin
  ln -s gcc cc

  if [ -d "${PKGBS_DIR}"/ppfiles-gcc-4.5.0 ]; then
    cd "${INSTALL_PATH}"/usr/lib
    cp "${PKGBS_DIR}"/ppfiles-gcc-4.5.0/libgcc_s.so.1 ./
    ln -s libgcc_s.so.1 libgcc_s.so
  fi

  cd "${prev_wd}"
fi

postcmds-ncurses

if [ -d "${INSTALL_PATH}"/usr/share/man/man3 ]; then
  rm -rf "${INSTALL_PATH}"/usr/share/man/man3
fi

ppfiles-gcc

$ ls -l PPFILES/ppfiles-gcc
total 4
-rw-rw-r-- 1 root root 443 2010-11-05 12:28 boehm-gc_uclibc_gc.h.patch

How to build 'srcpkg'

  1. Place srcpkg tarball into your build farm directory (usually ${HOME}/build-farm/). Example: cp ./PACKAGES/srcpkg/libelf-0.8.13-1.srcpkg.tar.bz2 ./
  2. Extract it. Example: tar xjfv ./libelf-0.8.13-1.srcpkg.tar.bz2
  3. Execute srcpkg_to_binpkg.sh script. Example: BUILD-SCRIPTS/srcpkg_to_binpkg.sh libelf
build directory: libelf-0.8.13-1.builddir
-------------------- building --------------------
creating cache ./config.cache
checking whether make sets ${MAKE}... yes
checking for gcc... gcc
....

That's all!

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.