Fix/packaging (#1047)

* Fix OpenWrt build.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Fixed Debian/Ubuntu packaging.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Added DPKG package build to a CI job.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2020-11-03 11:36:40 +01:00
committed by GitHub
parent a9547da138
commit 8e84abfa0e
7 changed files with 122 additions and 111 deletions
+6 -35
View File
@@ -1,46 +1,17 @@
#
# Change it according to your setup
#
NDPI_HOME=$(PWD)/../..
NDPI_BUILD=${NDPI_HOME}/packages/ubuntu
NDPI_BUILD="$(realpath ${NDPI_HOME}/packages/ubuntu)"
all: clean ndpi
ndpi:
\rm -rf ./debian/ndpi-tmp ./debian/ndpi-dev-tmp ./debian/ndpi ./debian/ndpi-dev
mkdir -p ./debian/ndpi-tmp ./debian/ndpi-dev-tmp
mkdir -p ./debian/ndpi-tmp/usr/lib ./debian/ndpi-tmp/usr/bin
mkdir -p ./debian/ndpi-dev-tmp/usr/lib ./debian/ndpi-dev-tmp/usr/include/ndpi
cd ${NDPI_HOME}; ./autogen.sh; ./configure; make
cp $(NDPI_HOME)/src/lib/libndpi.so.@NDPI_VERS@ ./debian/ndpi-tmp/usr/lib/
cd ./debian/ndpi-tmp/usr/lib/; ln -s libndpi.so.@NDPI_VERS@ libndpi.so; cd -
cd ./debian/ndpi-tmp/usr/lib/; ln -s libndpi.so.@NDPI_VERS@ libndpi.so.@MAJOR_RELEASE@; cd -
cp $(NDPI_HOME)/src/lib/libndpi.a ./debian/ndpi-dev-tmp/usr/lib/
cp $(NDPI_HOME)/example/ndpiReader ./debian/ndpi-tmp/usr/bin/
cp $(NDPI_HOME)/src/include/*.h ./debian/ndpi-dev-tmp/usr/include/ndpi/
-rm -fr ./debian/ndpi-dev-tmp/usr/include/ndpi/ndpi_win32.h*
@echo
@find ./debian/ndpi-tmp -name "*~" -exec /bin/rm {} ';'
@find ./debian/ndpi-dev-tmp -name "*~" -exec /bin/rm {} ';'
dpkg-buildpackage -rfakeroot -d -us -uc
dpkg-sig --sign builder -k D1EB60BE ../ndpi*deb
@\rm -f ../ndpi*dsc ../ndpi*.gz ../ndpi*changes
@/bin/mv ../ndpi*deb .
@echo
@echo "Package built."
@/bin/ls ndpi*deb
@echo "-------------------------------"
-dpkg --contents ndpi_*.deb
@echo "-------------------------------"
@echo "-------------------------------"
-dpkg --contents ndpi-dev_*.deb
@echo "-------------------------------"
cd ${NDPI_HOME}; ./autogen.sh --prefix="/usr"; make
distclean:
echo "dummy distclean"
-cd ${NDPI_HOME} && make distclean
install:
echo "dummy install"
cd ${NDPI_HOME}; make install DESTDIR="${NDPI_BUILD}/debian/tmp" AM_UPDATE_INFO_DIR=no
clean:
-rm -rf *~ *deb ./usr ./debian/ndpi ./debian/ndpi-dev ./debian/ndpi-tmp ./debian/ndpi-dev-tmp
-cd ${NDPI_HOME} && make clean
-rm -rf *~ *deb ./usr ./debian/ndpi ./debian/ndpi-dev ./debian/ndpi ./debian/ndpi-dev
+12
View File
@@ -0,0 +1,12 @@
Howto Build Debian packages
---------------------------
Initial configuration and debian/changelog generation:
./configure
Build a binary (GPG signed) nDPI package with:
dpkg-buildpackage -b
Or build a binary (unsigned) nDPI package with:
dpkg-buildpackage -b -us -uc
+3 -3
View File
@@ -1705,9 +1705,9 @@ else
fi
fi
NDPI_VERS=`../version.sh --release`
MAJOR_RELEASE=`../version.sh --major-release`
GIT_REVISION=`../version.sh --revision`
NDPI_VERS=`$(dirname "${0}")/../version.sh --release`
MAJOR_RELEASE=`$(dirname "${0}")/../version.sh --major-release`
GIT_REVISION=`$(dirname "${0}")/../version.sh --revision`
ac_config_files="$ac_config_files Makefile debian/changelog debian/files debian/control"
+3 -3
View File
@@ -24,9 +24,9 @@ else
fi
fi
NDPI_VERS=`../version.sh --release`
MAJOR_RELEASE=`../version.sh --major-release`
GIT_REVISION=`../version.sh --revision`
NDPI_VERS=`$(dirname "${0}")/../version.sh --release`
MAJOR_RELEASE=`$(dirname "${0}")/../version.sh --major-release`
GIT_REVISION=`$(dirname "${0}")/../version.sh --revision`
AC_CONFIG_FILES([Makefile debian/changelog debian/files debian/control])
+25 -40
View File
@@ -1,50 +1,35 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DH_VERBOSE=1
package=ndpi
DPKG_EXPORT_BUILDFLAGS = 1
build: build-stamp
build-stamp:
dh_testdir
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
clean:
dh_testdir
dh_testroot
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
%:
dh $@
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
cd ../../tests && LD_LIBRARY_PATH=$(CURDIR)/src/lib ./do.sh
cd ../../tests && LD_LIBRARY_PATH=$(CURDIR)/src/lib ./do-unit.sh
endif
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_prep
#dh_clean -k
dh_installdirs
dh_installinit
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
mkdir -p ./debian/ndpi ./debian/ndpi-dev
cp -r ./debian/ndpi-tmp/* ./debian/ndpi/
cp -r ./debian/ndpi-dev-tmp/* ./debian/ndpi-dev/
-find ./debian/ndpi -executable -type f | xargs strip
dh_gencontrol
dh_md5sums
dh_builddeb
override_dh_installdocs:
# FIXME: nDPI does currently not have any up2date doc
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
override_dh_auto_install:
make -j1 install DESTDIR="$(CURDIR)/debian/tmp" AM_UPDATE_INFO_DIR=no
# ndpi package
mkdir -p "$(CURDIR)/debian/ndpi/usr/"
mv -v "$(CURDIR)/debian/tmp/usr/bin" "$(CURDIR)/debian/ndpi/usr/"
mv -v "$(CURDIR)/debian/tmp/usr/lib" "$(CURDIR)/debian/ndpi/usr/"
mv -v "$(CURDIR)/debian/tmp/usr/share" "$(CURDIR)/debian/ndpi/usr/"
# ndpi-dev package
mkdir -p "$(CURDIR)/debian/ndpi-dev/usr/include"
mv -v "$(CURDIR)/debian/tmp/usr/include/ndpi" "$(CURDIR)/debian/ndpi-dev/usr/include/"
.PHONY: override_dh_auto_configure override_dh_installdocs override_dh_auto_install