#!/usr/bin/make -f # -*- makefile -*- # # 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. # # Modified to make a template file for a multi-binary package with separated # build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This has to be exported to make some magic below work. export DH_OPTIONS BUILD_DIR=build-dir ifeq ($(wildcard /usr/share/dpkg/buildflags.mk),) CFLAGS := -Wall -g LDFLAGS := -Wl,--as-needed -Wl,-z,defs ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif else DPKG_EXPORT_BUILDFLAGS := 1 include /usr/share/dpkg/buildflags.mk # append -Wl,--as-needed and -Wl,-z,defs to LDFLAGS if missing comma := , ifeq (,$(findstring -Wl$(comma)--as-needed,$(LDFLAGS))) LDFLAGS += -Wl,--as-needed endif ifeq (,$(findstring -Wl$(comma)-z$(comma)defs,$(LDFLAGS))) LDFLAGS += -Wl,-z,defs endif # the same for -Wall and CFLAGS ifeq (,$(findstring -Wall,$(CFLAGS))) CFLAGS += -Wall endif export CFLAGS export LDLAGS endif CMAKE_LDFLAGS=-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" -DCMAKE_MODULE_LINKER_FLAGS="$(LDFLAGS)" -DCMAKE_SHARED_LINKER_FLAGS="$(LDFLAGS)" -DBUILD_HSI:BOOL=ON # Upstream version can be overriden so as to fetch newer revisions # without having to modify the top-most changelog entry UVERSION ?= $(shell dpkg-parsechangelog | perl -ne 'print "$$1\n" if (/^Version: (.*?)(?:\.dfsg)?\-.*?$$/)') UREVISION = $(shell echo $(UVERSION) | sed -e 's/^.*svn//') UTRUNK = https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/trunk # Where to store which manpages are generated (upstream keeps some manpages # both under .pod and .1 formats). GENERATED_MANPAGES=debian/generated-manpages maint-svn-snapshot: @echo "Latest trunk: $(shell LANG=C svn info $(UTRUNK) | grep Revision | awk -F": " '{print $$2}')" @echo "Upstream version: $(UVERSION)" @echo "Upstream revision: $(UREVISION)" [ ! -f ../hugin_$(UVERSION).orig.tar.gz ] || (echo "Upstream tarball exists already. Aborting."; exit 1) svn export -q -r $(UREVISION) $(UTRUNK) debian/svn/hugin-$(UVERSION) tar cfz ../hugin_$(UVERSION).orig.tar.gz -C debian/svn hugin-$(UVERSION) echo "../hugin_$(UVERSION).orig.tar.gz ready" rm -rf debian/svn configure-stamp: dh_testdir # Configure the package. sed -e s_autopano-noop.sh_autopano-noop_g < doc/autopano-noop.sh.pod \ > doc/autopano-noop.pod mkdir $(BUILD_DIR) cd $(BUILD_DIR) && cmake -DCMAKE_INSTALL_PREFIX=/usr $(CMAKE_LDFLAGS) .. touch $@ build: build-arch build-indep build-arch: build-arch-stamp build-indep: build-indep-stamp build-arch-stamp: configure-stamp # Compile the package. $(MAKE) -C $(BUILD_DIR) VERBOSE=1 touch $@ build-indep-stamp: configure-stamp # Build manpages. for i in doc/*.pod ; do \ if [ ! -f $${i%%.pod}.1 ] ; then \ pod2man --center "HUGIN TOOLS" \ --release $(UVERSION) \ $$i -o $${i%%.pod}.1 ; \ echo $${i%%.pod}.1 >> $(GENERATED_MANPAGES) ; \ fi ; \ done touch $@ clean: dh_testdir dh_testroot rm -f build-indep-stamp build-arch-stamp install-arch-stamp \ install-indep-stamp configure-stamp src/celeste/Config.h # Clean up after the build process. rm -rf $(BUILD_DIR) # Clean generated manpages. if [ -f $(GENERATED_MANPAGES) ] ; then \ for i in `cat $(GENERATED_MANPAGES)` ; do \ rm -f $$i ; \ done ; \ fi rm -f $(GENERATED_MANPAGES) dh_clean install: install-indep install-arch install-indep: install-indep-stamp install-arch: install-arch-stamp install-indep-stamp: build-indep-stamp install-arch-stamp dh_testdir dh_testroot dh_installdirs -i dh_install --sourcedir=debian/tmp -i touch $@ install-arch-stamp: build-arch-stamp dh_testdir dh_testroot dh_prep dh_installdirs -a # Install the package into debian/tmp. $(MAKE) install -C $(BUILD_DIR) DESTDIR=$(CURDIR)/debian/tmp # Get rid of extra license file rm debian/tmp/usr/share/hugin/xrc/data/help_en_EN/LICENCE.manual dh_install --sourcedir=debian/tmp -a touch $@ binary-common: dh_testdir dh_testroot dh_installchangelogs ChangeLog dh_installdocs dh_installexamples dh_installmenu dh_installman dh_python2 -i /usr/share/hugin/data/plugins dh_python2 -a --no-guessing-versions dh_link dh_strip dh_compress dh_fixperms dh_makeshlibs --noscripts dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb # Build architecture independant packages using the common target. binary-indep: build-indep install-indep $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common # Build architecture dependant packages using the common target. binary-arch: build-arch install-arch $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common get-orig-source: rm -rf $(CURDIR)/debian/get-orig-source mkdir $(CURDIR)/debian/get-orig-source uscan --force-download --rename --download-version ${UVERSION} \ --destdir $(CURDIR)/debian/get-orig-source cd $(CURDIR)/debian/get-orig-source && \ if test -e hugin_${UVERSION}.orig.tar.gz ; then \ tar xzf hugin_${UVERSION}.orig.tar.gz ; else \ tar xjf hugin_${UVERSION}.orig.tar.bz2 ; fi && \ cd hugin-* && \ rm -rvf platforms/windows/ mac/* \ src/foreign/getopt/src/msvs/ platforms/mac/* \ platforms/CMakeLists.txt &&\ touch platforms/CMakeLists.txt && \ find -name '*.vcproj' -delete && \ cd .. && \ tar -czf $(CURDIR)/../hugin_$(UVERSION)+dfsg.orig.tar.gz hugin-* rm -rf $(CURDIR)/debian/get-orig-source binary: binary-arch binary-indep .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch get-orig-source