[mapserver] 32/43: Use minimal dh rules.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 7 20:21:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch wheezy-backports
in repository mapserver.

commit 298ebff87ef6be29caf228653d39a1d5fc1a2fcb
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Jul 19 19:10:34 2013 +0200

    Use minimal dh rules.
---
 debian/control                        |   1 +
 debian/libmapserver-6.2.1-dev.install |   4 +-
 debian/libmapserver-6.2.1.install     |   2 +-
 debian/patches/hardening.patch        |  18 +--
 debian/rules                          | 208 ++++++++++++----------------------
 5 files changed, 88 insertions(+), 145 deletions(-)

diff --git a/debian/control b/debian/control
index 5ef91c1..393fc16 100644
--- a/debian/control
+++ b/debian/control
@@ -34,6 +34,7 @@ Replaces: libmapserver (<< 6.2.1-3~)
 Breaks: libmapserver (<< 6.2.1-3~)
 Section: libs
 Architecture: any
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Suggests: cgi-mapserver, mapserver-bin, mapserver-doc,
  php5-mapscript, python-mapscript, libmapscript-perl, libmapscript-ruby
diff --git a/debian/libmapserver-6.2.1-dev.install b/debian/libmapserver-6.2.1-dev.install
index 073899d..bbe1641 100644
--- a/debian/libmapserver-6.2.1-dev.install
+++ b/debian/libmapserver-6.2.1-dev.install
@@ -1,4 +1,4 @@
 usr/bin/mapserver-config
 usr/include/mapserver/*
-usr/lib/libmapserver.la
-usr/lib/libmapserver.so
+usr/lib/*/libmapserver.la
+usr/lib/*/libmapserver.so
diff --git a/debian/libmapserver-6.2.1.install b/debian/libmapserver-6.2.1.install
index 0c84993..01666b4 100644
--- a/debian/libmapserver-6.2.1.install
+++ b/debian/libmapserver-6.2.1.install
@@ -1 +1 @@
-usr/lib/libmapserver-*.so
+usr/lib/*/libmapserver-*.so
diff --git a/debian/patches/hardening.patch b/debian/patches/hardening.patch
index c5ffdf6..accb53d 100644
--- a/debian/patches/hardening.patch
+++ b/debian/patches/hardening.patch
@@ -3,21 +3,23 @@ Author: Bas Couwenberg <sebastic at xs4all.nl>
 Last-Update: 2013-06-30
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -254,6 +254,9 @@ FLAGS = @DEBUG_FLAGS@ $(DEFINES) $(INCLU
+@@ -254,6 +254,11 @@ FLAGS = @DEBUG_FLAGS@ $(DEFINES) $(INCLU
  
  CFLAGS   = @CFLAGS@ $(FLAGS)
  CXXFLAGS = @CXXFLAGS@ $(FLAGS)
 +LDFLAGS = @LDFLAGS@
 +
++HARDENING_FLAGS = @CFLAGS@ @LDFLAGS@
++
 +LINK+=$(LDFLAGS)
  
  # Link flags and shared libs only
  SUP_LIBS =  $(FT_LIB) $(GD_LIB) $(OGL_LIB) $(FTGL_LIB) $(PROJ_LIBS) \
-@@ -417,6 +420,7 @@ mapscriptvars:	Makefile
+@@ -417,6 +422,7 @@ mapscriptvars:	Makefile
  	echo $(LIBMAP) >> mapscriptvars
  	echo -Wl,$(EXE_LDFLAGS) >> mapscriptvars
  	grep '#define MS_VERSION ' mapserver.h >> mapscriptvars
-+	echo $(CFLAGS) >> mapscriptvars
++	echo $(HARDENING_FLAGS) >> mapscriptvars
  
  mapserver-config: Makefile
  	rm -f mapserver-config
@@ -34,14 +36,14 @@ Last-Update: 2013-06-30
  # Default is 4.3
  else { $ms_version = '4.3'; }
  
-+$cflags = <STREAM>;
-+chomp $cflags;
++$hardening_flags = <STREAM>;
++chomp $hardening_flags;
 +
  print $inc."\n";
  print $libs."\n";
  print $static_libs."\n";
  print $ms_version."\n";
-+print $cflags."\n";
++print $hardening_flags."\n";
  
  my $swigInterfaceFile = "../mapscript.i";
  my $swigWrapperFile   = "mapscript_wrap.c";
@@ -49,8 +51,8 @@ Last-Update: 2013-06-30
  	      'DEFINE' 		=> $define,
  	      'INC' 		=> $inc,
  	      'LIBS' 		=> [$libs,$static_libs],
-+	      'OPTIMIZE' 	=> $cflags,
-+	      'LD'	 	=> "$Config{ld} $cflags",
++	      'OPTIMIZE' 	=> $hardening_flags,
++	      'LD'	 	=> "$Config{ld} $hardening_flags",
  	      'OBJECT' 		=> 'mapscript_wrap.o',
  		  'VERSION' 	=> $ms_version
  	      );
diff --git a/debian/rules b/debian/rules
index 68b765f..a2201b9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,35 +8,30 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
-# Enable hardening build flags
-export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+# Enable hardening build flags, except:
+#  pie: causes build failure
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
+
 
 CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
 CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 
 CFLAGS+=$(CPPFLAGS)
-CFLAGS+=$(LDFLAGS)
 
-# mapscript.so for ruby1.9.1 fails to build with -Werror=format-security
+# Perl mapscript requires CPPFLAGS & LDFLAGS in CFLAGS
+PERL_CFLAGS=$(CFLAGS)
+PERL_CFLAGS+=$(LDFLAGS)
+
+# Ruby mapscript fails to build with -Werror=format-security
 RUBY_CPPFLAGS=$(subst -Werror=format-security,,$(CFLAGS))
+RUBY_CPPFLAGS+=$(LDFLAGS)
  
-package=mapserver
-
-version=$(shell expr `pwd` : '.*-\([0-9.]*\)')
-version_major=$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')
-CURDIR := $(shell pwd)
 PYVERS=$(shell pyversions -r debian/control)
 RUBYVERS=1.8 1.9.1
 PHP5API=$(shell php-config5 --phpapi)
 MANPAGES:=$(wildcard debian/man/*.*.xml)
 
-# Configure config :
-# Not using non free libpdf
-# Explicit disable direct goetiff support, 
-# it's better to use gdal geotiff support for stability reasons
-
-
 COMMON_CONFIG=	--prefix=/usr \
 		--with-gd=/usr \
 		--with-freetype=/usr \
@@ -57,69 +52,15 @@ COMMON_CONFIG=	--prefix=/usr \
 		--with-php \
 		--with-cairo
 
-rstoptions=--stylesheet=mapscript.css --link-stylesheet 
-
 MS_CFLAGS=$(CFLAGS)
-MS_CXXFLAGS=$(MS_CFLAGS)
+MS_CXXFLAGS=$(CFLAGS)
 MS_CPPFLAGS=$(CPPFLAGS)
 MS_LDFLAGS=$(LDFLAGS)
 
-configure-stamp:
-	dh_testdir
-	./configure $(COMMON_CONFIG) CFLAGS="$(MS_CFLAGS)" CXXFLAGS="$(MS_CXXFLAGS)" CPPFLAGS="$(MS_CPPFLAGS)" LDFLAGS="$(MS_LDFLAGS)"
-
-	touch configure-stamp
-
-# This is the correct, policy-compliant build target
-#build: build-indep build-arch
-
-# This is the incorrect, non-policy compliant build target
-# it is nessecary because the auto-builders use build, but don't install Build-Depends-Indep
-build: build-arch
+%:
+	dh $@ --with python2
 
-build-indep: build-indep-stamp
-build-indep-stamp:
-	dh_testdir
-	touch build-indep-stamp
-
-build-arch: build-arch-stamp
-build-arch-stamp: configure-stamp
-	dh_testdir
-
-	# Create man pages from DocBook XML
-	for x in $(MANPAGES) ; do \
-	  docbook2x-man $$x ; \
-	  mv `basename $$x | sed 's/.xml$$//'` `dirname $$x` ; \
-	done
-
-	# Build binary lib
-	$(MAKE) mapscriptvars || touch mapscriptvars
-	$(MAKE)  
-
-	# Build Perl mapscript
-	cd $(CURDIR)/mapscript/perl && \
-	  perl Makefile.PL INSTALLDIRS=vendor \
-	  && $(MAKE) LD_RUN_PATH="" OPTIMIZE="$(CFLAGS) -W -Wall"
-
-	# Build python
-	cd $(CURDIR)/mapscript/python && \
-	  set -e; for python in $(PYVERS); do CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $$python setup.py build; done
-
-	# Build ruby
-	cd $(CURDIR)/mapscript/ruby && set -e ; \
-	  for v in $(RUBYVERS) ; do \
-	    ruby$$v extconf.rb --with-cppflags="$(RUBY_CPPFLAGS) " && $(MAKE) && \
-	      mv mapscript.so ruby$$v-mapscript.so ; \
-	  done
-
-	touch build-arch-stamp
-
-
-# This is needed to do 'make clean', but will be removed by the clean
-# targets.  The end result is that 'debuild clean' only can execute
-# once.  Hack around this problem by faking the creation when make fail.
-
-clean-first-build:
+override_dh_auto_clean:
 	dh_testdir
 
 	-$(RM) configure-stamp build-arch-stamp build-indep-stamp
@@ -133,13 +74,14 @@ clean-first-build:
 	  for python in $(PYVERS); do $$python setup.py clean; done
 	-$(RM) -rf mapscript/python/build mapscript/python/Makefile
 	[ ! -f $(CURDIR)/mapscript/ruby/Makefile ] || $(MAKE) distclean -C $(CURDIR)/mapscript/ruby
-	-$(RM) -rf $(CURDIR)/mapscript/ruby/mapscript_wrap.c
+	-$(RM) -rf $(CURDIR)/mapscript/ruby/mapscript_wrap.c $(CURDIR)/mapscript/ruby/*mapscript.so
 	-$(RM) mapscriptvars libtool
 
 	-$(RM)  mapscript/perl/mapscript.i \
 		mapscript/tcl/mapscript.i \
 		mapscript/python/mapscript.i
 
+	touch config.log
 	[ ! -f $(CURDIR)/Makefile ] || $(MAKE) distclean
 
 	# Remove some generated files 
@@ -149,27 +91,48 @@ clean-first-build:
 
 	-$(RM) debian/.#* .#*
 
-clean: clean-first-build
-	dh_testdir
 	dh_prep
+
 	-$(RM) install-arch-stamp install-indep-stamp
+
 	-$(RM) -rf $(CURDIR)/debian/files
-	[ ! -f Makefile ] || $(MAKE) distclean
 	rm -f debian/*.debhelper.log
+	rm -f debian/man/*.1
+
+override_dh_auto_configure:
+	dh_auto_configure -- $(COMMON_CONFIG) CFLAGS="$(MS_CFLAGS)" CXXFLAGS="$(MS_CXXFLAGS)" CPPFLAGS="$(MS_CPPFLAGS)" LDFLAGS="$(MS_LDFLAGS)"
+
+override_dh_auto_build:
+	dh_testdir
 
-install-indep: install-indep-stamp
-install-indep-stamp: build-indep
-	dh_testdir -i
-	dh_testroot -i
-	dh_installdirs -i
-	dh_install -i
-	touch install-indep-stamp
-
-install-arch: install-arch-stamp
-install-arch-stamp: build-arch
-	dh_testdir -a
-	dh_testroot -a
-	dh_installdirs -a
+	# Create man pages from DocBook XML
+	for x in $(MANPAGES) ; do \
+	  docbook2x-man $$x ; \
+	  mv `basename $$x | sed 's/.xml$$//'` `dirname $$x` ; \
+	done
+
+	dh_auto_build
+
+	# Perl mapscript
+	cd $(CURDIR)/mapscript/perl && \
+	  perl Makefile.PL INSTALLDIRS=vendor \
+	  && $(MAKE) LD_RUN_PATH="" OPTIMIZE="$(PERL_CFLAGS) -W -Wall"
+
+	# Python mapscript
+	cd $(CURDIR)/mapscript/python && \
+	  set -e; for python in $(PYVERS); do CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $$python setup.py build; done
+
+	# Ruby mapscript
+	cd $(CURDIR)/mapscript/ruby && set -e ; \
+	  for v in $(RUBYVERS) ; do \
+	    ruby$$v extconf.rb --with-cppflags="$(RUBY_CPPFLAGS) " && $(MAKE) && \
+	      mv mapscript.so ruby$$v-mapscript.so ; \
+	  done
+
+override_dh_auto_test:
+	# msautotest submodule is not used
+
+override_dh_auto_install:
 	dh_auto_install
 
 	# Perl mapscript
@@ -180,6 +143,7 @@ install-arch-stamp: build-arch
 	cd $(CURDIR)/mapscript/python && set -e ; \
 	  for python in $(PYVERS); do \
 	    $$python setup.py install --install-layout=deb --root=$(CURDIR)/debian/python-mapscript ; \
+	    $(RM) -f $(CURDIR)/debian/python-mapscript/usr/lib/$$python/dist-packages/mapscript.pyc ; \
 	  done
 
 	# Ruby mapscript
@@ -201,7 +165,7 @@ install-arch-stamp: build-arch
 	-$(RM) -rf $(CURDIR)/debian/tmp/usr/lib/php5/$(PHP5API)/*.la
 
 	# empty dependency_libs in la file
-	sed -i "/dependency_libs/ s/'.*'/''/" $(CURDIR)/debian/tmp/usr/lib/libmapserver.la
+	sed -i "/dependency_libs/ s/'.*'/''/" $(CURDIR)/debian/tmp/usr/lib/*/libmapserver.la
 
 	# CGI mapserver
 	-mkdir -p debian/tmp/usr/lib/cgi-bin
@@ -213,50 +177,26 @@ install-arch-stamp: build-arch
 	-mkdir -p debian/tmp/usr/include/mapserver/
 	install -m755 *.h debian/tmp/usr/include/mapserver/
 
-	touch install-arch-stamp
-
-binary-indep: install-indep
-	dh_testdir -i
-	dh_testroot -i
-	dh_installchangelogs -i HISTORY.TXT
-	dh_installdocs -i
-	dh_installexamples -i
-	dh_installdebconf -i
-	dh_installman
-	dh_compress -i -X.xml -X.xsd -X.xsl
-	dh_link -i
-	dh_lintian -i
-	dh_fixperms -i
-	dh_installdeb -i
-	dh_gencontrol -i
-	dh_md5sums -i
-	dh_builddeb -i
-
-binary-arch: install-arch
-	dh_testdir -a
-	dh_testroot -a
-	dh_install --autodest --list-missing 
-	dh_installchangelogs -a HISTORY.TXT
-	dh_installdocs -a
-	dh_installexamples -a
+override_dh_installchangelogs:
+	dh_installchangelogs HISTORY.TXT
+
+override_dh_installexamples:
+	dh_installexamples
+
 	chmod a-x debian/php*-mapscript/usr/share/doc/php*-mapscript/examples/*.phtml
-	dh_installdebconf -a
-	dh_installman
-	dh_python2 -ppython-mapscript
-	dh_compress -a
-	dh_link -a
-	dh_lintian -a
-	dh_strip -a
-	dh_fixperms -a
-	dh_makeshlibs -a -Xphp_mapscript
-	dh_installdeb -a
-	dh_shlibdeps -a
-	dh_perl -plibmapscript-perl
-	dh_gencontrol -a
-	dh_md5sums -a
-	dh_builddeb -a
 
-binary: binary-indep binary-arch
+override_dh_install:
+	dh_install --autodest --list-missing
+
+override_dh_compress:
+	dh_compress -X.xml -X.xsd -X.xsl
 
-.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install install-indep install-arch
+override_dh_makeshlibs:
+	dh_makeshlibs -Xphp_mapscript
+
+override_dh_python2:
+	dh_python2 -ppython-mapscript
+
+override_dh_perl:
+	dh_perl -plibmapscript-perl
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapserver.git



More information about the Pkg-grass-devel mailing list