Ticket #2317: i2p.spec

File i2p.spec, 11.3 KB (added by villain, 6 months ago)

rpm spec file for 0.9.37-4

Line 
1%global _javadir %{_datadir}/java
2
3%if "%{_arch}" == "i386"
4%define wrapper_dir linux
5%endif
6%if "%{_arch}" == "x86_64"
7%define wrapper_dir linux64
8%endif
9%if "%{_arch}" == "ppc"
10%define wrapper_dir linux-ppc
11%endif
12
13Name:           i2p
14Version:        0.9.37
15Release:        4%{?dist}
16Summary:        Invisible Internet Project (I2P) - anonymous network
17Conflicts:      i2pd
18
19License:        GPL
20URL:            https://geti2p.net/
21Source0:        https://download.i2p2.de/releases/%version/i2psource_%version.tar.bz2
22
23BuildRequires:  java-1.8.0-openjdk-devel
24BuildRequires:  gettext-devel
25BuildRequires:  ant
26BuildRequires:  gcc
27BuildRequires:  gmp-devel
28BuildRequires:  systemd-units
29
30Requires:       systemd
31Requires:       java-1.8.0-openjdk
32Requires(pre):  %{_sbindir}/useradd %{_sbindir}/groupadd
33
34%if 0%{?fedora} || 0%{?rhel} >= 8
35BuildRequires:  tomcat-lib
36BuildRequires:  tomcat-taglibs-standard
37BuildRequires:  gnu-getopt
38
39Requires:       java-service-wrapper
40Requires:       tomcat-lib
41Requires:       tomcat-taglibs-standard
42Requires:       gnu-getopt
43
44Patch0:         i2p-0.9.37-fix-tomcat.patch
45Patch1:         i2p-0.9.37-no-classpath.patch
46%endif
47
48%description
49I2P is an anonymizing network, offering a simple layer that identity-sensitive
50applications can use to securely communicate. All data is wrapped with several
51layers of encryption, and the network is both distributed and dynamic, with no
52trusted parties.
53
54%global debug_package %{nil}
55
56%prep
57%setup -q
58%if 0%{?fedora} || 0%{?rhel} >= 8
59
60%if "%version" == "0.9.37"
61%patch0 -p1
62%patch1 -p1
63echo "without-manifest-classpath=true" >> override.properties
64%endif
65
66sed -i 's/usr\/sbin\/wrapper/usr\/sbin\/java-service-wrapper/' debian/i2p.service
67echo wrapper.java.classpath.2=/usr/lib64/java-service-wrapper/wrapper.jar >> installer/resources/wrapper.config
68
69echo "with-libtomcat8-java=true" >> override.properties
70mkdir -p apps/jetty/jettylib
71
72%if %{fedora} >= 29
73cp /usr/share/java/tomcat-servlet-4.0-api.jar apps/jetty/jettylib/javax.servlet.jar
74%else
75cp /usr/share/java/tomcat-servlet-3.1-api.jar apps/jetty/jettylib/javax.servlet.jar
76%endif
77
78ln -s /usr/share/java/tomcat-jsp-2.3-api.jar apps/jetty/jettylib/jsp-api.jar
79ln -s /usr/share/java/tomcat/jasper.jar apps/jetty/jettylib/jasper-runtime.jar
80ln -s /usr/share/java/tomcat/tomcat-juli.jar apps/jetty/jettylib/commons-logging.jar
81ln -s /usr/share/java/tomcat/tomcat-coyote.jar apps/jetty/jettylib/tomcat-coyote.jar
82ln -s /usr/share/java/tomcat/tomcat-api.jar apps/jetty/jettylib/tomcat-api.jar
83ln -s /usr/share/java/tomcat/tomcat-util.jar apps/jetty/jettylib/tomcat-util.jar
84ln -s /usr/share/java/tomcat/tomcat-util-scan.jar apps/jetty/jettylib/tomcat-util-scan.jar
85ln -s /usr/share/java/tomcat/jasper-el.jar apps/jetty/jettylib/jasper-el.jar
86ln -s /usr/share/java/tomcat/tomcat-el-3.0-api.jar apps/jetty/jettylib/commons-el.jar
87
88echo "with-libtaglibs-standard=true" >> override.properties
89mkdir -p apps/susidns/src/lib
90rm -f apps/susidns/src/lib/standard.jar
91rm -f apps/susidns/src/lib/jstl.jar
92rm -f apps/susidns/src/lib/jstlel.jar
93ln -s /usr/share/java/tomcat-taglibs-standard/taglibs-standard-spec.jar apps/susidns/src/lib/jstl.jar
94ln -s /usr/share/java/tomcat-taglibs-standard/taglibs-standard-impl.jar apps/susidns/src/lib/standard.jar
95ln -s /usr/share/java/tomcat-taglibs-standard/taglibs-standard-jstlel.jar apps/susidns/src/lib/jstlel.jar
96
97echo "with-libgetopt-java=true" >> override.properties
98mkdir -p core/java/build
99ln -s /usr/share/java/gnu-getopt.jar core/java/build
100
101%else
102sed -i 's/usr\/sbin\/wrapper/usr\/bin\/i2psvc/' debian/i2p.service
103%endif
104
105sed -i '/EnvironmentFile/d' debian/i2p.service
106sed -i 's/\$INSTALL_PATH/\/usr\/share\/i2p/' installer/resources/wrapper.config
107echo router.updateDisabled=true >> installer/resources/router.config
108
109%build
110TZ=UTC JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 ant preppkg-linux-only
111
112cd core/c/jbigi && DEBIANVERSION=9 JAVA_HOME=/usr/lib/jvm/java ./build_jbigi.sh dynamic
113cd ../jcpuid && DEBIANVERSION=9 JAVA_HOME=/usr/lib/jvm/java ./build.sh
114
115%install
116
117install -D -m 644 %{_builddir}/%{name}-%{version}/debian/i2p.service %{buildroot}%{_unitdir}/i2p.service
118
119#data
120install -d -m 755 %{buildroot}%{_datadir}/i2p
121install -D -m 644 %{_builddir}/%{name}-%{version}/history.txt %{buildroot}%{_datadir}/i2p
122install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/blocklist.txt %{buildroot}%{_datadir}/i2p
123install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/hosts.txt %{buildroot}%{_datadir}/i2p
124install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/*.config %{buildroot}%{_datadir}/i2p
125install -d -m 755 %{buildroot}%{_datadir}/i2p/lib
126
127%if 0%{?fedora} || 0%{?rhel} >= 8
128# i2p classes
129install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/addressbook.jar %{buildroot}%{_datadir}/i2p/lib
130install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/BOB.jar %{buildroot}%{_datadir}/i2p/lib
131install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/desktopgui.jar %{buildroot}%{_datadir}/i2p/lib
132install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/i2p.jar %{buildroot}%{_datadir}/i2p/lib
133install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/i2psnark.jar %{buildroot}%{_datadir}/i2p/lib
134install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/i2ptunnel.jar %{buildroot}%{_datadir}/i2p/lib
135install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/jetty-i2p.jar %{buildroot}%{_datadir}/i2p/lib
136install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/jrobin.jar %{buildroot}%{_datadir}/i2p/lib
137install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/mstreaming.jar %{buildroot}%{_datadir}/i2p/lib
138install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/routerconsole.jar %{buildroot}%{_datadir}/i2p/lib
139install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/router.jar %{buildroot}%{_datadir}/i2p/lib
140install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/sam.jar %{buildroot}%{_datadir}/i2p/lib
141install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/streaming.jar %{buildroot}%{_datadir}/i2p/lib
142install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/systray.jar %{buildroot}%{_datadir}/i2p/lib
143
144# i2p requires jetty v9.2 currently, fedora has v9.4
145install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/jetty-*.jar %{buildroot}%{_datadir}/i2p/lib
146install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/org.mortbay.jetty.jar %{buildroot}%{_datadir}/i2p/lib
147install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/org.mortbay.jmx.jar %{buildroot}%{_datadir}/i2p/lib
148
149# Tomcat Jasper breaks Router Console, results in: JettyJasperInitializer not found
150#install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/jasper-runtime.jar %{buildroot}%{_datadir}/i2p/lib
151
152%if %{fedora} >= 29
153ln -s %{_javadir}/tomcat-servlet-4.0-api.jar %{buildroot}%{_datadir}/i2p/lib/javax.servlet.jar
154%else
155ln -s %{_javadir}/tomcat-servlet-3.1-api.jar %{buildroot}%{_datadir}/i2p/lib/javax.servlet.jar
156%endif
157ln -s %{_javadir}/tomcat-jsp-2.3-api.jar %{buildroot}%{_datadir}/i2p/lib/jsp-api.jar
158ln -s %{_javadir}/tomcat/jasper.jar %{buildroot}%{_datadir}/i2p/lib/jasper-runtime.jar
159ln -s %{_javadir}/tomcat/tomcat-juli.jar %{buildroot}%{_datadir}/i2p/lib/commons-logging.jar
160ln -s %{_javadir}/tomcat/tomcat-coyote.jar %{buildroot}%{_datadir}/i2p/lib/tomcat-coyote.jar
161ln -s %{_javadir}/tomcat/tomcat-api.jar %{buildroot}%{_datadir}/i2p/lib/tomcat-api.jar
162ln -s %{_javadir}/tomcat/tomcat-util.jar %{buildroot}%{_datadir}/i2p/lib/tomcat-util.jar
163ln -s %{_javadir}/tomcat/tomcat-util-scan.jar %{buildroot}%{_datadir}/i2p/lib/tomcat-util-scan.jar
164ln -s %{_javadir}/tomcat/jasper-el.jar %{buildroot}%{_datadir}/i2p/lib/jasper-el.jar
165ln -s %{_javadir}/tomcat/tomcat-el-3.0-api.jar %{buildroot}%{_datadir}/i2p/lib/commons-el.jar
166
167ln -s %{_javadir}/tomcat-taglibs-standard/taglibs-standard-spec.jar %{buildroot}%{_datadir}/i2p/lib/jstl.jar
168ln -s %{_javadir}/tomcat-taglibs-standard/taglibs-standard-impl.jar %{buildroot}%{_datadir}/i2p/lib/standard.jar
169ln -s %{_javadir}/tomcat-taglibs-standard/taglibs-standard-jstlel.jar %{buildroot}%{_datadir}/i2p/lib/jstlel.jar
170
171ln -s %{_javadir}/gnu-getopt.jar %{buildroot}%{_datadir}/i2p/lib/gnu-getopt.jar
172%else
173# if CentOS 7: just install all jar files
174install -D -m 644 %{_builddir}/%{name}-%{version}/pkg-temp/lib/*.jar %{buildroot}%{_datadir}/i2p/lib
175# install wrapper
176install -D -m 755 %{_builddir}/%{name}-%{version}/pkg-temp/lib/wrapper/%{wrapper_dir}/i2psvc %{buildroot}%{_bindir}/i2psvc
177install -D -m 755 %{_builddir}/%{name}-%{version}/pkg-temp/lib/wrapper/%{wrapper_dir}/libwrapper.so %{buildroot}%{_datadir}/i2p/lib/libwrapper.so
178%endif
179
180%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/certificates %{buildroot}%{_datadir}/i2p
181%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/docs %{buildroot}%{_datadir}/i2p
182%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/eepsite %{buildroot}%{_datadir}/i2p
183%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/geoip %{buildroot}%{_datadir}/i2p
184%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/locale %{buildroot}%{_datadir}/i2p
185%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/webapps %{buildroot}%{_datadir}/i2p
186
187#licenses
188install -d -m 755 %{buildroot}%{_datadir}/licenses/i2p
189%{__cp} -r %{_builddir}/%{name}-%{version}/pkg-temp/licenses/* %{buildroot}%{_datadir}/licenses/i2p
190
191install -d -m 755 %{buildroot}%{_sysconfdir}/i2p
192ln -s %{_datadir}/i2p/clients.config %{buildroot}%{_sysconfdir}/i2p/clients.config
193ln -s %{_datadir}/i2p/i2psnark.config %{buildroot}%{_sysconfdir}/i2p/i2psnark.config
194ln -s %{_datadir}/i2p/i2ptunnel.config %{buildroot}%{_sysconfdir}/i2p/i2ptunnel.config
195ln -s %{_datadir}/i2p/systray.config %{buildroot}%{_sysconfdir}/i2p/systray.config
196ln -s %{_datadir}/i2p/wrapper.config %{buildroot}%{_sysconfdir}/i2p/wrapper.config
197   
198install -d -m 755 %{buildroot}%{_libdir}/i2p
199install -D -m 755 %{_builddir}/%{name}-%{version}/core/c/jbigi/*.so %{buildroot}%{_libdir}/i2p
200ln -s %{_libdir}/i2p/jbigi.so %{buildroot}%{_datadir}/i2p/lib/jbigi.so
201ln -s %{_libdir}/i2p/jcpuid.so %{buildroot}%{_datadir}/i2p/lib/cpuid.so
202
203install -d -m 700 %{buildroot}%{_sharedstatedir}/i2p
204install -d -m 700 %{buildroot}%{_localstatedir}/log/i2p
205
206%pre
207getent group i2psvc >/dev/null || %{_sbindir}/groupadd -r i2psvc
208getent passwd i2psvc >/dev/null || \
209  %{_sbindir}/useradd -r -g i2psvc -s %{_sbindir}/nologin \
210                      -d %{_sharedstatedir}/i2p -c 'I2P Service' i2psvc
211
212%post
213%systemd_post i2p.service
214
215
216%preun
217%systemd_preun i2p.service
218
219
220%postun
221%systemd_postun_with_restart i2p.service
222
223
224%files
225# wrappers
226%if 0%{?rhel} == 7
227%{_bindir}/i2psvc
228%endif
229%{_unitdir}/i2p.service
230# configs and data
231%defattr(644,i2psvc,i2psvc,755)
232%dir  %{_datadir}/i2p
233%{_datadir}/i2p/*
234%dir  %{_libdir}/i2p
235%{_libdir}/i2p/*
236%dir  %{_sysconfdir}/i2p
237%{_sysconfdir}/i2p/*.config
238# misc directories
239%dir %{_datadir}/licenses/i2p
240%{_datadir}/licenses/i2p/*
241%dir  %{_sharedstatedir}/i2p
242%dir  %{_localstatedir}/log/i2p
243
244%changelog
245* Sun Oct 14 2018 Viktor Villainov <supervillain@riseup.net> - 0.9.37-4
246- prevent classpaths in jar manifests
247
248* Mon Oct 8 2018 Viktor Villainov <supervillain@riseup.net> - 0.9.37-3
249- compilation with system libraries
250
251* Mon Oct 8 2018 Viktor Villainov <supervillain@riseup.net> - 0.9.37-2
252- add native jbigi and jcpuid
253
254* Wed Oct 3 2018 Viktor Villainov <supervillain@riseup.net> - 0.9.37-1
255- bump version
256
257* Wed Oct 3 2018 Viktor Villainov <supervillain@riseup.net> - 0.9.36-2
258- make Fedora use system libraries
259
260* Mon Sep 24 2018 Viktor Villainov <supervillain@riseup.net> - 0.9.36-1
261- initial package for version 0.9.36