summaryrefslogtreecommitdiff
path: root/coturn.spec
blob: f4b296bf55fb2813e0efcf40643c5480f3aaafd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
%bcond_without sqlite
%bcond_with postgresql
%bcond_with mysql
%bcond_with mongodb
%bcond_with redis

Name:          coturn
Version:       4.5.0.8
Release:       1%{?dist}
Summary:       TURN server

License:       BSD
URL:           https://github.com/coturn/coturn
Source0:       https://github.com/coturn/coturn/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source10:      turnserver.sysconfig
Source11:      turnserver.service
Source12:      turnserver-tmpfiles.conf
Patch0:        0000-pkg-config.patch

BuildRequires: gcc
BuildRequires: libevent-devel >= 2.0
BuildRequires: openssl-devel
BuildRequires: systemd-devel
%if %{with sqlite}
BuildRequires: sqlite-devel
%endif
%if %{with postgresql}
BuildRequires: postgresql-devel
%endif
%if %{with mysql}
BuildRequires: mariadb-devel
%endif
%if %{with mongodb}
BuildRequires: mongo-c-driver-devel
%endif
%if %{with redis}
BuildRequires: hiredis-devel
%endif

%description
The TURN Server is a VoIP media traffic NAT traversal server and gateway. It can be used as a general-purpose network traffic TURN server and gateway, too.

%package static
Summary:       ...
%description static
...

%package utils
Summary:       ...
%description utils
...

%package server
Requires(pre): shadow-utils
Summary:       ...
%description server
...

%package examples
Summary:       ...
%description examples
...

%prep
%setup -q
%patch0 -p1

%build
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
TURN_NO_SQLITE=%{!?with_sqlite:1} \
TURN_NO_PQ=%{!?with_postgresql:1} \
TURN_NO_MYSQL=%{!?with_mysql:1} \
TURN_NO_MONGO=%{!?with_mongodb:1} \
TURN_NO_HIREDIS=%{!?with_redis:1} \
./configure \
	--prefix=%{_prefix} \
	--bindir=%{_bindir} \
	--sysconfdir=%{_sysconfdir} \
	--docdir=%{_docdir}/turnserver \
	--datadir=%{_datadir}/turnserver \
	--examplesdir=%{_docdir}/turnserver/examples \
	--includedir=%{_includedir} \
	--libdir=%{_libdir} \
	--libexecdir=%{_libexecdir} \
	--localstatedir=%{_localstatedir} \
	--mandir=%{_datadir} \
	--turndbdir=%{_localstatedir}/lib/turnserver \
	--disable-rpath

make %{?_smp_mflags}


%install
%make_install
rm %{buildroot}%{_docdir}/turnserver/{schema.mongo.sh,schema.sql,schema.stats.redis,schema.userdb.redis}
mv %{buildroot}%{_sysconfdir}/turnserver.conf{.default,}
diff -q %{buildroot}%{_bindir}/{turnserver,turnadmin}
ln -f %{buildroot}%{_bindir}/{turnserver,turnadmin}
%if %{with sqlite}
rm %{buildroot}%{_localstatedir}/lib/turnserver/turndb
%endif

install -Dm0644 %SOURCE10 %{buildroot}%{_sysconfdir}/sysconfig/turnserver 
install -Dm0644 %SOURCE11 %{buildroot}%{_unitdir}/turnserver.service
install -Dm0644 %SOURCE12 %{buildroot}%{_tmpfilesdir}/turnserver.conf

chmod a-x %{buildroot}%{_mandir}/*/*
chmod a-x %{buildroot}%{_libdir}/*.a

%pre server
getent group turnserver >/dev/null 2>&1 || groupadd -r turnserver 2>&1 || :
getent passwd turnserver >/dev/null 2>&1 || useradd -r -l -g turnserver -G turnserver -d %{_localstatedir}/lib/turnserver -s /sbin/nologin -c "coturn TURN server" turnserver >/dev/null 2>&1 || :

%post server
systemd-tmpfiles --create >/dev/null 2>&1 || :
%systemd_post turnserver.service

%preun server
%systemd_preun turnserver.service

%postun server
%systemd_postun turnserver.service

%files static
%{_includedir}/turn
%{_libdir}/libturnclient.a

%files utils
%{_bindir}/turnutils_natdiscovery
%{_bindir}/turnutils_oauth
%{_bindir}/turnutils_peer
%{_bindir}/turnutils_stunclient
%{_bindir}/turnutils_uclient
%{_mandir}/man1/turnutils.1.gz
%{_mandir}/man1/turnutils_natdiscovery.1.gz
%{_mandir}/man1/turnutils_oauth.1.gz
%{_mandir}/man1/turnutils_peer.1.gz
%{_mandir}/man1/turnutils_stunclient.1.gz
%{_mandir}/man1/turnutils_uclient.1.gz

%files server
%attr (0644, root, root) %config(noreplace) %{_sysconfdir}/turnserver.conf
%{_bindir}/turnadmin
%{_bindir}/turnserver
%{_datadir}/turnserver
%{_docdir}/turnserver
%exclude %{_docdir}/turnserver/examples
%{_mandir}/man1/coturn.1.gz
%{_mandir}/man1/turnadmin.1.gz
%{_mandir}/man1/turnserver.1.gz
%attr (0750, turnserver, turnserver) %dir /var/lib/turnserver
%config(noreplace) %{_sysconfdir}/sysconfig/turnserver
%{_unitdir}/turnserver.service
%{_tmpfilesdir}/turnserver.conf

%files examples
%{_docdir}/turnserver/examples