aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ptpd
diff options
context:
space:
mode:
authorALTracer <tolstov_den@mail.ru>2021-02-11 14:54:00 +0300
committerLeo <thinkabit.ukim@gmail.com>2021-02-12 17:16:17 +0000
commit48d263bff698e639588736a56bcd699321b92b86 (patch)
treefc3df4185f1c50f756e02c0c5f152270dc92ae5b /testing/ptpd
parent37b03f8129f223896e9aa110468bc2fa562828e9 (diff)
testing/ptpd: new aport
https://github.com/ptpd/ptpd Precision Time Protocol daemon
Diffstat (limited to 'testing/ptpd')
-rw-r--r--testing/ptpd/APKBUILD48
-rw-r--r--testing/ptpd/ptpd-2.3.1-fix-libressl-compatibility.patch24
-rw-r--r--testing/ptpd/ptpd-2.3.1-fix-snmp.patch12
-rw-r--r--testing/ptpd/ptpd2.confd4
-rw-r--r--testing/ptpd/ptpd2.rc56
5 files changed, 144 insertions, 0 deletions
diff --git a/testing/ptpd/APKBUILD b/testing/ptpd/APKBUILD
new file mode 100644
index 00000000000..eafd866f41e
--- /dev/null
+++ b/testing/ptpd/APKBUILD
@@ -0,0 +1,48 @@
+# Contributor: Denis Tolstov <tolstov_den@mail.ru>
+# Maintainer: Denis Tolstov <tolstov_den@mail.ru>
+pkgname=ptpd
+pkgver=2.3.1
+pkgrel=0
+pkgdesc="Precision Time Protocol daemon"
+options="!check" # No testsuite
+url="https://github.com/ptpd/ptpd"
+arch="all"
+license="BSD-2-Clause"
+makedepends="autoconf automake libtool
+ libpcap-dev net-snmp-dev linux-headers"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="https://github.com/ptpd/ptpd/archive/ptpd-$pkgver.tar.gz
+ ptpd-2.3.1-fix-libressl-compatibility.patch
+ ptpd-2.3.1-fix-snmp.patch
+
+ ptpd2.rc
+ ptpd2.confd"
+builddir="$srcdir/ptpd-$pkgname-$pkgver"
+
+prepare() {
+ default_prepare
+ autoreconf -fi
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --enable-daemon
+ make
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+
+ install -Dm755 src/ptpd2.conf.minimal "$pkgdir"/etc/ptpd2.conf
+ install -Dm755 "$srcdir"/ptpd2.rc "$pkgdir"/etc/init.d/ptpd2
+ install -Dm755 "$srcdir"/ptpd2.confd "$pkgdir"/etc/conf.d/ptpd2
+}
+
+sha512sums="25c128ce1920ae2c1469e986bfa5d5b8ebca04ec14b838fb8232b36e0a1ef94646507e1b25034846d11cf0f71d7e2da983b9f6408f8fcfc608904ecfec2a15c4 ptpd-2.3.1.tar.gz
+19b6c3b3e248514d3374ac17f37070f60b43b5ba8d38b7564abd00896e2aecc29813f9a36bba2da7be33d6ff47aa029644d735f4325e948fe73ba81b466abc1d ptpd-2.3.1-fix-libressl-compatibility.patch
+40e6f89dc922da9b3a68f7513a4d08f8708a1f4ebb87147c6ab3e6a75d8aaa5a627045e967c5256445897175205c7b95e77f0ca7322062fa6265b7e909097978 ptpd-2.3.1-fix-snmp.patch
+37af776a265fbabdabed381d98cf50d78a512634fd84ce07466a47a0e96a6b2cccfb762732a043139b6c136eefdc6443ab9a5cba1c30234b6c66acc23e98a5b2 ptpd2.rc
+40ea56a92222eb10dc429343a23bdcc0e75f626e34fea139a09ca545a50aee0550253965de036218889554a2c0c7928c0051e3e71d9b9cd0a9d44d334e0bac47 ptpd2.confd"
diff --git a/testing/ptpd/ptpd-2.3.1-fix-libressl-compatibility.patch b/testing/ptpd/ptpd-2.3.1-fix-libressl-compatibility.patch
new file mode 100644
index 00000000000..4fa25797ff0
--- /dev/null
+++ b/testing/ptpd/ptpd-2.3.1-fix-libressl-compatibility.patch
@@ -0,0 +1,24 @@
+diff -urN old/src/dep/ntpengine/ntp_isc_md5.c new/src/dep/ntpengine/ntp_isc_md5.c
+--- old/src/dep/ntpengine/ntp_isc_md5.c 2015-06-29 17:13:29.000000000 +0200
++++ new/src/dep/ntpengine/ntp_isc_md5.c 2018-09-15 22:56:18.469044902 +0200
+@@ -262,7 +262,7 @@
+ {
+ u_char digest[64];
+ u_int len;
+- EVP_MD_CTX ctx;
++ PTPD_EVP_MD_CTX ctx;
+ pkt[length / 4] = htonl(keyid);
+ EVP_DigestInit(&ctx);
+ EVP_DigestUpdate(&ctx, (u_char *)key, (u_int)strlen(key));
+diff -urN old/src/dep/ntpengine/ntp_isc_md5.h new/src/dep/ntpengine/ntp_isc_md5.h
+--- old/src/dep/ntpengine/ntp_isc_md5.h 2015-06-29 17:13:29.000000000 +0200
++++ new/src/dep/ntpengine/ntp_isc_md5.h 2018-09-15 22:56:11.852020732 +0200
+@@ -80,7 +80,7 @@
+ # define MD5Init(c) isc_md5_init(c)
+ # define MD5Update(c, p, s) isc_md5_update(c, p, s)
+ # define MD5Final(d, c) isc_md5_final((c), (d)) /* swapped */
+- typedef MD5_CTX EVP_MD_CTX;
++ typedef MD5_CTX PTPD_EVP_MD_CTX;
+ # define EVP_DigestInit(c) MD5Init(c)
+ # define EVP_DigestUpdate(c, p, s) MD5Update(c, p, s)
+ # define EVP_DigestFinal(c, d, pdl) \
diff --git a/testing/ptpd/ptpd-2.3.1-fix-snmp.patch b/testing/ptpd/ptpd-2.3.1-fix-snmp.patch
new file mode 100644
index 00000000000..31b466d1468
--- /dev/null
+++ b/testing/ptpd/ptpd-2.3.1-fix-snmp.patch
@@ -0,0 +1,12 @@
+diff -urN old/src/dep/snmp.c new/src/dep/snmp.c
+--- old/src/dep/snmp.c 2015-06-29 17:13:29.000000000 +0200
++++ new/src/dep/snmp.c 2018-09-15 22:54:11.818589001 +0200
+@@ -221,7 +221,7 @@
+
+ #define SNMP_LOCAL_VARIABLES \
+ static unsigned long long_ret; \
+- static U64 counter64_ret; \
++ static struct counter64 counter64_ret; \
+ static uint32_t ipaddr; \
+ Integer64 bigint; \
+ struct snmpHeaderIndex idx; \
diff --git a/testing/ptpd/ptpd2.confd b/testing/ptpd/ptpd2.confd
new file mode 100644
index 00000000000..22fe2d49285
--- /dev/null
+++ b/testing/ptpd/ptpd2.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/ptpd2
+
+# Options to pass to ptpd2
+PTPD_OPTS=""
diff --git a/testing/ptpd/ptpd2.rc b/testing/ptpd/ptpd2.rc
new file mode 100644
index 00000000000..bf8e1433229
--- /dev/null
+++ b/testing/ptpd/ptpd2.rc
@@ -0,0 +1,56 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+PTPD_CONFIGFILE=${PTPD_CONFIGFILE:-/etc/${RC_SVCNAME}.conf}
+PTPD_STATEFILE_DIR=${PTPD_STATEFILE_DIR:-/var/run}
+PTPD_STATEFILE=${PTPD_STATEFILE:-${PTPD_STATEFILE_DIR}/${RC_SVCNAME}.status}
+PTPD_PIDFILE_DIR=${PTPD_PIDFILE_DIR:-/var/run}
+PTPD_PIDFILE=${PTPD_PIDFILE:-${PTPD_PIDFILE_DIR}/${RC_SVCNAME}.pid}
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+command="/usr/sbin/ptpd2"
+command_args="--global:lock_file=$PTPD_PIDFILE --global:status_file=$PTPD_STATEFILE -c $PTPD_CONFIGFILE $PTPD_OPTS"
+pidfile="${PTPD_PIDFILE}"
+description="Precise Time Protocol daemon"
+
+
+depend() {
+ use net dns logger
+}
+
+checkconfig() {
+ ebegin "Checking ${SVCNAME} configuration"
+ msgout="$($command -k $command_args 2>&1)"
+ RETVAL=$?
+
+ # colorize output
+ echo "$msgout" | while read ln; do
+ if [[ "$ln" == *ignored* ]]; then
+ ewarn "$ln"
+ elif [[ "$ln" != "Configuration OK" ]]; then
+ eerror "$ln"
+ fi
+ done
+
+ eend $RETVAL
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec ${command} \
+ --pidfile ${pidfile} \
+ -- ${command_args}
+ eend $?
+}
+
+reload() {
+ checkconfig || return 1
+
+ ebegin "Reloading ${SVCNAME} configuration"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}