* [gentoo-commits] repo/gentoo:master commit in: sci-geosciences/owntracks-recorder/, sci-geosciences/owntracks-recorder/files/
@ 2022-09-25 15:10 James Le Cuirot
0 siblings, 0 replies; only message in thread
From: James Le Cuirot @ 2022-09-25 15:10 UTC (permalink / raw
To: gentoo-commits
commit: 1e43be87033508e2d6161ceb62b241a872450e43
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 25 15:09:53 2022 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Sep 25 15:09:53 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e43be87
sci-geosciences/owntracks-recorder: New package at version 0.9.1
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
sci-geosciences/owntracks-recorder/Manifest | 1 +
.../owntracks-recorder/files/ot-recorder.initd | 13 +++
.../files/owntracks-recorder-build.patch | 119 +++++++++++++++++++++
.../files/owntracks-recorder-no-mqtt.patch | 42 ++++++++
sci-geosciences/owntracks-recorder/metadata.xml | 21 ++++
.../owntracks-recorder-0.9.1.ebuild | 116 ++++++++++++++++++++
6 files changed, 312 insertions(+)
diff --git a/sci-geosciences/owntracks-recorder/Manifest b/sci-geosciences/owntracks-recorder/Manifest
new file mode 100644
index 000000000000..b001a519ba3b
--- /dev/null
+++ b/sci-geosciences/owntracks-recorder/Manifest
@@ -0,0 +1 @@
+DIST owntracks-recorder-0.9.1.tar.gz 3306544 BLAKE2B 982764f6319bb9ae530d4eaf95679b26d98f64bb1b1a4c3c461cb3c17e76f27058836bc21bb014f16a37825636c34f6b90bec8890587b957a1741d27737812d5 SHA512 4a31acf648d7b9520eb7c08bbe318c2a63f2cd416f939a5ef7a052f9ab2dcfbdac1a69e71d02efbfa108ed2b5ee26019491845053344c37cc52c62d654075ee1
diff --git a/sci-geosciences/owntracks-recorder/files/ot-recorder.initd b/sci-geosciences/owntracks-recorder/files/ot-recorder.initd
new file mode 100644
index 000000000000..e754531e0e43
--- /dev/null
+++ b/sci-geosciences/owntracks-recorder/files/ot-recorder.initd
@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+# Copyright 2022 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need net
+}
+
+name="OwnTracks Recorder"
+pidfile="/run/${RC_SVCNAME}.pid"
+command="/usr/sbin/ot-recorder"
+command_user="owntracks"
+command_background="yes"
diff --git a/sci-geosciences/owntracks-recorder/files/owntracks-recorder-build.patch b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-build.patch
new file mode 100644
index 000000000000..0209e73cef50
--- /dev/null
+++ b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-build.patch
@@ -0,0 +1,119 @@
+https://github.com/owntracks/recorder/pull/402
+
+diff --git a/Makefile b/Makefile
+index f2b9a41..546dd58 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ include config.mk
+
+-CFLAGS +=-Wall -Werror -DNS_ENABLE_IPV6
++CFLAGS += -Wall -DNS_ENABLE_IPV6
+ LIBS = $(MORELIBS) -lm
+ LIBS += -lcurl -lconfig
+
+@@ -23,10 +23,18 @@ CFLAGS += -DGHASHPREC=$(GHASHPREC)
+ LIBS += -llmdb
+ LIBS += -lpthread
+
++define CPP_CONDITION
++printf '#if $(1) \n
++true \n
++#else \n
++#error false \n
++#endif' | $(CPP) -P - >/dev/null 2>&1 && echo yes
++endef
++
+ ifeq ($(WITH_MQTT),yes)
+ CFLAGS += -DWITH_MQTT=1
+- CFLAGS += $(MOSQUITTO_INC)
+- LIBS += $(MOSQUITTO_LIB) -lmosquitto -lm
++ CFLAGS += $(MOSQUITTO_CFLAGS)
++ LIBS += $(MOSQUITTO_LIBS) -lm
+ endif
+
+ ifeq ($(WITH_PING),yes)
+@@ -56,6 +64,12 @@ endif
+ ifeq ($(WITH_TOURS),yes)
+ CFLAGS += -DWITH_TOURS
+ OTR_EXTRA_OBJS +=
++
++ # Debian requires uuid-dev
++ # RHEL/CentOS needs libuuid-devel
++ ifeq ($(shell $(call CPP_CONDITION,__linux__)),yes)
++ LIBS += -luuid
++ endif
+ endif
+
+ ifeq ($(WITH_GREENWICH),yes)
+@@ -77,14 +91,16 @@ TARGETS += ot-recorder ocat
+ GIT_VERSION := $(shell git describe --long --abbrev=10 --dirty --tags 2>/dev/null || echo "tarball")
+ CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
+
++PKG_CONFIG ?= pkg-config
++
+ all: $(TARGETS)
+
+ ot-recorder: recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS)
+- $(CC) $(CFLAGS) -o ot-recorder recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o ot-recorder recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS) $(LIBS)
+ if test -r codesign.sh; then /bin/sh codesign.sh; fi
+
+ ocat: ocat.o $(OTR_OBJS)
+- $(CC) $(CFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS)
+
+ $(OTR_OBJS): config.mk Makefile
+
+@@ -114,8 +130,8 @@ install: ot-recorder ocat
+ mkdir -p $(DESTDIR)$(INSTALLDIR)/bin
+ mkdir -p $(DESTDIR)$(INSTALLDIR)/sbin
+ mkdir -p $(DESTDIR)$(DOCROOT)
+- mkdir -p $(DESTDIR)$(STORAGEDEFAULT)/last
+- cp -R docroot/* $(DESTDIR)$(DOCROOT)/
++ mkdir -p $(DESTDIR)$(STORAGEDEFAULT)
++ cd docroot && find ! -type d ! -name .gitignore -exec install -m0644 -D {} $(DESTDIR)$(DOCROOT)/{} \;
+ install -m 0755 ot-recorder $(DESTDIR)$(INSTALLDIR)/sbin
+ install -m 0755 ocat $(DESTDIR)$(INSTALLDIR)/bin
+ mkdir -p `dirname $(DESTDIR)/$(CONFIGFILE)`
+diff --git a/config.mk.in b/config.mk.in
+index 6fd674d..9def768 100644
+--- a/config.mk.in
++++ b/config.mk.in
+@@ -40,7 +40,7 @@ WITH_MQTT ?= yes
+ WITH_HTTP ?= yes
+
+ # Do you want recorder support for shared views? Requires WITH_HTTP
+-# also requires -luuid on Linux (see below at MORELIBS)
++# also requires -luuid on Linux.
+ WITH_TOURS ?= yes
+
+ # Do you have Lua libraries installed and want the Lua hook integration?
+@@ -90,12 +90,8 @@ JSON_INDENT ?= no
+ CONFIGFILE = /etc/default/ot-recorder
+
+ # Optionally specify the path to the Mosquitto libs, include here
+-MOSQUITTO_INC = -I/usr/include
+-MOSQUITTO_LIB = -L/usr/lib
+-
+-# Debian requires uuid-dev
+-# RHEL/CentOS needs libuuid-devel
+-MORELIBS += -luuid # -lssl
++MOSQUITTO_CFLAGS = `$(PKG_CONFIG) --cflags libmosquitto`
++MOSQUITTO_LIBS = `$(PKG_CONFIG) --libs libmosquitto`
+
+ # Milliseconds (ms) timeout for reverse geocoding
+ GEOCODE_TIMEOUT = 4000
+@@ -105,8 +101,8 @@ GEOCODE_TIMEOUT = 4000
+ # and in particular could require you to add the lua+version (e.g lua-5.2)
+ # to both pkg-config invocations
+
+-LUA_CFLAGS = `pkg-config --cflags lua`
+-LUA_LIBS = `pkg-config --libs lua`
++LUA_CFLAGS = `$(PKG_CONFIG) --cflags lua`
++LUA_LIBS = `$(PKG_CONFIG) --libs lua`
+
+-SODIUM_CFLAGS = `pkg-config --cflags libsodium`
+-SODIUM_LIBS = `pkg-config --libs libsodium`
++SODIUM_CFLAGS = `$(PKG_CONFIG) --cflags libsodium`
++SODIUM_LIBS = `$(PKG_CONFIG) --libs libsodium`
diff --git a/sci-geosciences/owntracks-recorder/files/owntracks-recorder-no-mqtt.patch b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-no-mqtt.patch
new file mode 100644
index 000000000000..e10c160854a7
--- /dev/null
+++ b/sci-geosciences/owntracks-recorder/files/owntracks-recorder-no-mqtt.patch
@@ -0,0 +1,42 @@
+From 2fe60c9684f93b67f549ed3d70f883a9a098fc7b Mon Sep 17 00:00:00 2001
+From: Jan-Piet Mens <jp@mens.de>
+Date: Fri, 23 Sep 2022 22:10:48 +0200
+Subject: [PATCH] FIX: now compiles without MQTT addresses #401
+
+---
+ recorder.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/recorder.c b/recorder.c
+index 12fa921..c65acef 100644
+--- a/recorder.c
++++ b/recorder.c
+@@ -494,10 +494,12 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
+ return;
+ }
+
++#ifdef WITH_MQTT
+ if ((js = json_stringify(resp, " ")) != NULL) {
+ publish(ud, UB(fulltopic), js);
+ free(js);
+ }
++#endif
+ json_delete(resp);
+
+ } else if (strcmp(request_type, "tours") == 0) {
+@@ -558,10 +560,12 @@ void do_request(struct udata *ud, UT_string *username, UT_string *device, char *
+ return;
+ }
+
++#ifdef WITH_MQTT
+ if ((js = json_stringify(resp, " ")) != NULL) {
+ publish(ud, UB(fulltopic), js);
+ free(js);
+ }
++#endif
+
+ json_delete(resp);
+
+--
+2.37.2
+
diff --git a/sci-geosciences/owntracks-recorder/metadata.xml b/sci-geosciences/owntracks-recorder/metadata.xml
new file mode 100644
index 000000000000..2292ec7fa9c4
--- /dev/null
+++ b/sci-geosciences/owntracks-recorder/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>chewi@gentoo.org</email>
+ <name>James Le Cuirot</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">owntracks/recorder</remote-id>
+ </upstream>
+ <use>
+ <flag name="crypt">Enable support for payload encryption with <pkg>dev-libs/libsodium</pkg></flag>
+ <flag name="greenwich">Enable support for the OwnTracks Greenwich firmware</flag>
+ <flag name="http">Enable support for the built-in HTTP REST API</flag>
+ <flag name="kill">Enable support removing data via the API (dangerous)</flag>
+ <flag name="lua">Enable support for Lua hook integration</flag>
+ <flag name="mqtt">Enable MQTT support</flag>
+ <flag name="ping">Enable support for the "pingping" monitoring feature</flag>
+ <flag name="tours">Enable recorder support for shared views</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-geosciences/owntracks-recorder/owntracks-recorder-0.9.1.ebuild b/sci-geosciences/owntracks-recorder/owntracks-recorder-0.9.1.ebuild
new file mode 100644
index 000000000000..c3bf48f119ed
--- /dev/null
+++ b/sci-geosciences/owntracks-recorder/owntracks-recorder-0.9.1.ebuild
@@ -0,0 +1,116 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LUA_COMPAT=( lua5-{3..4} )
+
+inherit lua-single prefix systemd toolchain-funcs
+
+MY_PN="ot-recorder"
+DESCRIPTION="Stores and accesses location data published by the OwnTracks apps"
+HOMEPAGE="https://owntracks.org"
+SRC_URI="https://github.com/${PN/-//}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+LICENSE="GPL-2+ MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm"
+IUSE="crypt +http greenwich kill lua +mqtt +ping +tours"
+
+REQUIRED_USE="
+ lua? ( ${LUA_REQUIRED_USE} )
+ tours? ( http )
+"
+
+IDEPEND="
+ acct-group/owntracks
+ acct-user/owntracks
+"
+
+DEPEND="
+ dev-db/lmdb:=
+ dev-libs/libconfig:=
+ net-misc/curl
+ crypt? ( dev-libs/libsodium:= )
+ lua? ( ${LUA_DEPS} )
+ mqtt? ( app-misc/mosquitto )
+ tours? ( sys-apps/util-linux )
+"
+
+RDEPEND="
+ ${IDEPEND}
+ ${DEPEND}
+"
+
+BDEPEND="
+ virtual/pkgconfig
+"
+
+S="${WORKDIR}/${P#*-}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-no-mqtt.patch
+ "${FILESDIR}"/${PN}-build.patch
+)
+
+pkg_setup() {
+ use lua && lua-single_pkg_setup
+}
+
+src_prepare() {
+ default
+ hprefixify etc/${MY_PN}.service
+ mv $(prefixify_ro config.mk.in) config.mk || die
+}
+
+src_configure() {
+ myconf=(
+ WITH_MQTT=$(usex mqtt)
+ WITH_PING=$(usex ping)
+ WITH_LUA=$(usex lua)
+ WITH_ENCRYPT=$(usex crypt)
+ WITH_KILL=$(usex kill)
+ WITH_HTTP=$(usex http)
+ WITH_TOURS=$(usex tours)
+ WITH_GREENWICH=$(usex greenwich)
+
+ CC="$(tc-getCC)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ INSTALLDIR="${EPREFIX}/usr"
+ STORAGEDEFAULT="${EPREFIX}/var/db/${MY_PN}"
+ DOCROOT="${EPREFIX}/var/www/${MY_PN}/htdocs"
+ CONFIGFILE="${EPREFIX}/etc/${MY_PN}.conf"
+
+ # The .pc file currently hardcodes "lib".
+ MOSQUITTO_LIBS=-lmosquitto
+
+ # Allow further customisation by users.
+ "${OTR_CONF[@]}"
+ )
+
+ use lua && myconf+=(
+ LUA_CFLAGS="$(lua_get_CFLAGS)"
+ LUA_LIBS="$(lua_get_LIBS)"
+ )
+}
+
+src_compile() {
+ emake "${myconf[@]}"
+}
+
+src_install() {
+ emake install "${myconf[@]}" DESTDIR="${ED}"
+ dodoc *.md doc/*.md
+
+ newinitd "${FILESDIR}"/${MY_PN}.initd ${MY_PN}
+ systemd_dounit etc/${MY_PN}.service
+
+ keepdir /var/db/${MY_PN}
+}
+
+pkg_preinst() {
+ fowners owntracks:owntracks /var/db/${MY_PN}
+ fperms 750 /var/db/${MY_PN}
+
+ fowners root:owntracks /etc/${MY_PN}.conf
+ fperms 0640 /etc/${MY_PN}.conf
+}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-25 15:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-25 15:10 [gentoo-commits] repo/gentoo:master commit in: sci-geosciences/owntracks-recorder/, sci-geosciences/owntracks-recorder/files/ James Le Cuirot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox