#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CFLAGS = -Wall -g CPPFLAGS = -D__STDC_CONSTANT_MACROS CXXFLAGS = -DHAVE_LIBCRYPTO ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif # These are used to get the most recent version of the original sources from github UURL = $(shell git config --get remote.origin.url) BRANCH = $(shell git rev-parse --abbrev-ref HEAD) HEAD = $(shell git rev-parse HEAD) PKD = $(abspath $(dir $(MAKEFILE_LIST))) PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source)) VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};') DTYPE = %: dh $@ --with quilt,autoreconf,systemd override_dh_auto_configure: CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" dh_auto_configure -- \ --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --sysconfdir=/etc/zm --prefix=/usr --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info --with-mysql=/usr \ --with-mariadb=/usr --with-webdir=/usr/share/zoneminder \ --with-ffmpeg=/usr --with-cgidir=/usr/lib/cgi-bin \ --with-webuser=www-data --with-webgroup=www-data \ --enable-crashtrace=no --enable-mmap=yes override_dh_clean: # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean dh_clean src/zm_config_defines.h override_dh_install: # # NOTE: This is a short-term kludge; hopefully changes in the next # upstream version will render this unnecessary. rm -rf debian/zoneminder/usr/share/zoneminder/events rm -rf debian/zoneminder/usr/share/zoneminder/images rm -rf debian/zoneminder/usr/share/zoneminder/temp dh_link var/cache/zoneminder/events usr/share/zoneminder/events dh_link var/cache/zoneminder/images usr/share/zoneminder/images dh_link var/cache/zoneminder/temp usr/share/zoneminder/temp # # This is a slightly lesser kludge; moving the cgi stuff to # /usr/share/zoneminder/cgi-bin breaks one set of behavior, # having it just in /usr/lib/cgi-bin breaks another bit of # behavior. # dh_link usr/lib/cgi-bin usr/share/zoneminder/cgi-bin dh_install --fail-missing override_dh_fixperms: dh_fixperms chown root:root debian/zoneminder/etc/zm/zm.conf override_dh_auto_test: # do not run tests... override_dh_systemd_start: dh_systemd_start --restart-after-upgrade .PHONY: override_dh_strip override_dh_strip: dh_strip --dbg-package=zoneminder-dbg # Inspired by https://wiki.debian.org/onlyjob/get-orig-source .PHONY: get-orig-source get-orig-source: ../$(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE)) @ ../$(PKG)_$(VER)$(DTYPE).orig.tar.xz: $(if $(wildcard $(PKG)-$(VER)),$(error folder '$(PKG)-$(VER)' exists, aborting...)) @echo "# Cloning origin repository..."; \ if ! git clone $(UURL) $(PKG)-$(VER); then \ $(RM) -r $(PKG)-$(VER); \ echo "failed to clone repository, aborting..."; \ false; \ fi @if [ $(BRANCH) != \"master\" ]; then \ cd $(PKG)-$(VER); \ echo "# Not on master branch, fetching origin branch '$(BRANCH)'..."; \ git fetch origin $(BRANCH):$(BRANCH) || false; \ echo "# Switching to branch '$(BRANCH)'..."; \ git checkout $(BRANCH) || false; \ fi @echo "# Checking local source..." @if [ $$(cd $(PKG)-$(VER) && git rev-parse HEAD) = $(HEAD) ]; then \ echo "even with origin, ok"; \ true; \ else \ echo "not even with origin, aborting..."; \ false; \ fi @echo "# Setting times..." @cd $(PKG)-$(VER) \ && for F in $$(git ls-tree -r --name-only HEAD | sed -e "s/\s/\*/g"); do \ touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; \ done @echo "# Cleaning-up..." cd $(PKG)-$(VER) && $(RM) -r .git @echo "# Packing..." @find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \ | XZ_OPT="-6v" tar -caf "../$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \ && $(RM) -r "$(PKG)-$(VER)"