]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
libcgi: fix build failure on pure static library builds
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 22 Feb 2014 21:12:00 +0000 (22:12 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Sat, 22 Feb 2014 21:49:03 +0000 (22:49 +0100)
libcgi always builds both the shared and static library, which doesn't
work on architecture that don't support shared library at all, such as
Blackfin with the FLAT format. libcgi uses autoconf, but not automake,
and the Makefile is not of the highest possible quality, so this
commit fixes the problem by introducing a "STATIC" variable that can
be set from the environment. When set to a non-empty value, the
Makefile assumes it should only build the static version of the
library.

Note that this package is in desperate need of some care: there is one
single patch that mixes several changes together, it doesn't have a
description or a Signed-off-by line, and there is now a github project
for libcgi at https://github.com/rafaelsteil/libcgi/ that has the same
fixes.

However, for the purpose of the master branch, we're doing the most
minimal fix possible, by just adding this STATIC variable.

Fixes:

  http://autobuild.buildroot.net/results/625/625105bcaf26345f422b225787fc19611b65cd57/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/libcgi/libcgi.mk
package/libcgi/libcgi.patch

index 40a9f32ee2c7608b08eae94bdd4a01fa266a5e94..f46a1fa74c3654d57804efe24e367c47360b6374 100644 (file)
@@ -8,7 +8,8 @@ LIBCGI_VERSION = 1.0
 LIBCGI_SITE = http://downloads.sourceforge.net/project/libcgi/libcgi/$(LIBCGI_VERSION)
 LIBCGI_INSTALL_STAGING = YES
 # use cross CC/AR rather than host
-LIBCGI_MAKE_ENV = CC="$(TARGET_CC) $(TARGET_CFLAGS)" AR="$(TARGET_AR)"
+LIBCGI_MAKE_ENV = CC="$(TARGET_CC) $(TARGET_CFLAGS)" AR="$(TARGET_AR)" \
+       $(if $(BR2_PREFER_STATIC_LIB),STATIC=1)
 LIBCGI_LICENSE = LGPLv2.1+
 
 $(eval $(autotools-package))
index 12a7b106c73be94a17d8a843c4643b2810d5d478..b576178546479946bdbbe6be3cb105672c314111 100644 (file)
@@ -1,5 +1,7 @@
---- libcgi-1.0.orig/src/cgi.c
-+++ libcgi-1.0/src/cgi.c
+Index: b/src/cgi.c
+===================================================================
+--- a/src/cgi.c
++++ b/src/cgi.c
 @@ -336,7 +336,7 @@
        hextable['b'] = 11;
        hextable['c'] = 12;
@@ -9,8 +11,10 @@
        hextable['f'] = 15;
        hextable['A'] = 10;
        hextable['B'] = 11;
---- libcgi-1.0.orig/src/string.c
-+++ libcgi-1.0/src/string.c
+Index: b/src/string.c
+===================================================================
+--- a/src/string.c
++++ b/src/string.c
 @@ -584,7 +584,7 @@
  
        va_start(ptr, s);
        len = strlen(s);
  
        while (*str) {
---- libcgi-1.0.orig/Makefile.in
-+++ libcgi-1.0/Makefile.in
-@@ -5,22 +5,27 @@
+Index: b/Makefile.in
+===================================================================
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -5,22 +5,32 @@
  prefix = @prefix@
  exec_prefix = @exec_prefix@
  
 +SHOBJS=$(OBJS:.o=.sh.o)
  
 -.c.o: $(CC) $(FLAGS) -c $<
-+%.o: %.c
-+      $(CC) $(FLAGS) -c $*.c -o $@
++ALL_TARGETS = src/libcgi.a
++ifeq ($(STATIC),)
++ALL_TARGETS += src/libcgi.so
++endif
  
 -all: $(OBJS) src/libcgi.so
++%.o: %.c
++      $(CC) $(FLAGS) -c $*.c -o $@
++
 +%.sh.o: %.c
 +      $(CC) $(FLAGS) -fPIC -c $*.c -o $@
 +
-+all: src/libcgi.so src/libcgi.a
++all: $(ALL_TARGETS)
  
        @echo ""
        @echo ""
-@@ -48,14 +53,15 @@
+@@ -48,14 +58,17 @@
  src/libcgi.a: $(OBJS)
        $(AR) rc src/libcgi.a $(OBJS)
  
 -      cp src/cgi.h $(INCDIR)
 -      cp src/session.h $(INCDIR)
 +      cp src/libcgi.a $(DESTDIR)/$(LIBDIR)
++ifeq ($(STATIC),)
 +      cp src/libcgi.so $(DESTDIR)/$(LIBDIR)
++endif
 +      [ -d $(DESTDIR)/$(INCDIR) ] || mkdir -p $(DESTDIR)/$(INCDIR)
 +      cp src/cgi.h $(DESTDIR)/$(INCDIR)
 +      cp src/session.h $(DESTDIR)/$(INCDIR)
  
  
  src/error.o: src/error.c src/error.h
-@@ -69,8 +75,9 @@
+@@ -69,8 +82,9 @@
  src/list.o: src/list.c
  
  clean:
  
  uninstall: clean
        rm -f $(LIBDIR)/libcgi.*
-@@ -78,11 +85,11 @@
+@@ -78,11 +92,11 @@
        rm -f $(INCDIR)/session.h
        rm -f $(MANDIR)/libcgi*