diff options
| author | Khem Raj <raj.khem@gmail.com> | 2018-06-14 20:31:05 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2018-06-16 08:51:38 -0700 |
| commit | c8f3816f826b305a7d1ec669c0ee9fdbbd945775 (patch) | |
| tree | 4946af5b300ca998c4a2acc774f025efb7ec8910 | |
| parent | ea97e324877c97f18f2825ee629fdf519fdf2397 (diff) | |
| download | meta-openembedded-c8f3816f826b305a7d1ec669c0ee9fdbbd945775.tar.gz | |
htpdate: Add recipe
Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andreas Müller <schnitzeltony@gmail.com>
Acked-by: Andreas Müller <schnitzeltony@gmail.com>
3 files changed, 110 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/htpdate/htpdate/0001-Make-environment-variables-assignments-to-be-weak.patch b/meta-networking/recipes-support/htpdate/htpdate/0001-Make-environment-variables-assignments-to-be-weak.patch new file mode 100644 index 0000000000..0ee44c1621 --- /dev/null +++ b/meta-networking/recipes-support/htpdate/htpdate/0001-Make-environment-variables-assignments-to-be-weak.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From 04603f52d793f964653e6a985944400fe4fa87ee Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 13 Jun 2018 17:50:20 -0700 | ||
| 4 | Subject: [PATCH] Make environment variables assignments to be weak | ||
| 5 | |||
| 6 | So that OE can override them for cross builds | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | Makefile | 6 +++--- | ||
| 11 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/Makefile b/Makefile | ||
| 14 | index 1c80c09..884126c 100644 | ||
| 15 | --- a/Makefile | ||
| 16 | +++ b/Makefile | ||
| 17 | @@ -2,11 +2,11 @@ prefix = $(DESTDIR)/usr | ||
| 18 | bindir = ${prefix}/bin | ||
| 19 | mandir = ${prefix}/share/man | ||
| 20 | |||
| 21 | -CC = gcc | ||
| 22 | +CC ?= gcc | ||
| 23 | CFLAGS += -Wall -std=c99 -pedantic -O2 | ||
| 24 | |||
| 25 | -INSTALL = /usr/bin/install -c | ||
| 26 | -STRIP = /usr/bin/strip -s | ||
| 27 | +INSTALL ?= /usr/bin/install -c | ||
| 28 | +STRIP ?= /usr/bin/strip -s | ||
| 29 | |||
| 30 | all: htpdate | ||
| 31 | |||
diff --git a/meta-networking/recipes-support/htpdate/htpdate/0001-Replace-ntp_adjtime-with-adjtimex.patch b/meta-networking/recipes-support/htpdate/htpdate/0001-Replace-ntp_adjtime-with-adjtimex.patch new file mode 100644 index 0000000000..cca8c6c364 --- /dev/null +++ b/meta-networking/recipes-support/htpdate/htpdate/0001-Replace-ntp_adjtime-with-adjtimex.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From 75646a2d2df14fdbc4a01e222a779afac94861d1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 14 Jun 2018 20:11:08 -0700 | ||
| 4 | Subject: [PATCH] Replace ntp_adjtime with adjtimex. | ||
| 5 | |||
| 6 | ntp_adjtime in glibc is an alias to adjtimex and | ||
| 7 | musl does not provide ntp_adjtime at all | ||
| 8 | |||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | Upstream-Status: Pending | ||
| 12 | |||
| 13 | htpdate.c | 4 ++-- | ||
| 14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/htpdate.c b/htpdate.c | ||
| 17 | index 4171efe..ff0bf8d 100644 | ||
| 18 | --- a/htpdate.c | ||
| 19 | +++ b/htpdate.c | ||
| 20 | @@ -391,7 +391,7 @@ static int htpdate_adjtimex( double drift ) { | ||
| 21 | |||
| 22 | /* Read current kernel frequency */ | ||
| 23 | tmx.modes = 0; | ||
| 24 | - ntp_adjtime(&tmx); | ||
| 25 | + adjtimex(&tmx); | ||
| 26 | |||
| 27 | /* Calculate new frequency */ | ||
| 28 | freq = (long)(65536e6 * drift); | ||
| 29 | @@ -406,7 +406,7 @@ static int htpdate_adjtimex( double drift ) { | ||
| 30 | |||
| 31 | /* Become root */ | ||
| 32 | swuid(0); | ||
| 33 | - return( ntp_adjtime(&tmx) ); | ||
| 34 | + return( adjtimex(&tmx) ); | ||
| 35 | |||
| 36 | } | ||
| 37 | |||
| 38 | -- | ||
| 39 | 2.17.1 | ||
| 40 | |||
diff --git a/meta-networking/recipes-support/htpdate/htpdate_1.2.0.bb b/meta-networking/recipes-support/htpdate/htpdate_1.2.0.bb new file mode 100644 index 0000000000..eb6787846b --- /dev/null +++ b/meta-networking/recipes-support/htpdate/htpdate_1.2.0.bb | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | # Copyright (C) 2018 Khem Raj <raj.khem@gmail.com> | ||
| 2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
| 3 | |||
| 4 | SUMMARY = "HTTP based time synchronization tool" | ||
| 5 | |||
| 6 | DESCRIPTION = "The HTTP Time Protocol (HTP) is used to synchronize a computer's time with\ | ||
| 7 | web servers as reference time source. This program can be used instead\ | ||
| 8 | ntpdate or similar, in networks that has a firewall blocking the NTP port.\ | ||
| 9 | Htpdate will synchronize the computer time to Greenwich Mean Time (GMT),\ | ||
| 10 | using the timestamps from HTTP headers found in web servers response (the\ | ||
| 11 | HEAD method will be used to get the information).\ | ||
| 12 | Htpdate works through proxy servers. Accuracy of htpdate will be usually\ | ||
| 13 | within 0.5 seconds (better with multiple servers).\ | ||
| 14 | " | ||
| 15 | |||
| 16 | HOMEPAGE = "http://www.vervest.org/htp/" | ||
| 17 | |||
| 18 | LICENSE = "GPL-2.0+" | ||
| 19 | LIC_FILES_CHKSUM = "file://htpdate.c;beginline=26;endline=30;md5=d7018a4d2c5a6eab392709a05e5e168a" | ||
| 20 | |||
| 21 | SRC_URI = "http://www.vervest.org/htp/archive/c/htpdate-${PV}.tar.xz \ | ||
| 22 | file://0001-Make-environment-variables-assignments-to-be-weak.patch \ | ||
| 23 | file://0001-Replace-ntp_adjtime-with-adjtimex.patch \ | ||
| 24 | " | ||
| 25 | SRC_URI[md5sum] = "9d5ca69be06edf5d535b52b5f790da4e" | ||
| 26 | SRC_URI[sha256sum] = "22b2cf3ec45b0eedecddd3ad2a3d754ac57942ae7dcbac410d254935f0bdbc03" | ||
| 27 | |||
| 28 | do_configure () { | ||
| 29 | : | ||
| 30 | } | ||
| 31 | |||
| 32 | do_compile () { | ||
| 33 | oe_runmake | ||
| 34 | } | ||
| 35 | |||
| 36 | do_install () { | ||
| 37 | oe_runmake install 'INSTALL=install' 'STRIP=echo' 'DESTDIR=${D}' | ||
| 38 | } | ||
| 39 | |||
