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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Nov 26 08:12:12 2012 UTC (5 months, 4 weeks ago) by hollow
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
remove old versions and add some path checks to init script

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

  ViewVC Help
Powered by ViewVC 1.1.13