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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Jun 12 13:09:23 2012 UTC (11 months, 1 week ago) by ago
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Remove old

(Portage version: 2.1.10.49/cvs/Linux x86_64)

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.2.0.ebuild,v 1.2 2012/06/06 08:30:35 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.9.0"
22 HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
23 HTTP_UPLOAD_PROGRESS_MODULE_SHA1="a788dea"
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.17rc1"
28 HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
29 HTTP_HEADERS_MORE_MODULE_SHA1="3580526"
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.8"
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 # http_fancyindex_module (http://wiki.nginx.org/NgxFancyIndex, BSD license)
54 HTTP_FANCYINDEX_MODULE_PV="0.3.1"
55 HTTP_FANCYINDEX_MODULE_PN="ngx-fancyindex"
56 # gitorious names the tarbell oddly, hence PNPN
57 HTTP_FANCYINDEX_MODULE_PNPN="ngx-fancyindex-ngx-fancyindex"
58 HTTP_FANCYINDEX_MODULE_P="${HTTP_FANCYINDEX_MODULE_PN}-${HTTP_FANCYINDEX_MODULE_PV}"
59 HTTP_FANCYINDEX_MODULE_URI="http://gitorious.org/${HTTP_FANCYINDEX_MODULE_PN}/${HTTP_FANCYINDEX_MODULE_PN}/archive-tarball/v${HTTP_FANCYINDEX_MODULE_PV}"
60
61 inherit eutils ssl-cert toolchain-funcs perl-module flag-o-matic user
62
63 DESCRIPTION="Robust, small and high performance http and reverse proxy server"
64 HOMEPAGE="http://nginx.org"
65 SRC_URI="http://nginx.org/download/${P}.tar.gz
66 nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
67 nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
68 nginx_modules_http_push? ( ${HTTP_PUSH_MODULE_URI} )
69 nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} )
70 nginx_modules_http_upload? ( ${HTTP_UPLOAD_MODULE_URI} )
71 nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} )
72 nginx_modules_http_fancyindex? ( ${HTTP_FANCYINDEX_MODULE_URI} -> ${HTTP_FANCYINDEX_MODULE_P}.tar.gz )"
73
74 LICENSE="as-is BSD BSD-2 GPL-2 MIT"
75 SLOT="0"
76 KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
77
78 NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif fastcgi
79 geo gzip limit_req limit_zone map memcached proxy referer rewrite scgi ssi
80 split_clients upstream_ip_hash userid uwsgi"
81 NGINX_MODULES_OPT="addition dav degradation flv geoip gzip_static image_filter
82 mp4 perl random_index realip secure_link stub_status sub xslt"
83 NGINX_MODULES_MAIL="imap pop3 smtp"
84 NGINX_MODULES_3RD="
85 http_upload_progress
86 http_headers_more
87 http_passenger
88 http_push
89 http_cache_purge
90 http_upload
91 http_slowfs_cache
92 http_fancyindex"
93
94 IUSE="aio debug +http +http-cache ipv6 libatomic +pcre pcre-jit selinux ssl vim-syntax"
95
96 for mod in $NGINX_MODULES_STD; do
97 IUSE="${IUSE} +nginx_modules_http_${mod}"
98 done
99
100 for mod in $NGINX_MODULES_OPT; do
101 IUSE="${IUSE} nginx_modules_http_${mod}"
102 done
103
104 for mod in $NGINX_MODULES_MAIL; do
105 IUSE="${IUSE} nginx_modules_mail_${mod}"
106 done
107
108 for mod in $NGINX_MODULES_3RD; do
109 IUSE="${IUSE} nginx_modules_${mod}"
110 done
111
112 CDEPEND="
113 pcre? ( >=dev-libs/libpcre-4.2 )
114 selinux? ( sec-policy/selinux-nginx )
115 ssl? ( dev-libs/openssl )
116 http-cache? ( userland_GNU? ( dev-libs/openssl ) )
117 nginx_modules_http_geo? ( dev-libs/geoip )
118 nginx_modules_http_gzip? ( sys-libs/zlib )
119 nginx_modules_http_gzip_static? ( sys-libs/zlib )
120 nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
121 nginx_modules_http_perl? ( >=dev-lang/perl-5.8 )
122 nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
123 nginx_modules_http_secure_link? ( userland_GNU? ( dev-libs/openssl ) )
124 nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )"
125 RDEPEND="${CDEPEND}"
126 DEPEND="${CDEPEND}
127 arm? ( dev-libs/libatomic_ops )
128 libatomic? ( dev-libs/libatomic_ops )"
129 PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
130 REQUIRED_USE="pcre-jit? ( pcre )"
131
132 pkg_setup() {
133 if use nginx_modules_http_passenger; then
134 einfo
135 einfo "Passenger support has been removed from the nginx ebuild to"
136 einfo "get rid of file collisions, its broken build system and"
137 einfo "incompatibilities between passenger 2 and 3."
138 einfo
139 einfo "Please switch to passenger-3 standalone or use the"
140 einfo "unicorn gem which provides a sane nginx-like architecture"
141 einfo "out of the box."
142 einfo
143 einfo "For more information on sane ruby deployments with"
144 einfo "passenger-3/unicorn go to:"
145 einfo
146 einfo "https://rvm.beginrescueend.com"
147 einfo
148 die "nginx_modules_http_passenger still in IUSE"
149 fi
150
151 ebegin "Creating nginx user and group"
152 enewgroup ${PN}
153 enewuser ${PN} -1 -1 -1 ${PN}
154 eend $?
155
156 if use libatomic; then
157 ewarn "GCC 4.1+ features built-in atomic operations."
158 ewarn "Using libatomic_ops is only needed if using"
159 ewarn "a different compiler or a GCC prior to 4.1"
160 fi
161
162 if [[ -n $NGINX_ADD_MODULES ]]; then
163 ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
164 ewarn "This nginx installation is not supported!"
165 ewarn "Make sure you can reproduce the bug without those modules"
166 ewarn "_before_ reporting bugs."
167 fi
168
169 if use !http; then
170 ewarn "To actually disable all http-functionality you also have to disable"
171 ewarn "all nginx http modules."
172 fi
173 }
174
175 src_prepare() {
176 find auto/ -type f -print0 | xargs -0 sed -i 's:\&\& make:\&\& \\$(MAKE):' || die
177 # We have config protection, don't rename etc files
178 sed -i 's:.default::' auto/install || die
179 # remove useless files
180 sed -i -e '/koi-/d' -e '/win-/d' auto/install || die
181 }
182
183 src_configure() {
184 local myconf= http_enabled= mail_enabled=
185
186 use aio && myconf+=" --with-file-aio --with-aio_module"
187 use debug && myconf+=" --with-debug"
188 use ipv6 && myconf+=" --with-ipv6"
189 use libatomic && myconf+=" --with-libatomic"
190 use pcre && myconf+=" --with-pcre"
191 use pcre-jit && myconf+=" --with-pcre-jit"
192
193 # HTTP modules
194 for mod in $NGINX_MODULES_STD; do
195 if use nginx_modules_http_${mod}; then
196 http_enabled=1
197 else
198 myconf+=" --without-http_${mod}_module"
199 fi
200 done
201
202 for mod in $NGINX_MODULES_OPT; do
203 if use nginx_modules_http_${mod}; then
204 http_enabled=1
205 myconf+=" --with-http_${mod}_module"
206 fi
207 done
208
209 if use nginx_modules_http_fastcgi; then
210 myconf+=" --with-http_realip_module"
211 fi
212
213 # third-party modules
214 if use nginx_modules_http_upload_progress; then
215 http_enabled=1
216 myconf+=" --add-module=${WORKDIR}/masterzen-nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_SHA1}"
217 fi
218
219 if use nginx_modules_http_headers_more; then
220 http_enabled=1
221 myconf+=" --add-module=${WORKDIR}/agentzh-headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_SHA1}"
222 fi
223
224 if use nginx_modules_http_push; then
225 http_enabled=1
226 myconf+=" --add-module=${WORKDIR}/${HTTP_PUSH_MODULE_P}"
227 fi
228
229 if use nginx_modules_http_cache_purge; then
230 http_enabled=1
231 myconf+=" --add-module=${WORKDIR}/${HTTP_CACHE_PURGE_MODULE_P}"
232 fi
233
234 if use nginx_modules_http_upload; then
235 http_enabled=1
236 myconf+=" --add-module=${WORKDIR}/${HTTP_UPLOAD_MODULE_P}"
237 fi
238
239 if use nginx_modules_http_slowfs_cache; then
240 http_enabled=1
241 myconf+=" --add-module=${WORKDIR}/${HTTP_SLOWFS_CACHE_MODULE_P}"
242 fi
243
244 if use nginx_modules_http_fancyindex; then
245 http_enabled=1
246 myconf+=" --add-module=${WORKDIR}/${HTTP_FANCYINDEX_MODULE_PNPN}"
247 fi
248
249 if use http || use http-cache; then
250 http_enabled=1
251 fi
252
253 if [ $http_enabled ]; then
254 use http-cache || myconf+=" --without-http-cache"
255 use ssl && myconf+=" --with-http_ssl_module"
256 else
257 myconf+=" --without-http --without-http-cache"
258 fi
259
260 # MAIL modules
261 for mod in $NGINX_MODULES_MAIL; do
262 if use nginx_modules_mail_${mod}; then
263 mail_enabled=1
264 else
265 myconf+=" --without-mail_${mod}_module"
266 fi
267 done
268
269 if [ $mail_enabled ]; then
270 myconf+=" --with-mail"
271 use ssl && myconf+=" --with-mail_ssl_module"
272 fi
273
274 # custom modules
275 for mod in $NGINX_ADD_MODULES; do
276 myconf+=" --add-module=${mod}"
277 done
278
279 # https://bugs.gentoo.org/286772
280 export LANG=C LC_ALL=C
281 tc-export CC
282
283 if ! use prefix; then
284 myconf+=" --user=${PN} --group=${PN}"
285 fi
286
287 ./configure \
288 --prefix="${EPREFIX}"/usr \
289 --conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
290 --error-log-path="${EPREFIX}"/var/log/${PN}/error_log \
291 --pid-path="${EPREFIX}"/var/run/${PN}.pid \
292 --lock-path="${EPREFIX}"/var/lock/nginx.lock \
293 --with-cc-opt="-I${EROOT}usr/include" \
294 --with-ld-opt="-L${EROOT}usr/lib" \
295 --http-log-path="${EPREFIX}"/var/log/${PN}/access_log \
296 --http-client-body-temp-path="${EPREFIX}"/var/tmp/${PN}/client \
297 --http-proxy-temp-path="${EPREFIX}"/var/tmp/${PN}/proxy \
298 --http-fastcgi-temp-path="${EPREFIX}"/var/tmp/${PN}/fastcgi \
299 --http-scgi-temp-path="${EPREFIX}"/var/tmp/${PN}/scgi \
300 --http-uwsgi-temp-path="${EPREFIX}"/var/tmp/${PN}/uwsgi \
301 ${myconf} || die "configure failed"
302 }
303
304 src_compile() {
305 # https://bugs.gentoo.org/286772
306 export LANG=C LC_ALL=C
307 emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}"
308 }
309
310 src_install() {
311 emake DESTDIR="${D}" install
312 cp "${FILESDIR}"/nginx.conf "${ED}"/etc/nginx/nginx.conf || die
313 newinitd "${FILESDIR}"/nginx.initd nginx
314 doman man/nginx.8
315 dodoc CHANGES* README
316
317 # Keepdir because these are hardcoded above
318 keepdir /var/log/${PN} /var/tmp/${PN}/{client,proxy,fastcgi,scgi,uwsgi}
319 keepdir /var/www/localhost/htdocs
320 mv "${ED}"/usr/html "${ED}"/var/www/localhost/htdocs || die
321
322 # logrotate
323 insinto /etc/logrotate.d
324 newins "${FILESDIR}"/nginx.logrotate nginx
325
326 if use nginx_modules_http_perl; then
327 cd "${S}"/objs/src/http/modules/perl/
328 einstall DESTDIR="${D}" INSTALLDIRS=vendor
329 fixlocalpod
330 fi
331
332 if use nginx_modules_http_push; then
333 docinto ${HTTP_PUSH_MODULE_P}
334 dodoc "${WORKDIR}"/${HTTP_PUSH_MODULE_P}/{changelog.txt,protocol.txt,README}
335 fi
336
337 if use nginx_modules_http_cache_purge; then
338 docinto ${HTTP_CACHE_PURGE_MODULE_P}
339 dodoc "${WORKDIR}"/${HTTP_CACHE_PURGE_MODULE_P}/{CHANGES,README.md,TODO.md}
340 fi
341
342 if use nginx_modules_http_upload; then
343 docinto ${HTTP_UPLOAD_MODULE_P}
344 dodoc "${WORKDIR}"/${HTTP_UPLOAD_MODULE_P}/{Changelog,README}
345 fi
346
347 if use nginx_modules_http_slowfs_cache; then
348 docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
349 dodoc "${WORKDIR}"/${HTTP_SLOWFS_CACHE_MODULE_P}/{CHANGES,README.md}
350 fi
351
352 if use nginx_modules_http_fancyindex; then
353 docinto ${HTTP_FANCYINDEX_MODULE_P}
354 dodoc "${WORKDIR}"/${HTTP_FANCYINDEX_MODULE_PNPN}/README.rst
355 fi
356 }
357
358 pkg_postinst() {
359 if use ssl; then
360 if [ ! -f "${EROOT}"/etc/ssl/${PN}/${PN}.key ]; then
361 install_cert /etc/ssl/${PN}/${PN}
362 use prefix || chown ${PN}:${PN} "${EROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
363 fi
364 fi
365 }

  ViewVC Help
Powered by ViewVC 1.1.13