summaryrefslogtreecommitdiffstats
path: root/unit.spec
diff options
context:
space:
mode:
Diffstat (limited to 'unit.spec')
-rw-r--r--unit.spec84
1 files changed, 72 insertions, 12 deletions
diff --git a/unit.spec b/unit.spec
index 920cf98..5bf0e5a 100644
--- a/unit.spec
+++ b/unit.spec
@@ -1,8 +1,8 @@
# remirepo/fedora spec file for unit-php
#
-# Copyright (c) 2019-2024 Remi Collet
-# License: CC-BY-SA-4.0
-# http://creativecommons.org/licenses/by-sa/4.0/
+# SPDX-FileCopyrightText: Copyright 2019-2024 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
#
# Please, preserve the changelog entries
#
@@ -12,6 +12,8 @@
%bcond_without tests
# require ONLINE build for sources download
%bcond_with wasm
+# need vendored rust libraries
+%bcond_without otel
%global gh_owner nginx
%global project unit
@@ -21,8 +23,10 @@
Name: unit
Summary: NGINX Unit application server
Version: 1.34.0
-Release: 1%{?dist}
-License: Apache-2.0
+Release: 2%{?dist}
+# unit is Apache-2.0
+# rust libraries are Apache-2.0 or MIT
+License: Apache-2.0 AND MIT
URL: https://unit.nginx.org/
Source0: https://github.com/%{gh_owner}/%{project}/archive/%{gh_commit}/%{project}-%{version}-%{gh_short}.tar.gz
@@ -30,6 +34,12 @@ Source1: unit.service
Source2: unit.init
Source3: unit.sysconf
Source4: unit.logrotate
+# awfull hack, use a bundled rust registry
+Source5: makedeps.sh
+Source6: %{project}-deps-%{version}.tgz
+
+# add libotel.a to tests build
+Patch0: unit-tests.patch
BuildRequires: make
BuildRequires: gcc
@@ -39,6 +49,10 @@ BuildRequires: pcre2-devel
BuildRequires: njs
BuildRequires: libnjs-devel >= 0.8.3
BuildRequires: systemd
+%if %{with otel}
+BuildRequires: cargo >= 1.73
+BuildRequires: rust >= 1.73
+%endif
%if %{with wasm}
BuildRequires: clang
BuildRequires: llvm
@@ -70,7 +84,44 @@ Library and include files required for NGINX Unit modules development.
%prep
+%if %{without otel}
%setup -qn %{project}-%{gh_commit}
+%else
+%setup -qn %{project}-%{gh_commit} -a6
+
+%patch -P0 -p1 -b .otel
+
+: Create cargo configuration to use vendor directory
+mkdir .cargo
+cat << EOF | tee .cargo/config.toml
+[build]
+jobs = %(echo %{?_smp_mflags} | sed 's/\-j//')
+rustc = "%{_bindir}/rustc"
+
+[env]
+CFLAGS = "%{build_cflags}"
+CXXFLAGS = "%{build_cxxflags}"
+LDFLAGS = "%{build_ldflags}"
+
+[term]
+verbose = true
+
+[source.crates-io]
+replace-with = "vendored-sources"
+
+[source.vendored-sources]
+directory = "$PWD/mycargo"
+EOF
+
+: Bundled libraries Licenses
+for i in $(cd mycargo; ls */LICEN*)
+do
+ cp mycargo/$i $(dirname $i)-$(basename $i .md)
+done
+
+: Required rust version
+grep -h rust-version mycargo/*/Cargo.toml src/otel/Cargo.toml | sort -u | tail -n 8
+%endif
%build
@@ -94,27 +145,30 @@ unitconf() {
--cc-opt="%{optflags}" \
--tests \
--njs \
+%if %{with otel}
+ --otel \
+%endif
$*
}
unitconf \
--modulesdir=%{_libdir}/unit/debug-modules \
--debug
-make %{?_smp_mflags}
-make %{?_smp_mflags} build/lib/libunit.a
+make %{?_smp_mflags} E=0 V=1
+make %{?_smp_mflags} build/lib/libunit.a E=0 V=1
mv build build-debug
%if %{with wasm}
-make %{?_smp_mflags} -C pkg/contrib .libunit-wasm
+make %{?_smp_mflags} -C pkg/contrib .libunit-wasm E=0 V=1
%endif
unitconf \
--modulesdir=%{_libdir}/unit/modules
-make %{?_smp_mflags}
+make %{?_smp_mflags} E=0 V=1
%install
-DESTDIR=%{buildroot} make unitd-install libunit-install manpage-install
+DESTDIR=%{buildroot} make unitd-install libunit-install manpage-install E=0 V=1
install -m755 -D tools/unitc %{buildroot}%{_bindir}/unitc
install -m755 -D tools/setup-unit %{buildroot}%{_bindir}/setup-unit
@@ -144,7 +198,7 @@ install -m 644 pkg/contrib/libunit-wasm/src/c/include/unit/unit-wasm.h %{buildro
%check
%if %{with tests}
-make tests %{?_smp_mflags}
+make tests %{?_smp_mflags} E=0 V=1
./build/tests
%endif
@@ -181,7 +235,7 @@ More info: https://unit.nginx.org/installation/#official-packages
BANNER
%files
-%license LICENSE
+%license *LICENSE*
%doc NOTICE CHANGES *.md
%attr(0755,root,root) %{_bindir}/unitc
%attr(0755,root,root) %{_bindir}/setup-unit
@@ -214,6 +268,12 @@ BANNER
%changelog
+* Thu Dec 19 2024 Remi Collet <remi@remirepo.net> - 1.34.0-2
+- re-license spec file to CECILL-2.1
+- enable otel support
+- fix build of tests with otel using patch from
+ https://github.com/nginx/unit/pull/1521
+
* Thu Dec 19 2024 Remi Collet <remi@remirepo.net> - 1.34.0-1
- update to 1.34.0