Building Debian packages

From NetXMS Wiki
Jump to: navigation, search

Required packages and libraries

Install required packages and libraries:

apt-get install debootstrap devscripts git debhelper dh-autoreconf debconf libssl-dev zlib1g-dev libexpat1-dev libsensors4-dev libjansson-dev libreadline-dev libsqlite3-dev libmysqlclient-dev libcurl4-openssl-dev libpq-dev libldap2-dev libaio1 unixodbc-dev openjdk-7-jdk maven

Next you need the Oracle Instant Client from:

Agree to the license and get the download link after signing in.

After download, run:

sudo unzip -x -d /opt instantclient-basiclite-linux*
sudo unzip -x -d /opt instantclient-sdk-linux*
sudo ln -s /opt/instantclient_11_2/

Building packages

mkdir ./nxms-packaging && true;
mkdir ./nxms-packages && true;
cd ./nxms-packaging;
if [ -e .git ]; then
  git pull;
  git clone --branch develop ./;

After this modify the debian change-log to ensure you have a different version with every build (so your apt repo and servers installing the packages can differentiate newer versions).
You can do this for example like this:

dch -v `date +%Y%m%d%H%M`-1

After changelog is modified, run:

./configure --with-dist;
make dist;
make distclean;
git checkout debian/changelog;
mkdir deb_packages && true;
mv netxms-*.tar.gz ./deb_packages;
cd ./deb_packages;
rename s/netxms-/netxms_/ netxms-*.tar.gz;
rename s/.tar.gz/.orig.tar.gz/ netxms_*.tar.gz;
tar xfz netxms_*.orig.tar.gz;
cd netxms-*;
dpkg-buildpackage -us -uc;

Here you will get an error about the upstream tarball missing like this:

dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../netxms_201507231213.orig.tar.{bz2,gz,lzma,xz}

Fix the tarball name (you have a netxms_*.orig.tar.gz one directory above) and you can continue.

dpkg-buildpackage -us -uc;
cd ..;
mv *.deb ../../nxms-packages;
rm -r netxms_*;
rm -r netxms-*;
cd ../../nxms-packages;
ls -l;