LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File dba-nginx-180-stream.spec of Package dba-nginx-180-stream (Project home:csbuild:DBA)

%define real_name 	nginx
%define version		1.8.0
%define vers		180
%define prefix		/DBA/apache/NGX/%{version}
%define gemname		passenger
%define gemvers		4.0.59

%define with_ajp     0
%define with_lua     1
%define with_ruby    1
%define with_slowfs  1
%define with_spdy    1
%define with_stream  1

Name:           dba-nginx-%{vers}-stream
Summary:        A HTTP server and IMAP/POP3 proxy server 1.8.0
Version:        %{version}
Release:        1
AutoReqProv:    on
License:        BSD
Group:          Productivity/Networking/Web/Proxy
Url:            http://nginx.net/
Source:         http://sysoev.ru/nginx/nginx-%{version}.tar.gz
Source1:        nginx.init
Source2:        nginx-upload-progress.tar.gz
Source3:        nginx-upstream-fair.tar.gz
Source4:        ngx_supervisord.tar.gz
Source5:        ngx_cache_purge-2.3.tar.gz
Source6:        nginx_ajp_module.tgz
Source7:        nginx_upstream_check.tgz
Source9:        http://rubygems.org/downloads/%{gemname}-%{gemvers}.gem
Source10:       dba-nginx-rpmlintrc
Source11:       ngx_log_if.tgz
Source12:       nginx_accept_language_module.tgz
Source13:       http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Source14:       http://www.openssl.org/source/openssl-1.0.1m.tar.gz
Source15:       ngx_slowfs_cache-master.tgz
Source16:       lua-nginx-module-0.9.15.tar.gz
Source17:	set_nginx_1.8.latest.sh
Source18:	http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
Source19:	headers-more-nginx-module-0.26.tar.gz
Source20:	filter-requires-nginx.sh
Source21:	testcookie-nginx-module.tgz
Patch1:		nginx-remove-werror.patch
Patch2:		nginx-geoip.patch
Patch3:		nginx_upstream_check.patch
# http://hg.nginx.org/nginx/rev/61d7ae76647d
Patch4:		nginx-stream.patch
Patch5:		nginx-stream_2.patch
Patch6:		nginx-lock.patch
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%define _use_internal_dependency_generator 0
%define __find_requires %{SOURCE20}

#!BuildIgnore:  dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-101e dba-openssl-101f
#!BuildIgnore:  dba-libxml2-290

BuildRequires:  pkgconfig zlib-devel dos2unix patch openssl-devel
BuildRequires:	libxslt-devel libaio-devel libxml2-devel 
BuildRequires:	gcc-c++ pcre-devel 


%if 0%{?rhel_version} >= 401
%define with_ruby    0
%endif

%if 0%{?sles_version} == 10
%define with_ruby    0
%endif

%if 0%{?suse_version} >= 1300
%define with_ruby    0
%endif

%if 0%{?centos_version} >= 501 && 0%{?centos_version} < 600
%define with_ruby    0
%endif

%if 0%{?centos_version} >= 700
%define with_ruby    0
%endif

%if %{with_ruby}
BuildRequires:	rubygem-rake gcc-c++ libstdc++-devel curl-devel ruby-devel
Requires:	ruby
%define ruby_gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%define ruby_sitearchdir %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")
%endif

%if 0%{?fedora_version}
%define with_ruby    0
%endif

# %if 0%{?fedora_version} || 0%{?suse_version} >= 1200
%if 0%{?fedora_version}
%define with_geoip   0
%else
%define with_geoip   1
%endif

%if 0%{?rhel_version} >= 600
# gd-devel is optional in rhel6
%define with_gd      0
%else
%define with_gd      1
%endif

%if 0%{?sles_version} == 9
%define with_gd      0
%endif

%if 0%{?sles_version} >= 9
%define with_aio      0
%else
%define with_aio      1
%endif

# aio not compiling for CentOS5 i586 environment
%if 0%{?centos_version} >= 501 && 0%{?centos_version} < 600
%ifarch %ix86
%define with_aio      0
%endif
%endif

%if 0%{?rhel_version} == 406
%define with_aio      0
%define with_lua      0
%endif

%if %{with_lua}
BuildRequires:	dba-lua-515-static
%define luadir /DBA/lua/5.1.5
%endif

%if %{with_gd}
BuildRequires:	gd-devel
%endif

%if %{with_geoip}
BuildRequires:	dba-geoip-163-static
%define geodir /DBA/geoip/1.6.3
%endif

%if 0%{?suse_version}
Requires:  	pwdutils
BuildRequires:  pwdutils
%else
Requires:  	passwd
BuildRequires:  passwd
%endif

%if 0%{?suse_version} >= 1100
BuildRequires:          -post-build-checks
%endif


%description
nginx [engine x] is a HTTP server and IMAP/POP3 proxy server written by Igor Sysoev.
It has been running on many heavily loaded Russian sites for more than two years.


Authors:
--------
    Igor Sysoev


%if %{with_ruby}
%package ruby
Summary:        Ruby files for passenger module
Group:          Productivity/Networking/Web/Proxy
Requires:       %{name} = %{version}

%description ruby
Ruby files for passenger module

%endif

%prep
# %setup -n %{real_name}-%{version} -a 2 -a 3 -a 4 -a 5
%setup -n %{real_name}-%{version} -a 2 -a 3 -a 5 -a 6 -a 7 -a 11 -a 12 -a 14 -a 15 -a 16 -a 19
dos2unix contrib/geo2nginx.pl

# Remove -Werror flag due to compile errors with -Wunused-function and -Wunused-variable
# %{__perl} -pi.orig -e 's|-Werror||g' auto/cc/*

%{__chmod} +x %{SOURCE20}

%if %{with_ruby}
%if 0%{?sles_version} <= 11
pushd ../
gem unpack %{SOURCE9}
popd
%else
gem unpack %{SOURCE9} --target %{_builddir}
%endif
%endif

%if 0%{?suse_version} || 0%{?fedora_version}
%patch1 -p1
%endif
%if %{with_geoip}
%patch2 -p0
%endif

%if %{with_stream}
%patch4 -p1
%patch5 -p0
%patch6 -p1
%endif

# %if %{with_ajp}
# patch -p1 < ./nginx_ajp_module/ajp.patch
# %endif

pushd ./nginx-upstream-fair
patch -p1 < ../nginx_upstream_check/upstream_fair.patch
popd

# see https://github.com/yaoweibin/nginx_upstream_check_module
# patch -p1 < ./nginx_upstream_check/check_1.5.12+.patch
patch -p1 < ./nginx_upstream_check/check_1.7.5+.patch

%patch3 -p0

rm -f conf/*.orig


%build
%if %{with_geoip}
export CFLAGS='-I%{geodir}/include'
export LDFLAGS='-L%{geodir}/lib'
%endif
%if %{with_lua}
export LUA_LIB=%{luadir}/lib
export LUA_INC=%{luadir}/include
%endif

./configure \
  --prefix=%{prefix} \
  --with-openssl=./openssl-1.0.1m \
  --with-rtsig_module \
  --with-select_module \
  --with-poll_module \
  --with-http_ssl_module \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_auth_request_module \
%if %{with_gd}
  --with-http_image_filter_module \
%endif
  --with-http_sub_module \
  --with-http_gzip_static_module \
  --with-http_stub_status_module \
%if %{with_lua}
  --add-module=./lua-nginx-module-0.9.15 \
%endif
%if %{with_geoip}
  --with-http_geoip_module \
%endif
  --add-module=./nginx-upstream-fair \
  --add-module=./nginx-upload-progress \
  --add-module=./ngx_cache_purge-2.3 \
  --add-module=./nginx_upstream_check \
  --add-module=./ngx_log_if \
  --add-module=./nginx_accept_language_module \
%if %{with_stream}
  --with-stream \
  --with-stream_ssl_module \
%endif
%if %{with_ruby}
  --add-module=%{_builddir}/passenger-%{gemvers}/ext/nginx \
%endif
%if %{with_ajp}
  --add-module=./nginx_ajp_module \
%endif
  --add-module=./headers-more-nginx-module-0.26 \
  --with-imap \
%if %{with_aio}
  --with-file-aio \
%endif
%if %{with_spdy}
  --with-http_spdy_module \
%endif
  --with-http_gunzip_module \
  --with-md5=/usr \
  --with-sha1=/usr \
%if %{with_slowfs}
  --add-module=./ngx_slowfs_cache-master \
%endif
%if 0%{?suse_version} > 1000 || 0%{?fedora_version} > 4 || 0%{?mandriva_version} > 2006
  --with-cc-opt="%{optflags} -fstack-protector"
%else
  --with-cc-opt="%{optflags}"
%endif
# --add-module=./ngx_supervisord \

%{__make}


%install
make DESTDIR=$RPM_BUILD_ROOT install
%{__mkdir_p} %{buildroot}%{prefix}/bin
%{__mkdir_p} %{buildroot}%{prefix}/html
%{__mkdir_p} %{buildroot}%{prefix}/man/man8
%{__install} -m 0755 contrib/geo2nginx.pl %{buildroot}%{prefix}/bin/
%{__install} -m 0644 man/nginx* %{buildroot}%{prefix}/man/man8/

%if %{with_ruby}
%if 0%{?suse_version} > 0 && 0%{?sles_version} <= 10
gem install --local --install-dir %{buildroot}/%{ruby_gemdir} --force %{SOURCE9}
%else
gem install --bindir %{buildroot}%{_bindir} --local --install-dir %{buildroot}/%{ruby_gemdir} --force %{SOURCE9}
%endif
%{__rm} -rf %{buildroot}%{ruby_gemdir}/{cache,gems/%{gemname}-%{version}/{debian,ext}}
%{__rm} -rf %{buildroot}%{ruby_gemdir}/doc
%endif

%if %{with_geoip}
  %{__mkdir_p} %{buildroot}%{prefix}/share/GeoIP
  %{__install} -m 0644 %{SOURCE13} %{buildroot}%{prefix}/share/GeoIP/
  %{__install} -m 0644 %{SOURCE18} %{buildroot}%{prefix}/share/GeoIP/
%endif

%{__install} -m 0755 %{SOURCE17} %{buildroot}%{prefix}/bin/set_nginx_1.8.latest.sh

find %{buildroot} -name "nginx.old" -o -name "*.sav" -o -name "*.bs" -o -name "*.keep" -o -name "*.gitkeep" -o -name "*.gitignore" |xargs -i rm -f {}


%post
cd %{prefix}/..
%{prefix}/bin/set_nginx_1.8.latest.sh

%if %{with_geoip}
  cd %{prefix}/share/GeoIP
  rm -f %{prefix}/share/GeoIP/GeoIP*.dat
  gzip -d GeoIP*gz
%endif

%preun
%if %{with_geoip}
  rm -f %{prefix}/share/GeoIP/GeoIP*
  touch %{prefix}/share/GeoIP/GeoIP.dat.gz %{prefix}/share/GeoIP/GeoIPv6.dat.gz
%endif


%clean
%{__rm} -rf %{buildroot}


%if %{with_ruby}
%files ruby
%defattr(-,root,root)
%if 0%{?suse_version} >= 1200
%{ruby_gemdir}/bin/passenger*
%else
%{_bindir}/passenger*
%endif
%{ruby_gemdir}/gems/%{gemname}-%{gemvers}
%{ruby_gemdir}/specifications/%{gemname}-%{gemvers}.gemspec
%endif


%files
%defattr(-,root,root)
%dir %{prefix} 
%{prefix}/bin
%{prefix}/conf
%{prefix}/html
%{prefix}/man
%{prefix}/sbin
%{prefix}/logs
%if %{with_geoip}
%{prefix}/share
%endif


%changelog
* Wed Apr 22 2015 Holger Manthey <holger.manthey@bertelsmann.de>
- initial package