Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37606588
en ru br
ALT Linux repos
S:1.31.0-alt1

Group :: System/Servers
RPM: unit

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

# SPDX-License-Identifier: GPL-2.0-only
%define _unpackaged_files_terminate_build 1
%define _stripped_files_terminate_build 1
%set_verify_elf_method strict,unresolved=normal
%global optflags_lto %optflags_lto -ffat-lto-objects

%def_enable perl
%def_enable python
%def_enable php
%def_enable ruby
%def_disable devel

Name: unit
Version: 1.30.0
Release: alt1

Summary: NGINX Unit - Web Application Server
License: Apache-2.0
Group: System/Servers

Url: https://unit.nginx.org/
Vcs: https://github.com/nginx/unit

Source: %name-%version.tar

BuildRequires: libssl-devel
BuildRequires: libpcre-devel
%{?_enable_ruby:BuildRequires: ruby libruby-devel}
%{?_enable_perl:BuildRequires: perl-devel perl-base}
%{?_enable_php:BuildRequires: php8.1 php8.1-devel php-base}
%{?_enable_python:BuildRequires: python3-devel}

Provides: nginx-unit = %EVR
Requires(post): service >= 0.5.33

%description
NGINX Unit is a polyglot app server, a reverse proxy, and a static
file server, available for Unix-like systems. It was built by nginx
team members from scratch to be highly efficient and fully configurable
at runtime.

%package perl
Summary: Perl module for NGINX Unit
Group: System/Servers
Requires: unit = %EVR

%description perl
Perl module for NGINX Unit

%package python3
Summary: Python module for NGINX Unit
Group: System/Servers
Requires: unit = %EVR

%description python3
Python module for NGINX Unit

%package php
Summary: PHP module for NGINX Unit
Group: System/Servers
Requires: unit = %EVR

%description php
PHP module for NGINX Unit

%package ruby
Summary: Ruby module for NGINX Unit
Group: System/Servers
Requires: unit = %EVR

%description ruby
Ruby module for NGINX Unit

%package checkinstall
Summary: Checkinstall test for %name
Group: Development/Other
Requires: %name = %EVR
Requires: logrotate
Requires: man-db
Requires: systemd-analyze

%description checkinstall
%summary.

%prep
%setup

# "The memfd_create() system call first appeared in Linux 3.17"

sed -i -e 's/NXT_HAVE_MEMFD_CREATE/NO_&/' auto/shmem

sed -i 's!/var/run/!/run/!' pkg/rpm/rpmbuild/SOURCES/unit.logrotate

%build
%add_optflags $(getconf LFS_CFLAGS)
# Test compilation passes with the following options:
#   %%define optflags_lto %nil
#   %%add_optflags -fanalyzer -Wno-analyzer-null-argument -Wno-analyzer-null-dereference -Wno-analyzer-malloc-leak -Wno-analyzer-use-of-uninitialized-value
# Last one is certainly worrisome.

%ifarch %e2k
# lcc 1.25.12 found some perl/php interpreter header glitches missed by gcc
%add_optflags -Wno-error=unused-function -Wno-error=ignored-qualifiers
%endif

CONFIGURE_ARGS="
--prefix=%_prefix
--state=%_localstatedir/unit
--libdir=%_libdir
--user=_unit
--group=_unit
--control=unix:/run/unit/control.sock
--pid=/run/unit/unit.pid
--log=/var/log/unit/unit.log
--tmp=/var/tmp
--tests
--openssl"

CFLAGS="%optflags" \
./configure $CONFIGURE_ARGS \
--modules=%_libdir/unit/modules
%if_enabled perl
 ./configure perl
%endif
%if_enabled python
 ./configure python --config=python3-config
%endif
%if_enabled php
 ./configure php --config=/usr/bin/php-config8.1
%endif
%if_enabled ruby
 ./configure ruby
%endif
%make_build
%if_enabled devel
 %make_build build/libunit.a
%endif
%make_build tests

%install
%makeinstall_std unitd-install libunit-install
%if_enabled perl
 %makeinstall_std perl-install
%endif
%if_enabled python
 %makeinstall_std python3-install
%endif
%if_enabled php
 %makeinstall_std php-install
%endif
%if_enabled ruby
 %makeinstall_std ruby-install
%endif

install -pD tools/unitc %buildroot%_bindir/unitc
install -pD -m644 pkg/rpm/rpmbuild/SOURCES/unit.logrotate %buildroot%_sysconfdir/logrotate.d/unit
install -pD -m644 .gear/unit.service %buildroot%systemd_unitdir/unit.service
install -pD -m755 .gear/unit.init    %buildroot%_initdir/unit
mkdir -p %buildroot%_localstatedir/unit
mkdir -p %buildroot%_logdir/unit

ln NOTICE COPYRIGHT
ln pkg/rpm/rpmbuild/SOURCES/unit.example-ruby-app    ruby-app.ru
ln pkg/rpm/rpmbuild/SOURCES/unit.example-ruby-config ruby-unit.config
ln pkg/rpm/rpmbuild/SOURCES/unit.example-perl-app    perl-app.ru
ln pkg/rpm/rpmbuild/SOURCES/unit.example-perl-config perl-unit.config
ln pkg/rpm/rpmbuild/SOURCES/unit.example-python-app    python-app.ru
ln pkg/rpm/rpmbuild/SOURCES/unit.example-python-config python-unit.config
ln pkg/rpm/rpmbuild/SOURCES/unit.example-php-app     php-app.ru
ln pkg/rpm/rpmbuild/SOURCES/unit.example-php-config  php-unit.config

%check
# unitc does not pass shellcheck
bash -n %buildroot%_bindir/unitc
bash -n %buildroot%_initdir/unit
build/tests

%pre checkinstall
set -ex
# systemd-analyze better works in non-'/'.
cd
systemd-analyze verify unit.service
logrotate %_sysconfdir/logrotate.d/unit

%pre
/usr/sbin/groupadd -r -f _unit
/usr/sbin/useradd -r -g _unit -d /var/empty -s /dev/null -N -c "%summary" _unit >/dev/null 2>&1 ||:

%post
%post_service_posttrans_restart unit

%preun
%preun_service unit

%files
%doc CHANGES LICENSE README.md COPYRIGHT SECURITY.txt
%_man8dir/*.8*
%_sbindir/unitd
%_bindir/unitc
%_initdir/unit
%systemd_unitdir/unit.service
%config(noreplace) %_sysconfdir/logrotate.d/unit
%dir %_localstatedir/unit
%dir %_logdir/unit
%dir %_libdir/unit
%dir %_libdir/unit/modules
%if_enabled devel
 %_libdir/libunit.a
 %_includedir/nxt_*.h
%else
 %exclude %_libdir/libunit.a
 %exclude %_includedir/nxt_*.h
%endif

%if_enabled perl
%files perl
%doc COPYRIGHT perl-app.ru perl-unit.config
%_libdir/unit/modules/perl.unit.so
%endif

%if_enabled python
%files python3
%doc COPYRIGHT python-app.ru python-unit.config
%_libdir/unit/modules/python3.unit.so
%endif

%if_enabled php
%files php
%doc COPYRIGHT php-app.ru php-unit.config
%_libdir/unit/modules/php.unit.so
%endif

%if_enabled ruby
%files ruby
%doc COPYRIGHT ruby-app.ru ruby-unit.config
%_libdir/unit/modules/ruby.unit.so
%endif

%files checkinstall

%changelog

Full changelog you can see here

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin