1 |
commit: 1e43be87033508e2d6161ceb62b241a872450e43 |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 25 15:09:53 2022 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 25 15:09:53 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e43be87 |
7 |
|
8 |
sci-geosciences/owntracks-recorder: New package at version 0.9.1 |
9 |
|
10 |
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> |
11 |
|
12 |
sci-geosciences/owntracks-recorder/Manifest | 1 + |
13 |
.../owntracks-recorder/files/ot-recorder.initd | 13 +++ |
14 |
.../files/owntracks-recorder-build.patch | 119 +++++++++++++++++++++ |
15 |
.../files/owntracks-recorder-no-mqtt.patch | 42 ++++++++ |
16 |
sci-geosciences/owntracks-recorder/metadata.xml | 21 ++++ |
17 |
.../owntracks-recorder-0.9.1.ebuild | 116 ++++++++++++++++++++ |
18 |
6 files changed, 312 insertions(+) |
19 |
|
20 |
diff --git a/sci-geosciences/owntracks-recorder/Manifest b/sci-geosciences/owntracks-recorder/Manifest |
21 |
new file mode 100644 |
22 |
index 000000000000..b001a519ba3b |
23 |
--- /dev/null |
24 |
+++ b/sci-geosciences/owntracks-recorder/Manifest |
25 |
@@ -0,0 +1 @@ |
26 |
+DIST owntracks-recorder-0.9.1.tar.gz 3306544 BLAKE2B 982764f6319bb9ae530d4eaf95679b26d98f64bb1b1a4c3c461cb3c17e76f27058836bc21bb014f16a37825636c34f6b90bec8890587b957a1741d27737812d5 SHA512 4a31acf648d7b9520eb7c08bbe318c2a63f2cd416f939a5ef7a052f9ab2dcfbdac1a69e71d02efbfa108ed2b5ee26019491845053344c37cc52c62d654075ee1 |
27 |
|
28 |
diff --git a/sci-geosciences/owntracks-recorder/files/ot-recorder.initd b/sci-geosciences/owntracks-recorder/files/ot-recorder.initd |
29 |
new file mode 100644 |
30 |
index 000000000000..e754531e0e43 |
31 |
--- /dev/null |
32 |
+++ b/sci-geosciences/owntracks-recorder/files/ot-recorder.initd |
33 |
@@ -0,0 +1,13 @@ |
34 |
+#!/sbin/openrc-run |
35 |
+# Copyright 2022 Gentoo Foundation |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+depend() { |
39 |
+ need net |
40 |
+} |
41 |
+ |
42 |
+name="OwnTracks Recorder" |
43 |
+pidfile="/run/${RC_SVCNAME}.pid" |
44 |
+command="/usr/sbin/ot-recorder" |
45 |
+command_user="owntracks" |
46 |
+command_background="yes" |
47 |
|
48 |
diff --git a/sci-geosciences/owntracks-recorder/files/owntracks-recorder-build.patch b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-build.patch |
49 |
new file mode 100644 |
50 |
index 000000000000..0209e73cef50 |
51 |
--- /dev/null |
52 |
+++ b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-build.patch |
53 |
@@ -0,0 +1,119 @@ |
54 |
+https://github.com/owntracks/recorder/pull/402 |
55 |
+ |
56 |
+diff --git a/Makefile b/Makefile |
57 |
+index f2b9a41..546dd58 100644 |
58 |
+--- a/Makefile |
59 |
++++ b/Makefile |
60 |
+@@ -1,6 +1,6 @@ |
61 |
+ include config.mk |
62 |
+ |
63 |
+-CFLAGS +=-Wall -Werror -DNS_ENABLE_IPV6 |
64 |
++CFLAGS += -Wall -DNS_ENABLE_IPV6 |
65 |
+ LIBS = $(MORELIBS) -lm |
66 |
+ LIBS += -lcurl -lconfig |
67 |
+ |
68 |
+@@ -23,10 +23,18 @@ CFLAGS += -DGHASHPREC=$(GHASHPREC) |
69 |
+ LIBS += -llmdb |
70 |
+ LIBS += -lpthread |
71 |
+ |
72 |
++define CPP_CONDITION |
73 |
++printf '#if $(1) \n |
74 |
++true \n |
75 |
++#else \n |
76 |
++#error false \n |
77 |
++#endif' | $(CPP) -P - >/dev/null 2>&1 && echo yes |
78 |
++endef |
79 |
++ |
80 |
+ ifeq ($(WITH_MQTT),yes) |
81 |
+ CFLAGS += -DWITH_MQTT=1 |
82 |
+- CFLAGS += $(MOSQUITTO_INC) |
83 |
+- LIBS += $(MOSQUITTO_LIB) -lmosquitto -lm |
84 |
++ CFLAGS += $(MOSQUITTO_CFLAGS) |
85 |
++ LIBS += $(MOSQUITTO_LIBS) -lm |
86 |
+ endif |
87 |
+ |
88 |
+ ifeq ($(WITH_PING),yes) |
89 |
+@@ -56,6 +64,12 @@ endif |
90 |
+ ifeq ($(WITH_TOURS),yes) |
91 |
+ CFLAGS += -DWITH_TOURS |
92 |
+ OTR_EXTRA_OBJS += |
93 |
++ |
94 |
++ # Debian requires uuid-dev |
95 |
++ # RHEL/CentOS needs libuuid-devel |
96 |
++ ifeq ($(shell $(call CPP_CONDITION,__linux__)),yes) |
97 |
++ LIBS += -luuid |
98 |
++ endif |
99 |
+ endif |
100 |
+ |
101 |
+ ifeq ($(WITH_GREENWICH),yes) |
102 |
+@@ -77,14 +91,16 @@ TARGETS += ot-recorder ocat |
103 |
+ GIT_VERSION := $(shell git describe --long --abbrev=10 --dirty --tags 2>/dev/null || echo "tarball") |
104 |
+ CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" |
105 |
+ |
106 |
++PKG_CONFIG ?= pkg-config |
107 |
++ |
108 |
+ all: $(TARGETS) |
109 |
+ |
110 |
+ ot-recorder: recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS) |
111 |
+- $(CC) $(CFLAGS) -o ot-recorder recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS) $(LIBS) |
112 |
++ $(CC) $(CFLAGS) $(LDFLAGS) -o ot-recorder recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS) $(LIBS) |
113 |
+ if test -r codesign.sh; then /bin/sh codesign.sh; fi |
114 |
+ |
115 |
+ ocat: ocat.o $(OTR_OBJS) |
116 |
+- $(CC) $(CFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS) |
117 |
++ $(CC) $(CFLAGS) $(LDFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS) |
118 |
+ |
119 |
+ $(OTR_OBJS): config.mk Makefile |
120 |
+ |
121 |
+@@ -114,8 +130,8 @@ install: ot-recorder ocat |
122 |
+ mkdir -p $(DESTDIR)$(INSTALLDIR)/bin |
123 |
+ mkdir -p $(DESTDIR)$(INSTALLDIR)/sbin |
124 |
+ mkdir -p $(DESTDIR)$(DOCROOT) |
125 |
+- mkdir -p $(DESTDIR)$(STORAGEDEFAULT)/last |
126 |
+- cp -R docroot/* $(DESTDIR)$(DOCROOT)/ |
127 |
++ mkdir -p $(DESTDIR)$(STORAGEDEFAULT) |
128 |
++ cd docroot && find ! -type d ! -name .gitignore -exec install -m0644 -D {} $(DESTDIR)$(DOCROOT)/{} \; |
129 |
+ install -m 0755 ot-recorder $(DESTDIR)$(INSTALLDIR)/sbin |
130 |
+ install -m 0755 ocat $(DESTDIR)$(INSTALLDIR)/bin |
131 |
+ mkdir -p `dirname $(DESTDIR)/$(CONFIGFILE)` |
132 |
+diff --git a/config.mk.in b/config.mk.in |
133 |
+index 6fd674d..9def768 100644 |
134 |
+--- a/config.mk.in |
135 |
++++ b/config.mk.in |
136 |
+@@ -40,7 +40,7 @@ WITH_MQTT ?= yes |
137 |
+ WITH_HTTP ?= yes |
138 |
+ |
139 |
+ # Do you want recorder support for shared views? Requires WITH_HTTP |
140 |
+-# also requires -luuid on Linux (see below at MORELIBS) |
141 |
++# also requires -luuid on Linux. |
142 |
+ WITH_TOURS ?= yes |
143 |
+ |
144 |
+ # Do you have Lua libraries installed and want the Lua hook integration? |
145 |
+@@ -90,12 +90,8 @@ JSON_INDENT ?= no |
146 |
+ CONFIGFILE = /etc/default/ot-recorder |
147 |
+ |
148 |
+ # Optionally specify the path to the Mosquitto libs, include here |
149 |
+-MOSQUITTO_INC = -I/usr/include |
150 |
+-MOSQUITTO_LIB = -L/usr/lib |
151 |
+- |
152 |
+-# Debian requires uuid-dev |
153 |
+-# RHEL/CentOS needs libuuid-devel |
154 |
+-MORELIBS += -luuid # -lssl |
155 |
++MOSQUITTO_CFLAGS = `$(PKG_CONFIG) --cflags libmosquitto` |
156 |
++MOSQUITTO_LIBS = `$(PKG_CONFIG) --libs libmosquitto` |
157 |
+ |
158 |
+ # Milliseconds (ms) timeout for reverse geocoding |
159 |
+ GEOCODE_TIMEOUT = 4000 |
160 |
+@@ -105,8 +101,8 @@ GEOCODE_TIMEOUT = 4000 |
161 |
+ # and in particular could require you to add the lua+version (e.g lua-5.2) |
162 |
+ # to both pkg-config invocations |
163 |
+ |
164 |
+-LUA_CFLAGS = `pkg-config --cflags lua` |
165 |
+-LUA_LIBS = `pkg-config --libs lua` |
166 |
++LUA_CFLAGS = `$(PKG_CONFIG) --cflags lua` |
167 |
++LUA_LIBS = `$(PKG_CONFIG) --libs lua` |
168 |
+ |
169 |
+-SODIUM_CFLAGS = `pkg-config --cflags libsodium` |
170 |
+-SODIUM_LIBS = `pkg-config --libs libsodium` |
171 |
++SODIUM_CFLAGS = `$(PKG_CONFIG) --cflags libsodium` |
172 |
++SODIUM_LIBS = `$(PKG_CONFIG) --libs libsodium` |
173 |
|
174 |
diff --git a/sci-geosciences/owntracks-recorder/files/owntracks-recorder-no-mqtt.patch b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-no-mqtt.patch |
175 |
new file mode 100644 |
176 |
index 000000000000..e10c160854a7 |
177 |
--- /dev/null |
178 |
+++ b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-no-mqtt.patch |
179 |
@@ -0,0 +1,42 @@ |
180 |
+From 2fe60c9684f93b67f549ed3d70f883a9a098fc7b Mon Sep 17 00:00:00 2001 |
181 |
+From: Jan-Piet Mens <jp@××××.de> |
182 |
+Date: Fri, 23 Sep 2022 22:10:48 +0200 |
183 |
+Subject: [PATCH] FIX: now compiles without MQTT addresses #401 |
184 |
+ |
185 |
+--- |
186 |
+ recorder.c | 4 ++++ |
187 |
+ 1 file changed, 4 insertions(+) |
188 |
+ |
189 |
+diff --git a/recorder.c b/recorder.c |
190 |
+index 12fa921..c65acef 100644 |
191 |
+--- a/recorder.c |
192 |
++++ b/recorder.c |
193 |
+@@ -494,10 +494,12 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char * |
194 |
+ return; |
195 |
+ } |
196 |
+ |
197 |
++#ifdef WITH_MQTT |
198 |
+ if ((js = json_stringify(resp, " ")) != NULL) { |
199 |
+ publish(ud, UB(fulltopic), js); |
200 |
+ free(js); |
201 |
+ } |
202 |
++#endif |
203 |
+ json_delete(resp); |
204 |
+ |
205 |
+ } else if (strcmp(request_type, "tours") == 0) { |
206 |
+@@ -558,10 +560,12 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char * |
207 |
+ return; |
208 |
+ } |
209 |
+ |
210 |
++#ifdef WITH_MQTT |
211 |
+ if ((js = json_stringify(resp, " ")) != NULL) { |
212 |
+ publish(ud, UB(fulltopic), js); |
213 |
+ free(js); |
214 |
+ } |
215 |
++#endif |
216 |
+ |
217 |
+ json_delete(resp); |
218 |
+ |
219 |
+-- |
220 |
+2.37.2 |
221 |
+ |
222 |
|
223 |
diff --git a/sci-geosciences/owntracks-recorder/metadata.xml b/sci-geosciences/owntracks-recorder/metadata.xml |
224 |
new file mode 100644 |
225 |
index 000000000000..2292ec7fa9c4 |
226 |
--- /dev/null |
227 |
+++ b/sci-geosciences/owntracks-recorder/metadata.xml |
228 |
@@ -0,0 +1,21 @@ |
229 |
+<?xml version="1.0" encoding="UTF-8"?> |
230 |
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
231 |
+<pkgmetadata> |
232 |
+ <maintainer type="person"> |
233 |
+ <email>chewi@g.o</email> |
234 |
+ <name>James Le Cuirot</name> |
235 |
+ </maintainer> |
236 |
+ <upstream> |
237 |
+ <remote-id type="github">owntracks/recorder</remote-id> |
238 |
+ </upstream> |
239 |
+ <use> |
240 |
+ <flag name="crypt">Enable support for payload encryption with <pkg>dev-libs/libsodium</pkg></flag> |
241 |
+ <flag name="greenwich">Enable support for the OwnTracks Greenwich firmware</flag> |
242 |
+ <flag name="http">Enable support for the built-in HTTP REST API</flag> |
243 |
+ <flag name="kill">Enable support removing data via the API (dangerous)</flag> |
244 |
+ <flag name="lua">Enable support for Lua hook integration</flag> |
245 |
+ <flag name="mqtt">Enable MQTT support</flag> |
246 |
+ <flag name="ping">Enable support for the "pingping" monitoring feature</flag> |
247 |
+ <flag name="tours">Enable recorder support for shared views</flag> |
248 |
+ </use> |
249 |
+</pkgmetadata> |
250 |
|
251 |
diff --git a/sci-geosciences/owntracks-recorder/owntracks-recorder-0.9.1.ebuild b/sci-geosciences/owntracks-recorder/owntracks-recorder-0.9.1.ebuild |
252 |
new file mode 100644 |
253 |
index 000000000000..c3bf48f119ed |
254 |
--- /dev/null |
255 |
+++ b/sci-geosciences/owntracks-recorder/owntracks-recorder-0.9.1.ebuild |
256 |
@@ -0,0 +1,116 @@ |
257 |
+# Copyright 2022 Gentoo Authors |
258 |
+# Distributed under the terms of the GNU General Public License v2 |
259 |
+ |
260 |
+EAPI=8 |
261 |
+ |
262 |
+LUA_COMPAT=( lua5-{3..4} ) |
263 |
+ |
264 |
+inherit lua-single prefix systemd toolchain-funcs |
265 |
+ |
266 |
+MY_PN="ot-recorder" |
267 |
+DESCRIPTION="Stores and accesses location data published by the OwnTracks apps" |
268 |
+HOMEPAGE="https://owntracks.org" |
269 |
+SRC_URI="https://github.com/${PN/-//}/archive/${PV}.tar.gz -> ${P}.tar.gz" |
270 |
+LICENSE="GPL-2+ MIT" |
271 |
+SLOT="0" |
272 |
+KEYWORDS="~amd64 ~arm" |
273 |
+IUSE="crypt +http greenwich kill lua +mqtt +ping +tours" |
274 |
+ |
275 |
+REQUIRED_USE=" |
276 |
+ lua? ( ${LUA_REQUIRED_USE} ) |
277 |
+ tours? ( http ) |
278 |
+" |
279 |
+ |
280 |
+IDEPEND=" |
281 |
+ acct-group/owntracks |
282 |
+ acct-user/owntracks |
283 |
+" |
284 |
+ |
285 |
+DEPEND=" |
286 |
+ dev-db/lmdb:= |
287 |
+ dev-libs/libconfig:= |
288 |
+ net-misc/curl |
289 |
+ crypt? ( dev-libs/libsodium:= ) |
290 |
+ lua? ( ${LUA_DEPS} ) |
291 |
+ mqtt? ( app-misc/mosquitto ) |
292 |
+ tours? ( sys-apps/util-linux ) |
293 |
+" |
294 |
+ |
295 |
+RDEPEND=" |
296 |
+ ${IDEPEND} |
297 |
+ ${DEPEND} |
298 |
+" |
299 |
+ |
300 |
+BDEPEND=" |
301 |
+ virtual/pkgconfig |
302 |
+" |
303 |
+ |
304 |
+S="${WORKDIR}/${P#*-}" |
305 |
+ |
306 |
+PATCHES=( |
307 |
+ "${FILESDIR}"/${PN}-no-mqtt.patch |
308 |
+ "${FILESDIR}"/${PN}-build.patch |
309 |
+) |
310 |
+ |
311 |
+pkg_setup() { |
312 |
+ use lua && lua-single_pkg_setup |
313 |
+} |
314 |
+ |
315 |
+src_prepare() { |
316 |
+ default |
317 |
+ hprefixify etc/${MY_PN}.service |
318 |
+ mv $(prefixify_ro config.mk.in) config.mk || die |
319 |
+} |
320 |
+ |
321 |
+src_configure() { |
322 |
+ myconf=( |
323 |
+ WITH_MQTT=$(usex mqtt) |
324 |
+ WITH_PING=$(usex ping) |
325 |
+ WITH_LUA=$(usex lua) |
326 |
+ WITH_ENCRYPT=$(usex crypt) |
327 |
+ WITH_KILL=$(usex kill) |
328 |
+ WITH_HTTP=$(usex http) |
329 |
+ WITH_TOURS=$(usex tours) |
330 |
+ WITH_GREENWICH=$(usex greenwich) |
331 |
+ |
332 |
+ CC="$(tc-getCC)" |
333 |
+ PKG_CONFIG="$(tc-getPKG_CONFIG)" |
334 |
+ INSTALLDIR="${EPREFIX}/usr" |
335 |
+ STORAGEDEFAULT="${EPREFIX}/var/db/${MY_PN}" |
336 |
+ DOCROOT="${EPREFIX}/var/www/${MY_PN}/htdocs" |
337 |
+ CONFIGFILE="${EPREFIX}/etc/${MY_PN}.conf" |
338 |
+ |
339 |
+ # The .pc file currently hardcodes "lib". |
340 |
+ MOSQUITTO_LIBS=-lmosquitto |
341 |
+ |
342 |
+ # Allow further customisation by users. |
343 |
+ "${OTR_CONF[@]}" |
344 |
+ ) |
345 |
+ |
346 |
+ use lua && myconf+=( |
347 |
+ LUA_CFLAGS="$(lua_get_CFLAGS)" |
348 |
+ LUA_LIBS="$(lua_get_LIBS)" |
349 |
+ ) |
350 |
+} |
351 |
+ |
352 |
+src_compile() { |
353 |
+ emake "${myconf[@]}" |
354 |
+} |
355 |
+ |
356 |
+src_install() { |
357 |
+ emake install "${myconf[@]}" DESTDIR="${ED}" |
358 |
+ dodoc *.md doc/*.md |
359 |
+ |
360 |
+ newinitd "${FILESDIR}"/${MY_PN}.initd ${MY_PN} |
361 |
+ systemd_dounit etc/${MY_PN}.service |
362 |
+ |
363 |
+ keepdir /var/db/${MY_PN} |
364 |
+} |
365 |
+ |
366 |
+pkg_preinst() { |
367 |
+ fowners owntracks:owntracks /var/db/${MY_PN} |
368 |
+ fperms 750 /var/db/${MY_PN} |
369 |
+ |
370 |
+ fowners root:owntracks /etc/${MY_PN}.conf |
371 |
+ fperms 0640 /etc/${MY_PN}.conf |
372 |
+} |