* [ptxdist] [PATCH] libcoap: add libcoap package
@ 2013-08-02 8:38 Alexander Aring
2013-08-12 17:02 ` Marc Kleine-Budde
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Aring @ 2013-08-02 8:38 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Aring
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
...ap-enable-shared-lib-and-install-examples.patch | 109 +++++++++++++++++++++
patches/libcoap-4.0.1/series | 1 +
rules/libcoap.in | 10 ++
rules/libcoap.make | 61 ++++++++++++
4 files changed, 181 insertions(+)
create mode 100644 patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
create mode 100644 patches/libcoap-4.0.1/series
create mode 100644 rules/libcoap.in
create mode 100644 rules/libcoap.make
diff --git a/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch b/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
new file mode 100644
index 0000000..71c36c8
--- /dev/null
+++ b/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
@@ -0,0 +1,109 @@
+From fe64f998eeb5d2a693400188b275007ce263fc87 Mon Sep 17 00:00:00 2001
+From: unknown author <unknown.author@example.com>
+Date: Fri, 2 Aug 2013 10:25:26 +0200
+Subject: [PATCH] libcoap: enable shared lib and install examples
+
+Normally the buildsystem generates a static library.
+This patch let generate the buildsystem a shared library and add
+a install rule to the Makefile so we can install it on the system.
+
+Add also install rule for the examples and linking to the shared library.
+
+Signed-off-by: Alexander Aring <alex.aring@gmail.com>
+---
+ Makefile.in | 21 +++++++++++++++++----
+ examples/Makefile.in | 7 ++++++-
+ 2 files changed, 23 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 0ded496..21564aa 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -17,6 +17,10 @@ ETAGS = @ETAGS@
+ abs_builddir = @abs_builddir@
+ top_builddir = @top_builddir@
+ package = @PACKAGE_TARNAME@-@PACKAGE_VERSION@
++prefix = @prefix@
++includerootdir = $(DESTDIR)$(prefix)/include
++librootdir = $(DESTDIR)$(prefix)/lib
++INSTALL_OS = @INSTALL_OS@
+
+ # files and flags
+ SOURCES:= pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \
+@@ -25,12 +29,13 @@ OBJECTS:= $(patsubst %.c, %.o, $(SOURCES))
+ HEADERS:=coap.h config.h debug.h pdu.h net.h encode.h uri.h coap_list.h mem.h \
+ str.h option.h bits.h uthash.h utlist.h resource.h hashkey.h async.h \
+ subscribe.h block.h address.h prng.h coap_time.h
+-CFLAGS:=-Wall -Wextra -std=c99 -pedantic @CFLAGS@
++CFLAGS:=-Wall -Wextra -std=c99 -pedantic @CFLAGS@ -fPIC
+ CPPFLAGS:=@CPPFLAGS@
+ DISTDIR=$(top_builddir)/$(package)
+ SUBDIRS:=examples doc @TESTS@
++BINSUBDIRS:=examples
+ FILES:=ChangeLog README LICENSE.BSD LICENSE.GPL Makefile.in configure configure.in config.h.in $(SOURCES) $(HEADERS)
+-LIB:=libcoap.a
++LIB:=libcoap.so
+ LDFLAGS:=@LIBS@
+ ARFLAGS:=cru
+ examples:=examples
+@@ -55,8 +60,7 @@ dirs: $(SUBDIRS)
+ done
+
+ $(LIB): $(OBJECTS)
+- $(AR) $(ARFLAGS) $@ $^
+- ranlib $@
++ $(CC) -shared -o $@ $^
+
+ clean:
+ @rm -f $(PROGRAM) main.o $(LIB) $(OBJECTS)
+@@ -64,6 +68,15 @@ clean:
+ $(MAKE) -C $$dir clean ; \
+ done
+
++install:
++ mkdir -p $(includerootdir)/libcoap
++ mkdir -p $(librootdir)
++ cp -r $(HEADERS) $(includerootdir)/libcoap/
++ cp -r $(LIB) $(librootdir)/
++ for dir in $(BINSUBDIRS); do \
++ $(MAKE) -C $$dir install ; \
++ done
++
+ doc:
+ $(MAKE) -C doc
+
+diff --git a/examples/Makefile.in b/examples/Makefile.in
+index 80445ad..f116e5a 100644
+--- a/examples/Makefile.in
++++ b/examples/Makefile.in
+@@ -16,6 +16,8 @@ MKDIR = mkdir
+ abs_builddir = @abs_builddir@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
++prefix = @prefix@
++binrootdir = $(DESTDIR)$(prefix)/bin
+ # files and flags
+ PROGRAMS:=coap-server coap-client rd etsi_iot_01 #tiny
+ SOURCES:= tiny.c client.c server.c rd.c etsi_iot_01.c
+@@ -27,7 +29,7 @@ DISTDIR?=$(top_builddir)/@PACKAGE_TARNAME@-@PACKAGE_VERSION@
+ FILES:=Makefile.in $(SOURCES)
+ LDFLAGS:=-L$(top_builddir)
+ LDLIBS:=-lcoap @LIBS@
+-libcoap =$(top_builddir)/libcoap.a
++libcoap =$(top_builddir)/libcoap.so
+
+ .PHONY: clean distclean
+
+@@ -56,6 +58,9 @@ distclean: clean
+ @rm -rf $(DISTDIR)
+ @rm -f *~
+
++install:
++ cp $(PROGRAMS) $(binrootdir)
++
+ dist: $(FILES)
+ test -d $(DISTDIR)/examples || mkdir $(DISTDIR)/examples
+ cp $(FILES) $(DISTDIR)/examples
+--
+1.8.3.3
+
diff --git a/patches/libcoap-4.0.1/series b/patches/libcoap-4.0.1/series
new file mode 100644
index 0000000..b0151bd
--- /dev/null
+++ b/patches/libcoap-4.0.1/series
@@ -0,0 +1 @@
+0001-libcoap-enable-shared-lib-and-install-examples.patch
diff --git a/rules/libcoap.in b/rules/libcoap.in
new file mode 100644
index 0000000..b790b6a
--- /dev/null
+++ b/rules/libcoap.in
@@ -0,0 +1,10 @@
+## SECTION=networking
+
+config LIBCOAP
+ tristate
+ prompt "libcoap"
+ help
+ Lightweight application-protocol for devices that are constrained their
+ resources such as computing power, RF range, memory, bandwith, or network
+ packet sizes. This protocol, CoAP, is developed in the IETF working group
+ "CoRE", <http://6lowapp.net>.
diff --git a/rules/libcoap.make b/rules/libcoap.make
new file mode 100644
index 0000000..3c7e04d
--- /dev/null
+++ b/rules/libcoap.make
@@ -0,0 +1,61 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2013 by Alexander Aring <aar@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_LIBCOAP) += libcoap
+
+#
+# Paths and names
+#
+LIBCOAP_VERSION := 4.0.1
+LIBCOAP_MD5 := f099ca71755406a0da1b4ea4a0184dbd
+LIBCOAP := libcoap-$(LIBCOAP_VERSION)
+LIBCOAP_SUFFIX := tar.gz
+LIBCOAP_URL := $(call ptx/mirror, SF, libcoap/$(LIBCOAP).$(LIBCOAP_SUFFIX))
+LIBCOAP_SOURCE := $(SRCDIR)/$(LIBCOAP).$(LIBCOAP_SUFFIX)
+LIBCOAP_DIR := $(BUILDDIR)/$(LIBCOAP)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+LIBCOAP_MAKE_ENV := $(CROSS_ENV)
+
+#
+# autoconf
+#
+LIBCOAP_CONF_TOOL := autoconf
+LIBCOAP_TOOLS_CONF_OPT := \
+ $(CROSS_AUTOCONF_USR)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/libcoap.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, libcoap)
+ @$(call install_fixup, libcoap,PRIORITY,optional)
+ @$(call install_fixup, libcoap,SECTION,base)
+ @$(call install_fixup, libcoap,AUTHOR,"Alexander Aring <aar@pengutronix.de>")
+ @$(call install_fixup, libcoap,DESCRIPTION,missing)
+
+ @$(call install_lib, libcoap, 0, 0, 0644, libcoap)
+ @$(call install_copy, libcoap, 0, 0, 0755, -, /usr/bin/coap-server)
+ @$(call install_copy, libcoap, 0, 0, 0755, -, /usr/bin/coap-client)
+
+ @$(call install_finish, libcoap)
+
+ @$(call touch)
+
+# vim: syntax=make
--
1.8.3.3
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] libcoap: add libcoap package
2013-08-02 8:38 [ptxdist] [PATCH] libcoap: add libcoap package Alexander Aring
@ 2013-08-12 17:02 ` Marc Kleine-Budde
2013-08-15 6:25 ` Alexander Aring
0 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-08-12 17:02 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Aring
[-- Attachment #1.1: Type: text/plain, Size: 2352 bytes --]
On 08/02/2013 10:38 AM, Alexander Aring wrote:
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> ...ap-enable-shared-lib-and-install-examples.patch | 109 +++++++++++++++++++++
> patches/libcoap-4.0.1/series | 1 +
> rules/libcoap.in | 10 ++
> rules/libcoap.make | 61 ++++++++++++
> 4 files changed, 181 insertions(+)
> create mode 100644 patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
> create mode 100644 patches/libcoap-4.0.1/series
> create mode 100644 rules/libcoap.in
> create mode 100644 rules/libcoap.make
>
> diff --git a/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch b/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
> new file mode 100644
> index 0000000..71c36c8
> --- /dev/null
> +++ b/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
> @@ -0,0 +1,109 @@
> +From fe64f998eeb5d2a693400188b275007ce263fc87 Mon Sep 17 00:00:00 2001
> +From: unknown author <unknown.author@example.com>
Who created the patch in the first place?
> +Date: Fri, 2 Aug 2013 10:25:26 +0200
> +Subject: [PATCH] libcoap: enable shared lib and install examples
> +
> +Normally the buildsystem generates a static library.
> +This patch let generate the buildsystem a shared library and add
> +a install rule to the Makefile so we can install it on the system.
> +
> +Add also install rule for the examples and linking to the shared library.
> +
> +Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> +---
> + Makefile.in | 21 +++++++++++++++++----
> + examples/Makefile.in | 7 ++++++-
> + 2 files changed, 23 insertions(+), 5 deletions(-)
> +
> +diff --git a/Makefile.in b/Makefile.in
> +index 0ded496..21564aa 100644
> +--- a/Makefile.in
> ++++ b/Makefile.in
Argh, autoconf without automake. Not your fault
...
What about creating a proper automake'd version of libcoap?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] libcoap: add libcoap package
2013-08-12 17:02 ` Marc Kleine-Budde
@ 2013-08-15 6:25 ` Alexander Aring
2013-08-15 8:16 ` Marc Kleine-Budde
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Aring @ 2013-08-15 6:25 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: ptxdist
Hi Marc,
On Mon, Aug 12, 2013 at 07:02:16PM +0200, Marc Kleine-Budde wrote:
> On 08/02/2013 10:38 AM, Alexander Aring wrote:
> > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > ---
> > ...ap-enable-shared-lib-and-install-examples.patch | 109 +++++++++++++++++++++
> > patches/libcoap-4.0.1/series | 1 +
> > rules/libcoap.in | 10 ++
> > rules/libcoap.make | 61 ++++++++++++
> > 4 files changed, 181 insertions(+)
> > create mode 100644 patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
> > create mode 100644 patches/libcoap-4.0.1/series
> > create mode 100644 rules/libcoap.in
> > create mode 100644 rules/libcoap.make
> >
> > diff --git a/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch b/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
> > new file mode 100644
> > index 0000000..71c36c8
> > --- /dev/null
> > +++ b/patches/libcoap-4.0.1/0001-libcoap-enable-shared-lib-and-install-examples.patch
> > @@ -0,0 +1,109 @@
> > +From fe64f998eeb5d2a693400188b275007ce263fc87 Mon Sep 17 00:00:00 2001
> > +From: unknown author <unknown.author@example.com>
>
> Who created the patch in the first place?
>
Uhm, I create the patch with quilt at first. Then I run a ptxdist --git
extract to get the patch. So it seems I create this patch in a wrong
way. I will check this in the next try, thanks.
And it was me who create this patch. :-)
> > +Date: Fri, 2 Aug 2013 10:25:26 +0200
> > +Subject: [PATCH] libcoap: enable shared lib and install examples
> > +
> > +Normally the buildsystem generates a static library.
> > +This patch let generate the buildsystem a shared library and add
> > +a install rule to the Makefile so we can install it on the system.
> > +
> > +Add also install rule for the examples and linking to the shared library.
> > +
> > +Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > +---
> > + Makefile.in | 21 +++++++++++++++++----
> > + examples/Makefile.in | 7 ++++++-
> > + 2 files changed, 23 insertions(+), 5 deletions(-)
> > +
> > +diff --git a/Makefile.in b/Makefile.in
> > +index 0ded496..21564aa 100644
> > +--- a/Makefile.in
> > ++++ b/Makefile.in
>
> Argh, autoconf without automake. Not your fault
>
> ...
>
> What about creating a proper automake'd version of libcoap?
>
Now I create a autotools project and see some very very bad things in
the libcoap. I need to screw up the complete buildsystem.
For exmaple, they have a config.h:
...
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "libcoap"
...
I need to drop the config.h because there stands some defines which is
setted manually, but normally setted by autoconf with AC_INIT like PACKAGE_NAME.
With this behaviour you get many redefined ... warnings from compiler if
you use the libcoap in a autotools buildsystem project.
There are several small things like this.
I need to say, I really don't understand this. They use autoconf but
setted defines manually so autoconf doesn't matter...
I need to rework this, so please don't add this to ptxdist right now.
And yes I will try to insert autoconf/automake into this project.
Regards
Alex
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] libcoap: add libcoap package
2013-08-15 6:25 ` Alexander Aring
@ 2013-08-15 8:16 ` Marc Kleine-Budde
2013-08-15 8:28 ` Alexander Aring
0 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-08-15 8:16 UTC (permalink / raw)
To: Alexander Aring; +Cc: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 1512 bytes --]
On 08/15/2013 08:25 AM, Alexander Aring wrote:
[...]
>> Argh, autoconf without automake. Not your fault
>>
>> ...
>>
>> What about creating a proper automake'd version of libcoap?
>>
> Now I create a autotools project and see some very very bad things in
> the libcoap. I need to screw up the complete buildsystem.
>
> For exmaple, they have a config.h:
The config.h is autogenerated by autotools.
> ...
> #define PACKAGE_BUGREPORT ""
>
> #define PACKAGE_NAME "libcoap"
> ...
>
> I need to drop the config.h because there stands some defines which is
> setted manually, but normally setted by autoconf with AC_INIT like PACKAGE_NAME.
>
> With this behaviour you get many redefined ... warnings from compiler if
> you use the libcoap in a autotools buildsystem project.
>
> There are several small things like this.
> I need to say, I really don't understand this. They use autoconf but
> setted defines manually so autoconf doesn't matter...
>
>
> I need to rework this, so please don't add this to ptxdist right now.
>
> And yes I will try to insert autoconf/automake into this project.
Fine. You can call me if you need help. If you need a template I suggest
to use libabc.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] libcoap: add libcoap package
2013-08-15 8:16 ` Marc Kleine-Budde
@ 2013-08-15 8:28 ` Alexander Aring
2013-08-15 9:24 ` Marc Kleine-Budde
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Aring @ 2013-08-15 8:28 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: ptxdist
Hi Marc,
On Thu, Aug 15, 2013 at 10:16:43AM +0200, Marc Kleine-Budde wrote:
> On 08/15/2013 08:25 AM, Alexander Aring wrote:
> [...]
>
> >> Argh, autoconf without automake. Not your fault
> >>
> >> ...
> >>
> >> What about creating a proper automake'd version of libcoap?
> >>
> > Now I create a autotools project and see some very very bad things in
> > the libcoap. I need to screw up the complete buildsystem.
> >
> > For exmaple, they have a config.h:
>
> The config.h is autogenerated by autotools.
>
Yea, I saw this too. AC_CONFIG_HEADERS([config.h]).
But the main "coap.h" header file for the api includes this "config.h" header
file. So a aplication which uses autotools can't do a include <coap.h>
because it includes the config.h from the autotools generated header file
and redefined all autotools related things.
Difficult to explain... :)
> > ...
> > #define PACKAGE_BUGREPORT ""
> >
> > #define PACKAGE_NAME "libcoap"
> > ...
> >
> > I need to drop the config.h because there stands some defines which is
> > setted manually, but normally setted by autoconf with AC_INIT like PACKAGE_NAME.
> >
> > With this behaviour you get many redefined ... warnings from compiler if
> > you use the libcoap in a autotools buildsystem project.
> >
> > There are several small things like this.
> > I need to say, I really don't understand this. They use autoconf but
> > setted defines manually so autoconf doesn't matter...
> >
> >
> > I need to rework this, so please don't add this to ptxdist right now.
> >
> > And yes I will try to insert autoconf/automake into this project.
>
> Fine. You can call me if you need help. If you need a template I suggest
> to use libabc.
>
Ok thanks.
- Alex
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH] libcoap: add libcoap package
2013-08-15 8:28 ` Alexander Aring
@ 2013-08-15 9:24 ` Marc Kleine-Budde
0 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-08-15 9:24 UTC (permalink / raw)
To: Alexander Aring; +Cc: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 1047 bytes --]
On 08/15/2013 10:28 AM, Alexander Aring wrote:
[...]
>> The config.h is autogenerated by autotools.
>>
> Yea, I saw this too. AC_CONFIG_HEADERS([config.h]).
>
> But the main "coap.h" header file for the api includes this "config.h" header
> file. So a aplication which uses autotools can't do a include <coap.h>
> because it includes the config.h from the autotools generated header file
> and redefined all autotools related things.
>
> Difficult to explain... :)
Oh yes, I remember this problem. Have a look at libabc if they have a
proper solution for this. If not have a look at rtnet's configure.ac
[1], search for "AH_VERBATIM" and have a look at the end of that file.
Marc
[1] http://www.rts.uni-hannover.de/rtnet/lxr/source/configure.ac
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-15 9:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 8:38 [ptxdist] [PATCH] libcoap: add libcoap package Alexander Aring
2013-08-12 17:02 ` Marc Kleine-Budde
2013-08-15 6:25 ` Alexander Aring
2013-08-15 8:16 ` Marc Kleine-Budde
2013-08-15 8:28 ` Alexander Aring
2013-08-15 9:24 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox