mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [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

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