summaryrefslogtreecommitdiff
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
parente16d3894c5979fcfe1c57bf7dadc455ce690baf9 (diff)
update rpm spec and use variables in cmake instead of hardcoded paths (#624)
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt12
-rw-r--r--circle.yml2
-rw-r--r--cmake/ModulePackage.cmake12
-rw-r--r--other/pkgconfig/toxcore.pc.in4
-rw-r--r--other/rpm/Makefile32
-rw-r--r--other/rpm/tox-bootstrapd.service17
-rw-r--r--other/rpm/toxcore.spec.in126
8 files changed, 197 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 14dcced7..b62599ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ Thumbs.db
16CMakeCache.txt 16CMakeCache.txt
17CMakeFiles 17CMakeFiles
18Makefile 18Makefile
19!/other/rpm/Makefile
19cmake_install.cmake 20cmake_install.cmake
20install_manifest.txt 21install_manifest.txt
21tags 22tags
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc846554..d6302051 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,9 +54,13 @@ message("SOVERSION: ${SOVERSION}")
54 54
55include(AddCompilerFlag) 55include(AddCompilerFlag)
56include(ApiDsl) 56include(ApiDsl)
57include(MacRpath)
58include(ModulePackage) 57include(ModulePackage)
59include(StrictAbi) 58include(StrictAbi)
59include(GNUInstallDirs)
60
61if(APPLE)
62 include(MacRpath)
63endif()
60 64
61enable_testing() 65enable_testing()
62 66
@@ -374,9 +378,9 @@ endforeach()
374# Make version script (on systems that support it) to limit symbol visibility. 378# Make version script (on systems that support it) to limit symbol visibility.
375make_version_script(toxcore ${toxcore_API_HEADERS}) 379make_version_script(toxcore ${toxcore_API_HEADERS})
376 380
377# Generate pkg-config file, install library to "lib" and install headers to 381# Generate pkg-config file, install library to "${CMAKE_INSTALL_LIBDIR}" and install headers to
378# "include/tox". 382# "${CMAKE_INSTALL_INCLUDEDIR}/tox".
379install_module(toxcore DESTINATION "include/tox") 383install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tox)
380 384
381################################################################################ 385################################################################################
382# 386#
diff --git a/circle.yml b/circle.yml
index e83dd7ed..002aea98 100644
--- a/circle.yml
+++ b/circle.yml
@@ -20,6 +20,8 @@ dependencies:
20 - sudo bash -c "echo '::1 localhost ipv6-localhost ipv6-loopback' >> /etc/hosts" # ipv6 localhost entry 20 - sudo bash -c "echo '::1 localhost ipv6-localhost ipv6-loopback' >> /etc/hosts" # ipv6 localhost entry
21# ------------ network_test requires that "localhost" resolves to ::1 ------------ 21# ------------ network_test requires that "localhost" resolves to ::1 ------------
22 22
23 - sudo bash -c "echo /usr/local/lib/x86_64-linux-gnu > /etc/ld.so.conf.d/fix685519.conf" # fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685519
24
23 - java -version ; exit 0 25 - java -version ; exit 0
24 - gcc --version ; exit 0 26 - gcc --version ; exit 0
25 - clang --version ; exit 0 27 - clang --version ; exit 0
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake
index c38e7de0..7a96abcf 100644
--- a/cmake/ModulePackage.cmake
+++ b/cmake/ModulePackage.cmake
@@ -89,10 +89,10 @@ function(install_module lib)
89 VERSION ${SOVERSION} 89 VERSION ${SOVERSION}
90 SOVERSION ${SOVERSION_MAJOR} 90 SOVERSION ${SOVERSION_MAJOR}
91 ) 91 )
92 install(TARGETS ${lib}_shared DESTINATION "lib") 92 install(TARGETS ${lib}_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
93 endif() 93 endif()
94 if(ENABLE_STATIC) 94 if(ENABLE_STATIC)
95 install(TARGETS ${lib}_static DESTINATION "lib") 95 install(TARGETS ${lib}_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
96 endif() 96 endif()
97 97
98 string(REPLACE ";" " " ${lib}_PKGCONFIG_LIBS "${${lib}_PKGCONFIG_LIBS}") 98 string(REPLACE ";" " " ${lib}_PKGCONFIG_LIBS "${${lib}_PKGCONFIG_LIBS}")
@@ -104,9 +104,15 @@ function(install_module lib)
104 @ONLY 104 @ONLY
105 ) 105 )
106 106
107 configure_file(
108 "${toxcore_SOURCE_DIR}/other/rpm/${lib}.spec.in"
109 "${CMAKE_BINARY_DIR}/${lib}.spec"
110 @ONLY
111 )
112
107 install(FILES 113 install(FILES
108 ${CMAKE_BINARY_DIR}/${lib}.pc 114 ${CMAKE_BINARY_DIR}/${lib}.pc
109 DESTINATION "lib/pkgconfig") 115 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
110 116
111 foreach(sublib ${${lib}_API_HEADERS}) 117 foreach(sublib ${${lib}_API_HEADERS})
112 string(REPLACE "^" ";" sublib ${sublib}) 118 string(REPLACE "^" ";" sublib ${sublib})
diff --git a/other/pkgconfig/toxcore.pc.in b/other/pkgconfig/toxcore.pc.in
index 55b3b10a..b53fa48c 100644
--- a/other/pkgconfig/toxcore.pc.in
+++ b/other/pkgconfig/toxcore.pc.in
@@ -1,6 +1,6 @@
1prefix=@CMAKE_INSTALL_PREFIX@ 1prefix=@CMAKE_INSTALL_PREFIX@
2libdir=${prefix}/lib 2libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
3includedir=${prefix}/include 3includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4 4
5Name: toxcore 5Name: toxcore
6Description: Tox protocol library 6Description: Tox protocol library
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