summaryrefslogtreecommitdiff
path: root/other/rpm
diff options
context:
space:
mode:
authorSmoked Cheese <root@ubuntology.ru>2018-01-15 14:23:33 +0300
committerGitHub <noreply@github.com>2018-01-15 14:23:33 +0300
commit402664f58d3b076a3715ddf0fdb6bb49c70c57b4 (patch)
treeada04209d97dbf9800d48e8e29490dc3c4b2c94d /other/rpm
parente16d3894c5979fcfe1c57bf7dadc455ce690baf9 (diff)
update rpm spec and use variables in cmake instead of hardcoded paths (#624)
Diffstat (limited to 'other/rpm')
-rw-r--r--other/rpm/Makefile32
-rw-r--r--other/rpm/tox-bootstrapd.service17
-rw-r--r--other/rpm/toxcore.spec.in126
3 files changed, 175 insertions, 0 deletions
diff --git a/other/rpm/Makefile b/other/rpm/Makefile
new file mode 100644
index 00000000..5e164717
--- /dev/null
+++ b/other/rpm/Makefile
@@ -0,0 +1,32 @@
1PROJECT_NAME = toxcore
2PROJECT_FULL_NAME = c-$(PROJECT_NAME)
3PROJECT_VERSION = $(shell git describe | sed -e 's/^v//' -e 's/-/_/g')
4PROJECT_COMMIT_ID = $(shell git rev-parse HEAD)
5PROJECT_COMMIT_ID_SHORT = $(shell git rev-parse --short HEAD)
6PROJECT_GIT_ROOT = $(shell git rev-parse --show-toplevel)
7
8all:
9 @echo available targets: spec srpm clean
10
11spec: toxcore.spec
12
13toxcore.spec:
14 sed -r \
15 -e 's#@PROJECT_NAME@#$(PROJECT_NAME)#g' \
16 -e 's#@PROJECT_VERSION@#$(PROJECT_VERSION)#' \
17 -e 's#^(%define commit )0$$#\1$(PROJECT_COMMIT_ID)#' \
18 toxcore.spec.in > toxcore.spec
19
20$(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz:
21 ( \
22 cd $(PROJECT_GIT_ROOT); \
23 git archive --prefix '$(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT)/' -o other/rpm/$(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz $(PROJECT_COMMIT_ID) \
24 )
25
26srpm: toxcore.spec $(PROJECT_FULL_NAME)-$(PROJECT_COMMIT_ID_SHORT).tar.gz
27 rpmbuild --define "_sourcedir ." --define "_srcrpmdir ." -bs toxcore.spec
28
29clean:
30 rm -f toxcore.spec *.tar.gz *.rpm
31
32.PHONY = clean srpm spec
diff --git a/other/rpm/tox-bootstrapd.service b/other/rpm/tox-bootstrapd.service
new file mode 100644
index 00000000..227c4497
--- /dev/null
+++ b/other/rpm/tox-bootstrapd.service
@@ -0,0 +1,17 @@
1[Unit]
2Description=Tox DHT Bootstrap Daemon
3After=network.target
4
5[Service]
6Type=forking
7RuntimeDirectory=tox-bootstrapd
8RuntimeDirectoryMode=750
9PIDFile=/var/run/tox-bootstrapd/tox-bootstrapd.pid
10WorkingDirectory=/var/lib/tox-bootstrapd
11ExecStart=/usr/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf
12User=tox-bootstrapd
13Group=tox-bootstrapd
14#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
15
16[Install]
17WantedBy=multi-user.target
diff --git a/other/rpm/toxcore.spec.in b/other/rpm/toxcore.spec.in
new file mode 100644
index 00000000..4c5132ce
--- /dev/null
+++ b/other/rpm/toxcore.spec.in
@@ -0,0 +1,126 @@
1%define full_name c-@PROJECT_NAME@
2%define commit 0
3%if "${commit}" != "0"
4%define shortcommit %(c=%{commit}; echo ${c:0:7})
5%endif
6
7Name: @PROJECT_NAME@
8Version: @PROJECT_VERSION@
9Release: 1%{?dist}
10Summary: All-in-one secure communication platform
11
12License: GPLv3
13URL: https://github.com/TokTok/%{full_name}
14%if "%{commit}" == "0"
15Source0: https://github.com/TokTok/%{full_name}/archive/v%{version}.tar.gz
16%else
17Source0: https://github.com/TokTok/%{full_name}/archive/%{commit}/%{full_name}-%{shortcommit}.tar.gz
18%endif
19
20BuildRequires: cmake
21BuildRequires: libvpx-devel
22BuildRequires: opus-devel
23BuildRequires: libsodium-devel
24BuildRequires: libconfig-devel
25BuildRequires: systemd-units
26
27%description
28With the rise of governmental monitoring programs, Tox, a FOSS initiative, aims
29to be an easy to use, all-in-one communication platform that ensures their users
30full privacy and secure message delivery.
31
32%package devel
33Summary: Development files for @PROJECT_NAME@
34Requires: %{name} = %{version}-%{release}
35
36%description devel
37Development package for @PROJECT_NAME@
38
39%package static
40Summary: @PROJECT_NAME@ static libraries
41Requires: %{name}-devel = %{version}-%{release}
42
43%description static
44@PROJECT_NAME@ static libraries
45
46%package -n tox-bootstrapd
47Summary: Tox DHT bootstrap daemon.
48Requires: %{name} = %{version}-%{release}
49Requires(pre): shadow-utils
50Requires(post): systemd-units
51Requires(preun): systemd-units
52Requires(postun): systemd-units
53
54%description -n tox-bootstrapd
55Tox DHT bootstrap daemon.
56
57%prep
58%if "%{commit}" == "0"
59%setup -q -n %{full_name}-%{version}
60%else
61%setup -q -n %{full_name}-%{commit}
62%endif
63
64%build
65%cmake
66%{__make} %{?_smp_mflags}
67
68%install
69%make_install
70mkdir -p %{buildroot}%{_unitdir}
71install -m 0644 other/rpm/tox-bootstrapd.service %{buildroot}%{_unitdir}/tox-bootstrapd.service
72install -d "%{buildroot}%{_sharedstatedir}/tox-bootstrapd"
73mkdir -p %{buildroot}%{_sysconfdir}
74install -m 0644 other/bootstrap_daemon/tox-bootstrapd.conf %{buildroot}%{_sysconfdir}/tox-bootstrapd.conf
75
76%check
77%{__make} %{?_smp_mflags} test
78
79%pre -n tox-bootstrapd
80getent group tox-bootstrapd >/dev/null || groupadd -r tox-bootstrapd
81getent passwd tox-bootstrapd >/dev/null || \
82 useradd -r -g tox-bootstrapd -d /var/lib/tox-bootstrapd -s /sbin/nologin \
83 -c "Account to run Tox's DHT bootstrap daemon" tox-bootstrapd
84
85%post -p /sbin/ldconfig
86
87%postun -p /sbin/ldconfig
88
89%post -n tox-bootstrapd
90%systemd_post tox-bootstrapd.service
91
92%postun -n tox-bootstrapd
93%systemd_postun_with_restart tox-bootstrapd.service
94
95%preun -n tox-bootstrapd
96%systemd_preun tox-bootstrapd.service
97
98%files
99%defattr(-, root, root)
100%doc COPYING README.md CHANGELOG.md
101%{_libdir}/libtoxcore.so*
102
103%files devel
104%defattr(-, root, root)
105%{_includedir}/tox/
106%{_libdir}/pkgconfig/toxcore.pc
107
108%files static
109%defattr(-, root, root)
110%{_libdir}/libtoxcore.a
111
112%files -n tox-bootstrapd
113%defattr(-, root, root)
114%{_bindir}/tox-bootstrapd
115%{_unitdir}/tox-bootstrapd.service
116%{_sharedstatedir}/tox-bootstrapd
117%attr(-,tox-bootstrapd,tox-bootstrapd) %{_sharedstatedir}/tox-bootstrapd/
118%config(noreplace) %{_sysconfdir}/tox-bootstrapd.conf
119
120
121%changelog
122* Sat Nov 25 2017 SmokedCheese <root@ubuntology.ru> - 0.0.0-2
123- Rewrite spec file
124
125* Tue Mar 3 2015 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc> - 0.0.0-1
126- initial package