/[gentoo-x86]/www-servers/nginx/nginx-1.1.18.ebuild
Gentoo

Contents of /www-servers/nginx/nginx-1.1.18.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Apr 13 15:16:46 2012 UTC (2 years, 6 months ago) by darkside
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Version bump from upstream (security bug 411751), addition of fancyindex third party module (bug 411663). Cleanup metadata.xml

(Portage version: 2.1.10.44/cvs/Linux i686)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/nginx-1.1.18.ebuild,v 1.1 2012/04/10 04:04:21 patrick Exp $
4
5 EAPI="4"
6
7 # Maintainer notes:
8 # - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
9 # - any http-module activates the main http-functionality and overrides USE=-http
10 # - keep the following requirements in mind before adding external modules:
11 # * alive upstream
12 # * sane packaging
13 # * builds cleanly
14 # * does not need a patch for nginx core
15 # - TODO: test the google-perftools module (included in vanilla tarball)
16
17 # prevent perl-module from adding automagic perl DEPENDs
18 GENTOO_DEPEND_ON_PERL="no"
19
20 # http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
21 HTTP_UPLOAD_PROGRESS_MODULE_PV="0.8.4"
22 HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
23 HTTP_UPLOAD_PROGRESS_MODULE_SHA1="82b35fc"
24 HTTP_UPLOAD_PROGRESS_MODULE_URI="http://github.com/masterzen/nginx-upload-progress-module/tarball/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
25
26 # http_headers_more (http://github.com/agentzh/headers-more-nginx-module, BSD license)
27 HTTP_HEADERS_MORE_MODULE_PV="0.16"
28 HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
29 HTTP_HEADERS_MORE_MODULE_SHA1="de77fd2"
30 HTTP_HEADERS_MORE_MODULE_URI="http://github.com/agentzh/headers-more-nginx-module/tarball/v${HTTP_HEADERS_MORE_MODULE_PV}"
31
32 # http_push (http://pushmodule.slact.net/, MIT license)
33 HTTP_PUSH_MODULE_PV="0.692"
34 HTTP_PUSH_MODULE_P="nginx_http_push_module-${HTTP_PUSH_MODULE_PV}"
35 HTTP_PUSH_MODULE_URI="http://pushmodule.slact.net/downloads/${HTTP_PUSH_MODULE_P}.tar.gz"
36
37 # http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, BSD-2 license)
38 HTTP_CACHE_PURGE_MODULE_PV="1.5"
39 HTTP_CACHE_PURGE_MODULE_P="ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
40 HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/${HTTP_CACHE_PURGE_MODULE_P}.tar.gz"
41
42 # HTTP Upload module from Valery Kholodkov
43 # (http://www.grid.net.ru/nginx/upload.en.html, BSD license)
44 HTTP_UPLOAD_MODULE_PV="2.2.0"
45 HTTP_UPLOAD_MODULE_P="nginx_upload_module-${HTTP_UPLOAD_MODULE_PV}"
46 HTTP_UPLOAD_MODULE_URI="http://www.grid.net.ru/nginx/download/${HTTP_UPLOAD_MODULE_P}.tar.gz"
47
48 # http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
49 HTTP_SLOWFS_CACHE_MODULE_PV="1.6"
50 HTTP_SLOWFS_CACHE_MODULE_P="ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
51 HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz"
52
53 inherit eutils ssl-cert toolchain-funcs perl-module flag-o-matic
54
55 DESCRIPTION="Robust, small and high performance http and reverse proxy server"
56 HOMEPAGE="http://nginx.org"
57 SRC_URI="http://nginx.org/download/${P}.tar.gz
58 nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
59 nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
60 nginx_modules_http_push? ( ${HTTP_PUSH_MODULE_URI} )
61 nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} )
62 nginx_modules_http_upload? ( ${HTTP_UPLOAD_MODULE_URI} )
63 nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} )"
64
65 LICENSE="as-is BSD BSD-2 GPL-2 MIT"
66 SLOT="0"
67 KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"
68
69 NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif fastcgi
70 geo gzip limit_req limit_zone map memcached proxy referer rewrite scgi ssi
71 split_clients upstream_ip_hash userid uwsgi"
72 NGINX_MODULES_OPT="addition dav degradation flv geoip gzip_static image_filter
73 mp4 perl random_index realip secure_link stub_status sub xslt"
74 NGINX_MODULES_MAIL="imap pop3 smtp"
75 NGINX_MODULES_3RD="
76 http_upload_progress
77 http_headers_more
78 http_passenger
79 http_push
80 http_cache_purge
81 http_upload
82 http_slowfs_cache"
83
84 IUSE="aio debug +http +http-cache ipv6 libatomic +pcre pcre-jit ssl vim-syntax"
85
86 for mod in $NGINX_MODULES_STD; do
87 IUSE="${IUSE} +nginx_modules_http_${mod}"
88 done
89
90 for mod in $NGINX_MODULES_OPT; do
91 IUSE="${IUSE} nginx_modules_http_${mod}"
92 done
93
94 for mod in $NGINX_MODULES_MAIL; do
95 IUSE="${IUSE} nginx_modules_mail_${mod}"
96 done
97
98 for mod in $NGINX_MODULES_3RD; do
99 IUSE="${IUSE} nginx_modules_${mod}"
100 done
101
102 CDEPEND="
103 pcre? ( >=dev-libs/libpcre-4.2 )
104 ssl? ( dev-libs/openssl )
105 http-cache? ( userland_GNU? ( dev-libs/openssl ) )
106 nginx_modules_http_geo? ( dev-libs/geoip )
107 nginx_modules_http_gzip? ( sys-libs/zlib )
108 nginx_modules_http_gzip_static? ( sys-libs/zlib )
109 nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
110 nginx_modules_http_perl? ( >=dev-lang/perl-5.8 )
111 nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
112 nginx_modules_http_secure_link? ( userland_GNU? ( dev-libs/openssl ) )
113 nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )"
114 RDEPEND="${CDEPEND}"
115 DEPEND="${CDEPEND}
116 arm? ( dev-libs/libatomic_ops )
117 libatomic? ( dev-libs/libatomic_ops )"
118 PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
119 REQUIRED_USE="pcre-jit? ( pcre )"
120
121 pkg_setup() {
122 if use nginx_modules_http_passenger; then
123 einfo
124 einfo "Passenger support has been removed from the nginx ebuild to"
125 einfo "get rid of file collisions, its broken build system and"
126 einfo "incompatibilities between passenger 2 and 3."
127 einfo
128 einfo "Please switch to passenger-3 standalone or use the"
129 einfo "unicorn gem which provides a sane nginx-like architecture"
130 einfo "out of the box."
131 einfo
132 einfo "For more information on sane ruby deployments with"
133 einfo "passenger-3/unicorn go to:"
134 einfo
135 einfo "https://rvm.beginrescueend.com"
136 einfo
137 die "nginx_modules_http_passenger still in IUSE"
138 fi
139
140 ebegin "Creating nginx user and group"
141 enewgroup ${PN}
142 enewuser ${PN} -1 -1 -1 ${PN}
143 eend $?
144
145 if use libatomic; then
146 ewarn "GCC 4.1+ features built-in atomic operations."
147 ewarn "Using libatomic_ops is only needed if using"
148 ewarn "a different compiler or a GCC prior to 4.1"
149 fi
150
151 if [[ -n $NGINX_ADD_MODULES ]]; then
152 ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
153 ewarn "This nginx installation is not supported!"
154 ewarn "Make sure you can reproduce the bug without those modules"
155 ewarn "_before_ reporting bugs."
156 fi
157
158 if use !http; then
159 ewarn "To actually disable all http-functionality you also have to disable"
160 ewarn "all nginx http modules."
161 fi
162 }
163
164 src_prepare() {
165 sed -i 's/ make/ \\$(MAKE)/' "${S}"/auto/lib/perl/make
166 }
167
168 src_configure() {
169 local myconf= http_enabled= mail_enabled=
170
171 use aio && myconf+=" --with-file-aio --with-aio_module"
172 use debug && myconf+=" --with-debug"
173 use ipv6 && myconf+=" --with-ipv6"
174 use libatomic && myconf+=" --with-libatomic"
175 use pcre && myconf+=" --with-pcre"
176 use pcre-jit && myconf+=" --with-pcre-jit"
177
178 # HTTP modules
179 for mod in $NGINX_MODULES_STD; do
180 if use nginx_modules_http_${mod}; then
181 http_enabled=1
182 else
183 myconf+=" --without-http_${mod}_module"
184 fi
185 done
186
187 for mod in $NGINX_MODULES_OPT; do
188 if use nginx_modules_http_${mod}; then
189 http_enabled=1
190 myconf+=" --with-http_${mod}_module"
191 fi
192 done
193
194 if use nginx_modules_http_fastcgi; then
195 myconf+=" --with-http_realip_module"
196 fi
197
198 # third-party modules
199 if use nginx_modules_http_upload_progress; then
200 http_enabled=1
201 myconf+=" --add-module=${WORKDIR}/masterzen-nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_SHA1}"
202 fi
203
204 if use nginx_modules_http_headers_more; then
205 http_enabled=1
206 myconf+=" --add-module=${WORKDIR}/agentzh-headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_SHA1}"
207 fi
208
209 if use nginx_modules_http_push; then
210 http_enabled=1
211 myconf+=" --add-module=${WORKDIR}/${HTTP_PUSH_MODULE_P}"
212 fi
213
214 if use nginx_modules_http_cache_purge; then
215 http_enabled=1
216 myconf+=" --add-module=${WORKDIR}/${HTTP_CACHE_PURGE_MODULE_P}"
217 fi
218
219 if use nginx_modules_http_upload; then
220 http_enabled=1
221 myconf+=" --add-module=${WORKDIR}/${HTTP_UPLOAD_MODULE_P}"
222 fi
223
224 if use nginx_modules_http_slowfs_cache; then
225 http_enabled=1
226 myconf+=" --add-module=${WORKDIR}/${HTTP_SLOWFS_CACHE_MODULE_P}"
227 fi
228
229 if use http || use http-cache; then
230 http_enabled=1
231 fi
232
233 if [ $http_enabled ]; then
234 use http-cache || myconf+=" --without-http-cache"
235 use ssl && myconf+=" --with-http_ssl_module"
236 else
237 myconf+=" --without-http --without-http-cache"
238 fi
239
240 # MAIL modules
241 for mod in $NGINX_MODULES_MAIL; do
242 if use nginx_modules_mail_${mod}; then
243 mail_enabled=1
244 else
245 myconf+=" --without-mail_${mod}_module"
246 fi
247 done
248
249 if [ $mail_enabled ]; then
250 myconf+=" --with-mail"
251 use ssl && myconf+=" --with-mail_ssl_module"
252 fi
253
254 # custom modules
255 for mod in $NGINX_ADD_MODULES; do
256 myconf+=" --add-module=${mod}"
257 done
258
259 # https://bugs.gentoo.org/286772
260 export LANG=C LC_ALL=C
261 tc-export CC
262
263 ./configure \
264 --prefix=/usr \
265 --sbin-path=/usr/sbin/nginx \
266 --conf-path=/etc/${PN}/${PN}.conf \
267 --error-log-path=/var/log/${PN}/error_log \
268 --pid-path=/var/run/${PN}.pid \
269 --lock-path=/var/lock/nginx.lock \
270 --user=${PN} --group=${PN} \
271 --with-cc-opt="-I${ROOT}usr/include" \
272 --with-ld-opt="-L${ROOT}usr/lib" \
273 --http-log-path=/var/log/${PN}/access_log \
274 --http-client-body-temp-path=/var/tmp/${PN}/client \
275 --http-proxy-temp-path=/var/tmp/${PN}/proxy \
276 --http-fastcgi-temp-path=/var/tmp/${PN}/fastcgi \
277 --http-scgi-temp-path=/var/tmp/${PN}/scgi \
278 --http-uwsgi-temp-path=/var/tmp/${PN}/uwsgi \
279 ${myconf} || die "configure failed"
280 }
281
282 src_compile() {
283 # https://bugs.gentoo.org/286772
284 export LANG=C LC_ALL=C
285 emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}" || die "emake failed"
286 }
287
288 src_install() {
289 keepdir /var/log/${PN} /var/tmp/${PN}/{client,proxy,fastcgi,scgi,uwsgi}
290 keepdir /var/www/localhost/htdocs
291
292 dosbin objs/nginx
293 newinitd "${FILESDIR}"/nginx.initd nginx
294
295 cp "${FILESDIR}"/nginx.conf conf/nginx.conf
296 rm conf/win-utf conf/koi-win conf/koi-utf
297
298 dodir /etc/${PN}
299 insinto /etc/${PN}
300 doins conf/*
301
302 doman man/nginx.8
303 dodoc CHANGES* README
304
305 # logrotate
306 insinto /etc/logrotate.d
307 newins "${FILESDIR}"/nginx.logrotate nginx
308
309 if use nginx_modules_http_perl; then
310 cd "${S}"/objs/src/http/modules/perl/
311 einstall DESTDIR="${D}" INSTALLDIRS=vendor || die "failed to install perl stuff"
312 fixlocalpod
313 fi
314
315 if use nginx_modules_http_push; then
316 docinto ${HTTP_PUSH_MODULE_P}
317 dodoc "${WORKDIR}"/${HTTP_PUSH_MODULE_P}/{changelog.txt,protocol.txt,README}
318 fi
319
320 if use nginx_modules_http_cache_purge; then
321 docinto ${HTTP_CACHE_PURGE_MODULE_P}
322 dodoc "${WORKDIR}"/${HTTP_CACHE_PURGE_MODULE_P}/{CHANGES,README.md,TODO.md}
323 fi
324
325 if use nginx_modules_http_upload; then
326 docinto ${HTTP_UPLOAD_MODULE_P}
327 dodoc "${WORKDIR}"/${HTTP_UPLOAD_MODULE_P}/{Changelog,README}
328 fi
329
330 if use nginx_modules_http_slowfs_cache; then
331 docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
332 dodoc "${WORKDIR}"/${HTTP_SLOWFS_CACHE_MODULE_P}/{CHANGES,README}
333 fi
334 }
335
336 pkg_postinst() {
337 if use ssl; then
338 if [ ! -f "${ROOT}"/etc/ssl/${PN}/${PN}.key ]; then
339 install_cert /etc/ssl/${PN}/${PN}
340 chown ${PN}:${PN} "${ROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
341 fi
342 fi
343 }

  ViewVC Help
Powered by ViewVC 1.1.20