File h2o.spec of Package h2o
#
# spec file for package h2o
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1230 || 0%{?rhel_version} > 6 || 0%{?centos_version} > 6 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without systemd
%else
%bcond_with systemd
%endif
Name: h2o
Version: 2.2.6
Release: 0
%define home /var/lib/%{name}/
%define logdir /var/log/%{name}/
License: MIT
Summary: An optimized HTTP/1, HTTP/2 server
Url: https://h2o.examp1e.net/
Group: Productivity/Networking/Web/Servers
Source: https://github.com/h2o/h2o/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: h2o.conf
Source2: h2o.service
Source3: h2o.logrotate
Patch1: 02-fix-c99-compile-error.patch
Patch2: link-against-wslay.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libuv-devel
BuildRequires: pkgconfig
BuildRequires: wslay-devel
BuildRequires: openssl-devel
BuildRequires: ruby-devel >= 1.9, bison
BuildRequires: zlib-devel
Recommends: logrotate
Provides: http_daemon
Provides: httpd
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
H2O is a new generation HTTP server. Not only is it very fast, it also provides
much quicker response to end-users when compared to older generations of HTTP
servers.
%package -n libh2o0_13
Group: Development/Libraries/C and C++
Summary: H2O Library compiled with libuv
%description -n libh2o0_13
libh2o package provides H2O library compiled with libuv which allows you to
link your own software to H2O.
%package -n libh2o-evloop0_13
Group: Development/Libraries/C and C++
Summary: H2O Library compiled with its own event loop
%description -n libh2o-evloop0_13
libh2o-evloop package provides H2O library compiled with its own event loop
which allows you to link your own software to H2O.
%package -n libh2o-devel
Group: Development/Libraries/C and C++
Summary: Development interfaces for H2O
Requires: openssl-devel, pkgconfig
Requires: libh2o0_13 = %{version}-%{release}
Requires: libh2o-evloop0_13 = %{version}-%{release}
%description -n libh2o-devel
libh2o-devel package provides H2O header files and helpers which allow you to
build your own software using H2O.
%prep
%setup -q
%patch1 -p1 -b .c99
%patch2 -p1
%build
%cmake -DWITH_BUNDLED_SSL=OFF -DWITH_MRUBY=on -DBUILD_SHARED_LIBS=on -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_EXE_LINKER_FLAGS:STRING='' -DCMAKE_MODULE_LINKER_FLAGS:STRING='' -DCMAKE_SHARED_LINKER_FLAGS:STRING=''
make V=1 # %{?_smp_mflags}
%install
%cmake_install
mkdir -p %{buildroot}%{_docdir} %{buildroot}%{_sbindir} %{buildroot}%{home} %{buildroot}%{logdir}
#
mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{_docdir}
mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}
install -D -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/%{name}/h2o.conf
chmod -R u=rwX,g=rX,o= %{buildroot}%{_sysconfdir}/%{name}/
chmod -R go= %{buildroot}%{home} %{buildroot}%{logdir}
# install log rotation stuff
install -D -m 0644 %{S:3} %{buildroot}%{_sysconfdir}/logrotate.d/h2o
%if %{with systemd}
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/%{name}.service
%if 0%{?suse_version}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%endif
%endif
%pre
/usr/sbin/groupadd -r %{name} >/dev/null 2>&1 || :
/usr/sbin/useradd -g %{name} -s /bin/false -r -c "%{name}" -d %{home} %{name} >/dev/null 2>&1 || :
# START BIG SYSTEMD
%if %{with systemd}
%if 0%{?suse_version}
%service_add_pre %{name}.service
%endif
%preun
%if 0%{?suse_version}
%service_del_preun %{name}.service
%else
%systemd_preun %{name}.service
%endif
%post
%if 0%{?suse_version}
%service_add_post %{name}.service
%else
%systemd_post %{name}.service
%endif
%postun
%if 0%{?suse_version}
%service_del_postun %{name}.service
%else
%systemd_postun_with_restart %{name}.service
%endif
%endif
# /END BIG SYSTEMD
%post -n libh2o0_13 -p /sbin/ldconfig
%postun -n libh2o0_13 -p /sbin/ldconfig
%post -n libh2o-evloop0_13 -p /sbin/ldconfig
%postun -n libh2o-evloop0_13 -p /sbin/ldconfig
%files
%defattr(-,root,root)
%config(noreplace) %attr(-,root,%{name}) %{_sysconfdir}/%{name}/
%config(noreplace) %{_sysconfdir}/logrotate.d/h2o
%{_sbindir}/%{name}
%{_datadir}/%{name}/
%if %{with systemd}
%{_unitdir}/%{name}.service
%endif
%if 0%{?suse_version}
%{_sbindir}/rc%{name}
%endif
%doc %{_docdir}/%{name}/
%dir %attr(700,%{name},%{name}) %{home}
%dir %attr(700,%{name},%{name}) %{logdir}
%files -n libh2o0_13
%{_libdir}/libh2o.so.*
%files -n libh2o-evloop0_13
%{_libdir}/libh2o-evloop.so.*
%files -n libh2o-devel
%{_libdir}/libh2o.so
%{_libdir}/libh2o-evloop.so
%{_libdir}/pkgconfig/libh2o.pc
%{_libdir}/pkgconfig/libh2o-evloop.pc
%{_includedir}/%{name}.h
%{_includedir}/%{name}
%changelog