i2pd/i2pd.spec
2025-02-03 23:00:40 +00:00

121 lines
3.4 KiB
RPMSpec

%define debug %nil
%define build_timestamp %(date +"%Y%m%d")
Name: i2pd
Version: 2.55.0
Release: 1
Summary: I2P router
License: BSD
URL: https://i2pd.website
Group: Development/Other
Source0: https://github.com/PurpleI2P/i2pd/archive/%{version}/%{name}-%{version}.tar.gz
Source1000: %{name}.rpmlintrc
BuildRequires: gcc
BuildRequires: gcc-c++
#BuildRequires: pkgconfig(libssl)
BuildRequires: boost-devel
BuildRequires: systemd
BuildRequires: cmake
BuildRequires: miniupnpc-devel
BuildRequires: chrpath
BuildRequires: pkgconfig(openssl3.3)
%description
load-balanced unspoofable packet switching network - C++ port
I2P is an anonymizing network, offering a simple layer that identity-sensitive
applications can use to securely communicate. All data is wrapped with several
layers of encryption, and the network is both distributed and dynamic, with no
trusted parties.
This package contains the port of the I2P router to C++. Unless willing
to test and report problems, you should install the 'i2p' package instead.
%package systemd
Summary: Files to run I2P router under systemd
Requires: i2pd
Requires: systemd
Requires(pre): %{_sbindir}/useradd %{_sbindir}/groupadd
Obsoletes: %{name}-daemon
%description systemd
C++ implementation of I2P.
This package contains systemd unit file to run i2pd as a system service
using dedicated user's permissions.
%files systemd
%{_unitdir}/i2pd.service
%dir %attr(0700,i2pd,i2pd) %{_sharedstatedir}/i2pd
%prep
%setup -q
%build
pushd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DWITH_LIBRARY=OFF \
-DWITH_UPNP=ON \
-DWITH_HARDENING=ON \
-DWITH_MESHNET=ON \
-DWITH_I2LUA=ON \
-DWITH_WEBSOCKETS=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
.
%make
popd
%install
install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_datadir}/%{name}
install -d %{buildroot}%{_sysconfdir}/%{name}/tunnels.conf.d
install -d %{buildroot}%{_sysconfdir}/%{name}/certificates
install -d %{buildroot}%{_localstatedir}/lib/%{name}
install -d %{buildroot}%{_unitdir}
install -d %{buildroot}%{_sharedstatedir}/%{name}
install -d %{buildroot}%{_mandir}/man1/
pushd build
chrpath -d i2pd
install -Dm0755 %{name} %{buildroot}%{_sbindir}
popd
install -Dm0644 contrib/%{name}.conf %{buildroot}%{_sysconfdir}/%{name}/
install -Dm0644 contrib/tunnels.conf %{buildroot}%{_sysconfdir}/%{name}/
install -Dm0644 contrib/subscriptions.txt %{buildroot}%{_sysconfdir}/%{name}/
install -Dm0644 contrib/%{name}.service %{buildroot}%{_unitdir}
install -Dm0644 contrib/%{name}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -Dm0644 debian/i2pd.1 %{buildroot}%{_mandir}/man1/
cp -r contrib/certificates/ %{buildroot}%{_datadir}/%{name}/certificates
cp -r contrib/tunnels.d/ %{buildroot}%{_sysconfdir}/%{name}/tunnels.conf.d
ln -s %{_datadir}/%{name}/certificates %{buildroot}%{_sharedstatedir}/%{name}/certificates
%pre systemd
getent group i2pd >/dev/null || %{_sbindir}/groupadd -r i2pd
getent passwd i2pd >/dev/null || \
%{_sbindir}/useradd -r -g i2pd -s %{_sbindir}/nologin \
-d %{_sharedstatedir}/i2pd -c 'I2P Service' i2pd
%post systemd
%systemd_post i2pd.service
%preun systemd
%systemd_preun i2pd.service
%postun systemd
%systemd_postun_with_restart i2pd.service
%files
%doc README.md LICENSE
%{_sbindir}/%{name}
%{_sysconfdir}/%{name}/*
%{_sysconfdir}/logrotate.d/%{name}
%{_datadir}/%{name}/certificates
%{_sharedstatedir}/%{name}/certificates
%{_mandir}/man1/*
%attr(0755,i2pd,i2pd) %dir %{_localstatedir}/lib/%{name}