From: Alexander Aring <alex.aring@gmail.com>
To: ptxdist@pengutronix.de
Cc: Alexander Aring <alex.aring@gmail.com>
Subject: [ptxdist] [PATCH] libcoap: add libcoap package
Date: Fri, 2 Aug 2013 10:38:52 +0200 [thread overview]
Message-ID: <1375432732-12559-1-git-send-email-alex.aring@gmail.com> (raw)
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
next reply other threads:[~2013-08-02 8:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 8:38 Alexander Aring [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375432732-12559-1-git-send-email-alex.aring@gmail.com \
--to=alex.aring@gmail.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox