blob: 811d1de7b666b258c485d0067e4d2f4a9565ab66 [file] [log] [blame] [raw]
#!/usr/bin/make -f
debian_cflags:=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
debian_ldflags:=$(shell dpkg-buildflags --get LDFLAGS)
# export necessary for (hardening) flags for perl
# (src/http/modules/perl/Makefile.PL).
DEBIAN_NGINX_PERL_LDFLAGS:= $(debian_ldflags)
export DEBIAN_NGINX_PERL_LDFLAGS
FLAVOURS:=full light extras naxsi
BUILDDIR_full = $(CURDIR)/debian/build-full
BUILDDIR_light = $(CURDIR)/debian/build-light
BUILDDIR_extras = $(CURDIR)/debian/build-extras
BUILDDIR_naxsi = $(CURDIR)/debian/build-naxsi
MODULESDIR = $(CURDIR)/debian/modules
BASEDIR = $(CURDIR)
DEB_BUILD_ARCH ?=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
ifeq ($(DEB_BUILD_ARCH),sparc)
debian_cflags += -m32 -mcpu=ultrasparc
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
ifeq (${NUMJOBS}, 0)
NUMJOBS = 1
endif
else
NUMJOBS = 1
endif
# configure flags
common_configure_flags := \
--with-cc-opt="$(debian_cflags)" \
--with-ld-opt="$(debian_ldflags)" \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-debug \
--with-pcre-jit \
--with-ipv6 \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-polarssl=$(MODULESDIR)/polarssl \
config.env.%:
dh_testdir
mkdir -p $(BUILDDIR_$*)
cp -Pa $(CURDIR)/auto $(BUILDDIR_$*)/
cp -Pa $(CURDIR)/conf $(BUILDDIR_$*)/
cp -Pa $(CURDIR)/configure $(BUILDDIR_$*)/
cp -Pa $(CURDIR)/contrib $(BUILDDIR_$*)/
cp -Pa $(CURDIR)/src $(BUILDDIR_$*)/
cp -Pa $(CURDIR)/man $(BUILDDIR_$*)/
config.status.full: config.env.full
cd $(BUILDDIR_full) && ./configure \
$(common_configure_flags) \
--with-http_addition_module \
--with-http_dav_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_spdy_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-mail \
--with-mail_ssl_module \
--add-module=$(MODULESDIR)/nginx-auth-pam \
--add-module=$(MODULESDIR)/nginx-dav-ext-module \
--add-module=$(MODULESDIR)/nginx-echo \
--add-module=$(MODULESDIR)/ngx_http_substitutions_filter_module \
>$@
touch $@
config.status.light: config.env.light
cd $(BUILDDIR_light) && ./configure \
$(common_configure_flags) \
--with-http_gzip_static_module \
--without-http_browser_module \
--without-http_geo_module \
--without-http_limit_req_module \
--without-http_limit_zone_module \
--without-http_memcached_module \
--without-http_referer_module \
--without-http_scgi_module \
--without-http_split_clients_module \
--without-http_ssi_module \
--without-http_userid_module \
--without-http_uwsgi_module \
--add-module=$(MODULESDIR)/nginx-echo \
>$@
touch $@
config.status.extras: config.env.extras
cd $(BUILDDIR_extras) && ./configure \
$(common_configure_flags) \
--with-http_addition_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_mp4_module \
--with-http_perl_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_spdy_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-mail \
--with-mail_ssl_module \
--add-module=$(MODULESDIR)/headers-more-nginx-module \
--add-module=$(MODULESDIR)/nginx-auth-pam \
--add-module=$(MODULESDIR)/nginx-cache-purge \
--add-module=$(MODULESDIR)/nginx-dav-ext-module \
--add-module=$(MODULESDIR)/nginx-development-kit \
--add-module=$(MODULESDIR)/nginx-echo \
--add-module=$(MODULESDIR)/ngx-fancyindex \
--add-module=$(MODULESDIR)/nginx-http-push \
--add-module=$(MODULESDIR)/nginx-lua \
--add-module=$(MODULESDIR)/nginx-upload-progress \
--add-module=$(MODULESDIR)/ngx_http_substitutions_filter_module \
>$@
touch $@
config.status.naxsi: config.env.naxsi
cd $(BUILDDIR_naxsi) && ./configure \
$(common_configure_flags) \
--without-mail_pop3_module \
--without-mail_smtp_module \
--without-mail_imap_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--add-module=$(MODULESDIR)/naxsi/naxsi_src \
--add-module=$(MODULESDIR)/nginx-cache-purge \
>$@
touch $@
config.status.%:
echo "configuration for flavour $* not yet defined."
build-arch.%: config.status.%
dh_testdir
dh_prep
$(MAKE) -j$(NUMJOBS) -C $(BUILDDIR_$*) build
build-arch: $(foreach flavour,$(FLAVOURS),build-arch.$(flavour))
dh_testdir
touch $@
build-dbg.%: install
dh_testdir
dh_strip --package=nginx-polarssl-$(*) --dbg-package=nginx-polarssl-$(*)-dbg
build-dbg: $(foreach flavour,$(FLAVOURS),build-dbg.$(flavour))
dh_testdir
touch $@
build-indep:
build: build-indep build-arch
dh_testdir
touch $@
clean:
dh_testdir
dh_testroot
dh_clean
rm -rf $(CURDIR)/debian/build-*
install:
dh_testdir
dh_testroot
dh_prep
dh_installdirs
dh_install
binary-indep: build install
dh_testdir
dh_testroot
dh_installman -i
dh_installchangelogs -i -k CHANGES
dh_installdocs -i
dh_installdebconf
dh_installexamples -i
dh_systemd_enable --name=nginx
dh_installinit -i --no-restart-on-upgrade --no-start --name=nginx
dh_installinit -i --no-restart-on-upgrade --no-start --name=nginx-naxsi-ui
dh_systemd_start
dh_installlogrotate -i -pnginx-common --name=nginx
dh_link -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
binary-arch: install build-dbg
dh_testdir
dh_testroot
dh_installchangelogs -a -k CHANGES
dh_installdocs -a
dh_lintian -a
dh_link -aA
dh_compress -a
dh_perl -a
dh_fixperms -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install