diff mbox series

[oe,meta-networking,V2,1/2] htpdate: Add recipe

Message ID 20180615033106.32342-1-raj.khem@gmail.com
State New
Headers show
Series [oe,meta-networking,V2,1/2] htpdate: Add recipe | expand

Commit Message

Khem Raj June 15, 2018, 3:31 a.m. UTC
Fix build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Andreas Müller <schnitzeltony@gmail.com>
---
 ...ent-variables-assignments-to-be-weak.patch | 31 ++++++++++++++
 ...01-Replace-ntp_adjtime-with-adjtimex.patch | 40 +++++++++++++++++++
 .../recipes-support/htpdate/htpdate_1.2.0.bb  | 39 ++++++++++++++++++
 3 files changed, 110 insertions(+)
 create mode 100644 meta-networking/recipes-support/htpdate/htpdate/0001-Make-environment-variables-assignments-to-be-weak.patch
 create mode 100644 meta-networking/recipes-support/htpdate/htpdate/0001-Replace-ntp_adjtime-with-adjtimex.patch
 create mode 100644 meta-networking/recipes-support/htpdate/htpdate_1.2.0.bb

Comments

Andreas Müller June 15, 2018, 7:41 a.m. UTC | #1
On Fri, Jun 15, 2018 at 5:31 AM, Khem Raj <raj.khem@gmail.com> wrote:
> 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>
Armin Kuster June 15, 2018, 1:59 p.m. UTC | #2
On 06/14/2018 08:31 PM, Khem Raj wrote:
> Fix build with musl

what version of musl?

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

Dont get your question why musl version is impaortant but it is
against the version
that is currently in OE-Core 1.1.19+

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

Patch

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 @@ 
+From 04603f52d793f964653e6a985944400fe4fa87ee Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 13 Jun 2018 17:50:20 -0700
+Subject: [PATCH] Make environment variables assignments to be weak
+
+So that OE can override them for cross builds
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1c80c09..884126c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,11 +2,11 @@ prefix = $(DESTDIR)/usr
+ bindir = ${prefix}/bin
+ mandir = ${prefix}/share/man
+ 
+-CC = gcc
++CC ?= gcc
+ CFLAGS += -Wall -std=c99 -pedantic -O2
+ 
+-INSTALL = /usr/bin/install -c
+-STRIP = /usr/bin/strip -s
++INSTALL ?= /usr/bin/install -c
++STRIP ?= /usr/bin/strip -s
+ 
+ all: htpdate
+ 
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 @@ 
+From 75646a2d2df14fdbc4a01e222a779afac94861d1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 14 Jun 2018 20:11:08 -0700
+Subject: [PATCH] Replace ntp_adjtime with adjtimex.
+
+ntp_adjtime in glibc is an alias to adjtimex and
+musl does not provide ntp_adjtime at all
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ htpdate.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/htpdate.c b/htpdate.c
+index 4171efe..ff0bf8d 100644
+--- a/htpdate.c
++++ b/htpdate.c
+@@ -391,7 +391,7 @@ static int htpdate_adjtimex( double drift ) {
+ 
+ 	/* Read current kernel frequency */
+ 	tmx.modes = 0;
+-	ntp_adjtime(&tmx);
++	adjtimex(&tmx);
+ 
+ 	/* Calculate new frequency */
+ 	freq = (long)(65536e6 * drift);
+@@ -406,7 +406,7 @@ static int htpdate_adjtimex( double drift ) {
+ 
+ 	/* Become root */
+ 	swuid(0);
+-	return( ntp_adjtime(&tmx) );
++	return( adjtimex(&tmx) );
+ 
+ }
+ 
+-- 
+2.17.1
+
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 @@ 
+# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "HTTP based time synchronization tool"
+
+DESCRIPTION = "The  HTTP Time Protocol (HTP) is used to synchronize a computer's time with\
+ web servers as reference time source. This program can be used instead\
+ ntpdate or similar, in networks that has a firewall blocking the NTP port.\
+ Htpdate will synchronize the computer time to Greenwich Mean Time (GMT),\
+ using the timestamps from HTTP headers found in web servers response (the\
+ HEAD method will be used to get the information).\
+ Htpdate works through proxy servers. Accuracy of htpdate will be usually\
+ within 0.5 seconds (better with multiple servers).\
+"
+
+HOMEPAGE = "http://www.vervest.org/htp/"
+
+LICENSE = "GPL-2.0+"
+LIC_FILES_CHKSUM = "file://htpdate.c;beginline=26;endline=30;md5=d7018a4d2c5a6eab392709a05e5e168a"
+
+SRC_URI = "http://www.vervest.org/htp/archive/c/htpdate-${PV}.tar.xz \
+           file://0001-Make-environment-variables-assignments-to-be-weak.patch \
+           file://0001-Replace-ntp_adjtime-with-adjtimex.patch \
+           "
+SRC_URI[md5sum] = "9d5ca69be06edf5d535b52b5f790da4e"
+SRC_URI[sha256sum] = "22b2cf3ec45b0eedecddd3ad2a3d754ac57942ae7dcbac410d254935f0bdbc03"
+
+do_configure () {
+	:
+}
+
+do_compile () {
+	oe_runmake
+}
+
+do_install () {
+	oe_runmake install 'INSTALL=install' 'STRIP=echo' 'DESTDIR=${D}'
+}
+