]> git.pld-linux.org Git - packages/hitch.git/blob - hitch.spec
157c6e18eee2fff8ae2f82a4643d0b40e0b005ff
[packages/hitch.git] / hitch.spec
1 #
2 # Conditional build:
3 %bcond_with     tests           # run tests. needs internet connection
4
5 Summary:        Network proxy that terminates TLS/SSL connections
6 Name:           hitch
7 Version:        1.1.0
8 Release:        1
9 License:        BSD
10 Group:          Daemons
11 Source0:        https://hitch-tls.org/source/%{name}-%{version}.tar.gz
12 # Source0-md5:  f8b916e8739f55432ec8af5146e522ed
13 Patch0:         %{name}.systemd.service.patch
14 Patch1:         %{name}.initrc.redhat.patch
15 Patch3:         %{name}-1.0.1_tests_nobody_group.patch
16 Patch4:         %{name}.test07_missing_curl_resolve_on_el6.patch
17 Patch5:         %{name}-1.1.0_stronger_ciphers.e7be033.patch
18 URL:            https://hitch-tls.org/
19 BuildRequires:  libev-devel >= 4
20 BuildRequires:  libtool
21 BuildRequires:  openssl
22 BuildRequires:  openssl-devel >= 1.0.0
23 BuildRequires:  rpmbuild(macros) >= 1.647
24 Requires(post,preun):   /sbin/chkconfig
25 Requires(post,preun,postun):    systemd-units >= 38
26 Requires:       rc-scripts
27 Requires:       systemd-units >= 0.38
28 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29
30 %define         hitch_user              hitch
31 %define         hitch_group             hitch
32 %define         hitch_homedir   %{_localstatedir}/lib/hitch
33 %define         hitch_confdir   %{_sysconfdir}/%{name}
34 %define         hitch_datadir   %{_datadir}/hitch
35
36 %description
37 hitch is a network proxy that terminates TLS/SSL connections and
38 forwards the unencrypted traffic to some backend. It is designed to
39 handle 10s of thousands of connections efficiently on multicore
40 machines.
41
42 %prep
43 %setup -q
44 %patch0
45 %patch1
46 %patch3
47 %patch4
48 %patch5 -p1
49
50 %build
51 CFLAGS="%{rpmcflags} -fPIE"
52 LDFLAGS="-pie"
53 CPPFLAGS="-I%{_includedir}/libev"
54 %configure
55 %{__make}
56
57 %if %{with tests}
58 cd src/tests
59 ./runtests
60 %endif
61
62 %install
63 rm -rf $RPM_BUILD_ROOT
64 %{__make} install \
65         DESTDIR=$RPM_BUILD_ROOT
66
67 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
68
69 sed '
70         s/user = ""/user = "%{hitch_user}"/g;
71         s/group = ""/group = "%{hitch_group}"/g;
72         s/backend = "\[127.0.0.1\]:8000"/backend = "[127.0.0.1]:6081"/g;
73         s/syslog = off/syslog = on/g;
74         ' hitch.conf.ex > hitch.conf
75         sed -i 's/daemon = off/daemon = on/g;' hitch.conf
76
77 install -p -D hitch.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/hitch.conf
78 install -d $RPM_BUILD_ROOT%{hitch_homedir}
79 install -d $RPM_BUILD_ROOT%{hitch_datadir}
80 install -p -D hitch.service $RPM_BUILD_ROOT%{systemdunitdir}/hitch.service
81 install -p -D hitch.tmpfilesd.conf $RPM_BUILD_ROOT%{systemdtmpfilesdir}/hitch.conf
82 install -p -D hitch.initrc.redhat $RPM_BUILD_ROOT%{_initrddir}/hitch
83 install -d $RPM_BUILD_ROOT%{_localstatedir}/run/hitch
84 touch $RPM_BUILD_ROOT%{_localstatedir}/run/hitch/hitch.pid
85
86 %clean
87 rm -rf $RPM_BUILD_ROOT
88
89 %if 0
90 # TODO: register uid/gid
91 %pre
92 %groupadd -r %{hitch_group}
93 %useradd -r -g %{hitch_group} -s /sbin/nologin -d %{hitch_homedir} %{hitch_user}
94 %endif
95
96 %post
97 %systemd_post hitch.service
98 %tmpfiles_create %{systemdtmpfilesdir}/hitch.conf
99 /sbin/chkconfig --add hitch
100 %service hitch restart
101
102 %preun
103 %systemd_preun hitch.service
104 %service hitch stop
105 /sbin/chkconfig --del hitch
106
107 %postun
108 %systemd_postun_with_restart hitch.service
109
110 %files
111 %defattr(644,root,root,755)
112 %doc README.md LICENSE CHANGES.rst hitch.conf.ex
113 %dir %{_sysconfdir}/%{name}
114 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/hitch.conf
115 %attr(754,root,root) /etc/rc.d/init.d/hitch
116 %attr(755,root,root) %{_sbindir}/hitch
117 %{_mandir}/man8/hitch.8*
118 %{systemdunitdir}/hitch.service
119 %{systemdtmpfilesdir}/hitch.conf
120 %define no_install_post_check_tmpfiles 1
121 %attr(755,hitch,hitch) %dir %{_localstatedir}/run/hitch
122 %attr(644,hitch,hitch) %ghost %verify(not md5 mtime size)  %{_localstatedir}/run/hitch/hitch.pid
This page took 0.07618 seconds and 2 git commands to generate.