From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-ee0-x22a.google.com ([2a00:1450:4013:c00::22a]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1V5ApO-0001Mh-Tp for ptxdist@pengutronix.de; Fri, 02 Aug 2013 10:35:30 +0200 Received: by mail-ee0-f42.google.com with SMTP id b45so181664eek.1 for ; Fri, 02 Aug 2013 01:35:08 -0700 (PDT) From: Alexander Aring Date: Fri, 2 Aug 2013 10:38:52 +0200 Message-Id: <1375432732-12559-1-git-send-email-alex.aring@gmail.com> Subject: [ptxdist] [PATCH] libcoap: add libcoap package Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Alexander Aring Signed-off-by: Alexander Aring --- ...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 +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 +--- + 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", . 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 +# +# 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 ") + @$(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