1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
#!/usr/bin/make -f
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
debian_cflags:=$(shell dpkg-buildflags --get CFLAGS) -fPIC $(shell dpkg-buildflags --get CPPFLAGS)
debian_ldflags:=$(shell dpkg-buildflags --get LDFLAGS) -fPIC
FLAVOURS := core light extras
DYN_MODS := \
http-auth-pam \
http-cache-purge \
http-dav-ext \
http-echo \
http-fancyindex \
http-geoip \
http-geoip2 \
http-headers-more-filter \
http-image-filter \
http-lua \
http-ndk \
http-perl \
http-subs-filter \
http-uploadprogress \
http-upstream-fair \
http-xslt-filter \
mail \
nchan \
rtmp \
stream \
stream-geoip \
stream-geoip2
MODULESDIR = $(CURDIR)/debian/modules
BASEDIR = $(CURDIR)
$(foreach flavour,$(FLAVOURS),$(eval BUILDDIR_$(flavour) = $(CURDIR)/debian/build-$(flavour)))
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)))
MAKEFLAGS += -j$(NUMJOBS)
endif
MODULESPATCHDIR = $(CURDIR)/debian/modules/patches
modules_with_patches := $(notdir $(wildcard $(CURDIR)/debian/modules/patches/*))
# 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 \
--modules-path=/usr/lib/nginx/modules \
--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-compat \
--with-debug \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads
light_configure_flags := \
$(common_configure_flags) \
--with-http_gzip_static_module \
--without-http_browser_module \
--without-http_geo_module \
--without-http_limit_req_module \
--without-http_limit_conn_module \
--without-http_memcached_module \
--without-http_referer_module \
--without-http_split_clients_module \
--without-http_userid_module
core_configure_flags := \
$(common_configure_flags) \
--with-http_addition_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_sub_module \
extras_configure_flags := \
$(common_configure_flags) \
--with-http_addition_module \
--with-http_flv_module \
--with-http_geoip_module=dynamic \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module=dynamic \
--with-http_mp4_module \
--with-http_perl_module=dynamic \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_sub_module \
--with-http_xslt_module=dynamic \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-stream=dynamic \
--with-stream_geoip_module=dynamic \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--add-dynamic-module=$(MODULESDIR)/http-headers-more-filter \
--add-dynamic-module=$(MODULESDIR)/http-auth-pam \
--add-dynamic-module=$(MODULESDIR)/http-cache-purge \
--add-dynamic-module=$(MODULESDIR)/http-dav-ext \
--add-dynamic-module=$(MODULESDIR)/http-ndk \
--add-dynamic-module=$(MODULESDIR)/http-echo \
--add-dynamic-module=$(MODULESDIR)/http-fancyindex \
--add-dynamic-module=$(MODULESDIR)/http-geoip2 \
--add-dynamic-module=$(MODULESDIR)/nchan \
--add-dynamic-module=$(MODULESDIR)/http-lua \
--add-dynamic-module=$(MODULESDIR)/rtmp \
--add-dynamic-module=$(MODULESDIR)/http-uploadprogress \
--add-dynamic-module=$(MODULESDIR)/http-upstream-fair \
--add-dynamic-module=$(MODULESDIR)/http-subs-filter
%:
dh $@ --without autoreconf
override_dh_auto_configure: config_patch_modules $(foreach flavour,$(FLAVOURS),config.arch.$(flavour))
override_dh_auto_build: $(foreach flavour,$(FLAVOURS),build.arch.$(flavour))
override_dh_strip: $(foreach flavour,$(FLAVOURS),strip.arch.$(flavour)) $(foreach mod,$(DYN_MODS),strip.mods.$(mod))
override_dh_clean: clean_patch_modules $(foreach flavour,$(FLAVOURS),clean.$(flavour))
dh_clean
override_dh_install:
dh_install
DH_AUTOSCRIPTDIR=$(CURDIR)/debian/autoscripts debian/dh_nginx
override_dh_installinit:
dh_installinit --no-stop-on-upgrade --no-start --name=nginx
override_dh_installsystemd:
dh_installsystemd --name=nginx
override_dh_installlogrotate:
dh_installlogrotate --package nginx-common --name=nginx
build.arch.%:
$(MAKE) -C $(BUILDDIR_$*) build
strip.arch.%:
dh_strip --package=nginx-$(*) -O--dbgsym-migration='nginx-$(*)-dbg (<< 1.10.1-3~)'
strip.mods.%:
dh_strip --package=libnginx-mod-$(*) -O--automatic-dbgsym
config_patch_modules: $(foreach mod,$(modules_with_patches),config.patch.$(mod))
config.patch.%:
cd $(MODULESDIR)/$* && QUILT_PATCHES=$(MODULESPATCHDIR)/$* quilt push -a
clean_patch_modules: $(foreach mod,$(modules_with_patches),clean.patch.$(mod))
clean.patch.%:
if [ -s $(MODULESDIR)/$*/.pc/applied-patches ]; then \
cd $(MODULESDIR)/$* && QUILT_PATCHES=$(MODULESPATCHDIR)/$* quilt pop -q -a; \
rm -rf $(MODULESDIR)/$*/.pc; \
fi
config.arch.%:
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_$*)/
cd $(BUILDDIR_$*) && ./configure $($*_configure_flags)
clean.%:
rm -rf $(BUILDDIR_$*)
.PHONY: config_patch_modules clean_patch_modules
|