Building Debian packages

From NetXMS Wiki
Jump to navigation Jump to search
This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide)

= 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:
32bit: http://www.oracle.com/technetwork/topics/linuxsoft-082809.html
64bit: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

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

After download, run:

sudo unzip -x -d /opt instantclient-basiclite-linux*-11.2.0.4.0.zip
sudo unzip -x -d /opt instantclient-sdk-linux*-11.2.0.4.0.zip
sudo ln -s libclntsh.so.11.1 /opt/instantclient_11_2/libclntsh.so

Building packages

mkdir ./nxms-packaging && true;
mkdir ./nxms-packages && true;
cd ./nxms-packaging;
if [ -e .git ]; then
  git pull;
else
  git clone http://git.netxms.org/public/netxms.git --branch develop ./;
fi

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:

./reconf;
./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;