diff --git a/debian/control b/debian/control index 07bfa5c..c61529e 100644 --- a/debian/control +++ b/debian/control @@ -22,8 +22,7 @@ Rules-Requires-Root: no Package: nginx Architecture: all -Depends: nginx-core (<< ${source:Version}.1~) | nginx-full (<< ${source:Version}.1~) | nginx-light (<< ${source:Version}.1~) | nginx-extras (<< ${source:Version}.1~), - nginx-core (>= ${source:Version}) | nginx-full (>= ${source:Version}) | nginx-light (>= ${source:Version}) | nginx-extras (>= ${source:Version}), +Depends: nginx-abi-${nginx:abi}, ${misc:Depends} Description: small, powerful, scalable web/proxy server Nginx ("engine X") is a high-performance web and reverse proxy server @@ -62,8 +61,6 @@ Package: nginx-dev Architecture: all Multi-Arch: foreign Depends: ${misc:Depends}, ${S:Build-Depends}, - nginx-core (<< ${source:Version}.1~) | nginx-light (<< ${source:Version}.1~) | nginx-extras (<< ${source:Version}.1~), - nginx-core (>= ${source:Version}) | nginx-light (>= ${source:Version}) | nginx-extras (>= ${source:Version}) Provides: dh-sequence-nginx Description: nginx web/proxy server - development headers Nginx ("engine X") is a high-performance web and reverse proxy server @@ -88,7 +85,7 @@ Depends: libnginx-mod-http-geoip (= ${binary:Version}), ${shlibs:Depends} Breaks: nginx-full (<< 1.18.0-1), Replaces: nginx-full (<< 1.18.0-1), -Provides: httpd, httpd-cgi, nginx +Provides: httpd, httpd-cgi, nginx, nginx-abi-${nginx:abi} Conflicts: nginx-extras, nginx-light Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (standard version) @@ -126,7 +123,7 @@ Depends: libnginx-mod-http-auth-pam, nginx-core (<< ${source:Version}.1~), ${misc:Depends}, ${shlibs:Depends} -Provides: httpd, httpd-cgi, nginx +Provides: httpd, httpd-cgi, nginx, nginx-abi-${nginx:abi} Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (standard version with 3rd parties) Nginx ("engine X") is a high-performance web and reverse proxy server @@ -160,7 +157,7 @@ Depends: libnginx-mod-http-echo (>= 1:0.63-3~), iproute2, ${misc:Depends}, ${shlibs:Depends} -Provides: httpd, httpd-cgi, nginx +Provides: httpd, httpd-cgi, nginx, nginx-abi-${nginx:abi} Conflicts: nginx-extras, nginx-core Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (basic version) @@ -206,7 +203,7 @@ Depends: libnginx-mod-http-auth-pam (>= 1:1.5.3-2~), iproute2, ${misc:Depends}, ${shlibs:Depends} -Provides: httpd, httpd-cgi, nginx +Provides: httpd, httpd-cgi, nginx, nginx-abi-${nginx:abi} Conflicts: nginx-core, nginx-light Suggests: nginx-doc (= ${source:Version}) Description: nginx web/proxy server (extended version) diff --git a/debian/debhelper/dh_nginx b/debian/debhelper/dh_nginx index f2b9bb5..c303731 100755 --- a/debian/debhelper/dh_nginx +++ b/debian/debhelper/dh_nginx @@ -23,17 +23,22 @@ use strict; use File::Find; use Debian::Debhelper::Dh_Lib; - +use Dpkg::Substvars; =head1 NAME dh_nginx - register configuration snippets to the nginx web server =cut - +my $abi; sub nginx_depends { - return 'nginx-common (= ${source:Version})' + if (!$abi) { + my $sv = Dpkg::Substvars->new(); + $sv->load("/usr/share/nginx/src/debian/libnginx-mod.substvars"); + $abi = $sv->get("nginx:abi"); + } + return "nginx-abi-$abi"; } sub nginx_api_installdir @@ -268,30 +273,24 @@ foreach my $package ((@{$dh{DOPACKAGES}})) } } - my @postinst_autoscripts; + my @postinst_autoscripts; - if ($#{$PACKAGE_TYPE{'has_a_module'}} >= 0) - { - if ($package !~ m/libnginx-mod-\w+?/) - { - warning("Package $package appears to be an Nginx module. It should comply to the package naming scheme libnginx-mod-\n"); - } - if ($nginx_in_tree){ - addsubstvar($package, "misc:Depends", nginx_depends()); - } else { - my $ngx_ver = `grep 'define NGINX_VERSION' /usr/share/nginx/src/src/core/nginx.h | sed -e 's/^.*"\\(.*\\)".*/\\1/'`; - chomp($ngx_ver); - addsubstvar($package, "misc:Depends", "nginx-common (>= $ngx_ver), nginx-common (<< $ngx_ver.1~)"); - } + if ($#{$PACKAGE_TYPE{'has_a_module'}} >= 0) + { + if ($package !~ m/libnginx-mod-\w+?/) + { + warning("Package $package appears to be an Nginx module. It should comply to the package naming scheme libnginx-mod-\n"); + } + addsubstvar($package, "misc:Depends", nginx_depends()); - my $modules = ""; - foreach my $module (@{$PACKAGE_TYPE{'has_a_module'}}) - { - $modules .= "$module "; - } + my $modules = ""; + foreach my $module (@{$PACKAGE_TYPE{'has_a_module'}}) + { + $modules .= "$module "; + } - push @postinst_autoscripts, ["module", $modules]; - } + push @postinst_autoscripts, ["module", $modules]; + } if (! $dh{NOSCRIPTS}) { diff --git a/debian/debhelper/nginx_mod.pm b/debian/debhelper/nginx_mod.pm index 4b19403..7df00d4 100644 --- a/debian/debhelper/nginx_mod.pm +++ b/debian/debhelper/nginx_mod.pm @@ -37,8 +37,8 @@ sub new { my $this= $class->SUPER::new(@_); $this->prefer_out_of_source_building(@_); $this->{has_ndk} = $this->has_build_dep("libnginx-mod-http-ndk-dev"); - if ($this->{has_ndk} == 1){ - foreach my $cur (getpackages('arch')) { + foreach my $cur (getpackages('arch')) { + if ($this->{has_ndk} == 1) { addsubstvar($cur, "misc:Depends", "libnginx-mod-http-ndk"); } } diff --git a/debian/nginx-dev.install b/debian/nginx-dev.install index efc1578..250b101 100644 --- a/debian/nginx-dev.install +++ b/debian/nginx-dev.install @@ -2,6 +2,7 @@ debian/build-src/auto usr/share/nginx/src/ debian/build-src/src usr/share/nginx/src/ debian/build-src/conf_flags usr/share/nginx/src/ debian/build-src/configure usr/share/nginx/src/ +debian/build-src/debian/libnginx-mod.substvars usr/share/nginx/src/debian/ debian/debhelper/nginx.pm usr/share/perl5/Debian/Debhelper/Sequence/ debian/debhelper/dh_nginx usr/bin/ debian/debhelper/nginx_mod.pm usr/share/perl5/Debian/Debhelper/Buildsystem/ diff --git a/debian/rules b/debian/rules index c852729..2f09854 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,16 @@ #!/usr/bin/make -f export DH_VERBOSE=1 +include /usr/share/dpkg/pkg-info.mk + export DEB_BUILD_MAINT_OPTIONS=hardening=+all + +# increase this value when DEB_VERSION_UPSTREAM is the same and ABI breaks because: +# - a patch might change it +# - a build-dependency has changed +# note that debian revision can increase without breaking ABI +nginx_abi = $(DEB_VERSION_UPSTREAM)-1 + debian_cflags:=$(shell dpkg-buildflags --get CFLAGS) -fPIC $(shell dpkg-buildflags --get CPPFLAGS) debian_ldflags:=$(shell dpkg-buildflags --get LDFLAGS) -fPIC @@ -123,6 +132,9 @@ override_dh_installsystemd: override_dh_installlogrotate: dh_installlogrotate --package nginx-common --name=nginx +override_dh_gencontrol: + dh_gencontrol -- -Tdebian/substvars -T$(BUILDDIR_src)/debian/libnginx-mod.substvars + build.arch.%: $(MAKE) -C $(BUILDDIR_$*) build @@ -133,6 +145,8 @@ build.src: if [ -e $(CURDIR)/configure ]; then cp $(CURDIR)/configure $(BUILDDIR_src)/; fi echo "NGX_CONF_FLAGS=(" $(basic_configure_flags) ")" > $(BUILDDIR_src)/conf_flags pod2man debian/debhelper/dh_nginx > $(BUILDDIR_src)/dh_nginx.1 + mkdir -p $(BUILDDIR_src)/debian + echo "nginx:abi=$(nginx_abi)" > $(BUILDDIR_src)/debian/libnginx-mod.substvars strip.arch.%: dh_strip --package=nginx-$(*) -O--dbgsym-migration='nginx-$(*)-dbg (<< 1.10.1-3~)'