Skip to contentSkip to conversation

cgic: new package

PATCH New David Bender 4 participants 10 messages Jan 16, 2015 – Jan 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgic: new package

Added cgic library.

---
 package/Config.in                             |    1 +
 package/cgic/Config.in                        |    6 ++++
 package/cgic/cgic-0000-prepare_makefile.patch |   40 +++++++++++++++++++++++++
 package/cgic/cgic.mk                          |   36 ++++++++++++++++++++++
 4 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 package/cgic/Config.in
 create mode 100644 package/cgic/cgic-0000-prepare_makefile.patch
 create mode 100644 package/cgic/cgic.mk
package/Config.in +1 -0
index 266de13..a6fa27d 100644
@@ -816,6 +816,7 @@ menu "Networking"
 	source "package/agentpp/Config.in"
 	source "package/c-ares/Config.in"
 	source "package/canfestival/Config.in"
+	source "package/cgic/Config.in"
 	source "package/cppzmq/Config.in"
 	source "package/czmq/Config.in"
 	source "package/filemq/Config.in"
package/cgic/Config.in new file +6 -0
new file mode 100644
index 0000000..402460d
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_CGIC
+	bool "cgic"
+	help
+	  C CGI library
+
+	  http://www.boutell.com/cgic/
package/cgic/cgic-0000-prepare_makefile.patch new file +40 -0
new file mode 100644
index 0000000..46b7a81
@@ -0,0 +1,40 @@
+Binary files cgic206/cgic.o and cgic206-br/cgic.o differ
+Binary files cgic206/libcgic.a and cgic206-br/libcgic.a differ
+diff -rupN cgic206/Makefile cgic206-br/Makefile
+--- cgic206/Makefile	2014-03-16 18:17:11.000000000 -0400
++++ cgic206-br/Makefile	2015-01-16 11:18:03.714874000 -0500
+@@ -1,15 +1,14 @@
+-CFLAGS=-g -Wall
+-CC=gcc
+-AR=ar
+-RANLIB=ranlib
+ LIBS=-L./ -lcgic
+ 
+ all: libcgic.a cgictest.cgi capture
+ 
+ install: libcgic.a
+-	cp libcgic.a /usr/local/lib
+-	cp cgic.h /usr/local/include
+-	@echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.
++	cp libcgic.a $(PREFIX)/usr/lib
++	cp cgic.h $(PREFIX)/usr/include
++	@echo libcgic.a is in $(PREFIX)/usr/lib. cgic.h is in $(PREFIX)/usr/include.
++
++cgi.o: cgic.c cgic.h
++	$(CC) $(CFLAGS) cgic.c -o cgic.o
+ 
+ libcgic.a: cgic.o cgic.h
+ 	rm -f libcgic.a
+@@ -19,10 +18,10 @@ libcgic.a: cgic.o cgic.h
+ #mingw32 and cygwin users: replace .cgi with .exe
+ 
+ cgictest.cgi: cgictest.o libcgic.a
+-	gcc cgictest.o -o cgictest.cgi ${LIBS}
++	$(CC) cgictest.o -o cgictest.cgi ${LIBS}
+ 
+ capture: capture.o libcgic.a
+-	gcc capture.o -o capture ${LIBS}
++	$(CC) capture.o -o capture ${LIBS}
+ 
+ clean:
+ 	rm -f *.o *.a cgictest.cgi capture
package/cgic/cgic.mk new file +36 -0
new file mode 100644
index 0000000..378e1cd
@@ -0,0 +1,36 @@
+################################################################################
+#
+# cgic
+#
+################################################################################
+
+CGIC_VERSION = 2.06
+CGIC_SOURCE = cgic206.tar.gz
+CGIC_SITE = http://boutell.com/cgic
+CGIC_LICENSE = Custom
+CGIC_LICENSE_FILES = license.txt
+
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+	CC=$(TARGET_CROSS)gcc \
+	RANLIB=$(TARGET_CROSS)ranlib
+
+define CGIC_BUILD_CMDS
+	(cd $(@D); \
+		$(CGIC_ENV) \
+		make libcgic.a \
+		)
+endef
+
+define CGIC_INSTALL_STAGING_CMDS
+	(cd $(@D); \
+		PREFIX=$(STAGING_DIR) make install \
+		)
+endef
+
+define CGIC_INSTALL_TARGET_CMDS
+	(cd $(@D); \
+		PREFIX=$(TARGET_DIR) make install \
+		)
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH 1/1 cgic: new package

Hi David,

package/cgic/cgic.mk line 15

Quoted 3 lines · David Bender
package/cgic/cgic.mk new file +3 -0
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+	CC=$(TARGET_CROSS)gcc \
+	RANLIB=$(TARGET_CROSS)ranlib

TARGET_CONFIGURE_OPTS already includes all these and more.

package/cgic/cgic.mk line 22

Quoted 7 lines
package/cgic/cgic.mk new file +7 -0
+
+define CGIC_BUILD_CMDS
+	(cd $(@D); \
+		$(CGIC_ENV) \
+		make libcgic.a \
+		)
+endef

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/3 cgic: new package

Added cgic library.

---
 package/Config.in                             |    1 +
 package/cgic/Config.in                        |    6 ++++
 package/cgic/cgic-0000-prepare_makefile.patch |   40 +++++++++++++++++++++++++
 package/cgic/cgic.mk                          |   36 ++++++++++++++++++++++
 4 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 package/cgic/Config.in
 create mode 100644 package/cgic/cgic-0000-prepare_makefile.patch
 create mode 100644 package/cgic/cgic.mk
package/Config.in +1 -0
index 266de13..a6fa27d 100644
@@ -816,6 +816,7 @@ menu "Networking"
 	source "package/agentpp/Config.in"
 	source "package/c-ares/Config.in"
 	source "package/canfestival/Config.in"
+	source "package/cgic/Config.in"
 	source "package/cppzmq/Config.in"
 	source "package/czmq/Config.in"
 	source "package/filemq/Config.in"
package/cgic/Config.in new file +6 -0
new file mode 100644
index 0000000..402460d
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_CGIC
+	bool "cgic"
+	help
+	  C CGI library
+
+	  http://www.boutell.com/cgic/
package/cgic/cgic-0000-prepare_makefile.patch new file +40 -0
new file mode 100644
index 0000000..46b7a81
@@ -0,0 +1,40 @@
+Binary files cgic206/cgic.o and cgic206-br/cgic.o differ
+Binary files cgic206/libcgic.a and cgic206-br/libcgic.a differ
+diff -rupN cgic206/Makefile cgic206-br/Makefile
+--- cgic206/Makefile	2014-03-16 18:17:11.000000000 -0400
++++ cgic206-br/Makefile	2015-01-16 11:18:03.714874000 -0500
+@@ -1,15 +1,14 @@
+-CFLAGS=-g -Wall
+-CC=gcc
+-AR=ar
+-RANLIB=ranlib
+ LIBS=-L./ -lcgic
+ 
+ all: libcgic.a cgictest.cgi capture
+ 
+ install: libcgic.a
+-	cp libcgic.a /usr/local/lib
+-	cp cgic.h /usr/local/include
+-	@echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.
++	cp libcgic.a $(PREFIX)/usr/lib
++	cp cgic.h $(PREFIX)/usr/include
++	@echo libcgic.a is in $(PREFIX)/usr/lib. cgic.h is in $(PREFIX)/usr/include.
++
++cgi.o: cgic.c cgic.h
++	$(CC) $(CFLAGS) cgic.c -o cgic.o
+ 
+ libcgic.a: cgic.o cgic.h
+ 	rm -f libcgic.a
+@@ -19,10 +18,10 @@ libcgic.a: cgic.o cgic.h
+ #mingw32 and cygwin users: replace .cgi with .exe
+ 
+ cgictest.cgi: cgictest.o libcgic.a
+-	gcc cgictest.o -o cgictest.cgi ${LIBS}
++	$(CC) cgictest.o -o cgictest.cgi ${LIBS}
+ 
+ capture: capture.o libcgic.a
+-	gcc capture.o -o capture ${LIBS}
++	$(CC) capture.o -o capture ${LIBS}
+ 
+ clean:
+ 	rm -f *.o *.a cgictest.cgi capture
package/cgic/cgic.mk new file +36 -0
new file mode 100644
index 0000000..378e1cd
@@ -0,0 +1,36 @@
+################################################################################
+#
+# cgic
+#
+################################################################################
+
+CGIC_VERSION = 2.06
+CGIC_SOURCE = cgic206.tar.gz
+CGIC_SITE = http://boutell.com/cgic
+CGIC_LICENSE = Custom
+CGIC_LICENSE_FILES = license.txt
+
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+	CC=$(TARGET_CROSS)gcc \
+	RANLIB=$(TARGET_CROSS)ranlib
+
+define CGIC_BUILD_CMDS
+	(cd $(@D); \
+		$(CGIC_ENV) \
+		make libcgic.a \
+		)
+endef
+
+define CGIC_INSTALL_STAGING_CMDS
+	(cd $(@D); \
+		PREFIX=$(STAGING_DIR) make install \
+		)
+endef
+
+define CGIC_INSTALL_TARGET_CMDS
+	(cd $(@D); \
+		PREFIX=$(TARGET_DIR) make install \
+		)
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.8.6
#3 lore raw

PATCH 2/3 Restore cgiFormFileGetTempfileName and make creation permissions more secure

---
 package/cgic/cgic-0001-file_enhancements.patch |   81 ++++++++++++++++++++++++
 1 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 package/cgic/cgic-0001-file_enhancements.patch
package/cgic/cgic-0001-file_enhancements.patch new file +81 -0
new file mode 100644
index 0000000..f09a73f
@@ -0,0 +1,81 @@
+diff -rupN cgic206/cgic.c cgic206_tempfile/cgic.c
+--- cgic206/cgic.c	2014-03-16 18:17:11.000000000 -0400
++++ cgic206_tempfile/cgic.c	2015-01-21 11:58:45.436384908 -0500
+@@ -22,6 +22,8 @@
+ #define CGICDEBUGEND
+ #endif /* CGICDEBUG */
+ 
++#define _GNU_SOURCE
++
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -34,11 +36,11 @@
+ #include <io.h>
+ 
+ /* cgic 2.01 */
+-#include <fcntl.h>
+ 
+ #else
+ #include <unistd.h>
+ #endif /* WIN32 */
++#include <fcntl.h>
+ #include "cgic.h"
+ 
+ #define cgiStrEq(a, b) (!strcmp((a), (b)))
+@@ -636,16 +638,17 @@ static cgiParseResultType getTempFileNam
+ 		window between the file's creation and the
+ 		chmod call (glibc 2.0.6 and lower might
+ 		otherwise have allowed this). */
++	mode_t umode;
+ 	int outfd; 
++	umode = umask(0600);
+ 	strcpy(tfileName, cgicTempDir "/cgicXXXXXX");
+-	outfd = mkstemp(tfileName);
++	outfd = mkostemp(tfileName, O_CLOEXEC | O_NOATIME);
++	umask(umode);
+ 	if (outfd == -1) {
+ 		return cgiParseIO;
+ 	}
+-	close(outfd);
+-	/* Fix the permissions */
+-	if (chmod(tfileName, 0600) != 0) {
+-		unlink(tfileName);
++
++	if (close(outfd)) {
+ 		return cgiParseIO;
+ 	}
+ #else
+@@ -1275,6 +1278,20 @@ cgiFormResultType cgiFormFileContentType
+ 	}
+ }
+ 
++const char* cgiFormFileGetTempfileName(
++	char* name)
++{
++	cgiFormEntry *e;
++	e = cgiFormEntryFindFirst(name);
++	if (!e) {
++		return NULL;
++	} else if (!strlen(e->tfileName)) {
++		return NULL;
++	} else {
++		return e->tfileName;
++	}
++}
++
+ cgiFormResultType cgiFormFileSize(
+ 	char *name, int *sizeP)
+ {
+diff -rupN cgic206/cgic.h cgic206_tempfile/cgic.h
+--- cgic206/cgic.h	2014-03-16 18:17:11.000000000 -0400
++++ cgic206_tempfile/cgic.h	2015-01-21 11:53:02.915148026 -0500
+@@ -141,6 +141,8 @@ extern cgiFormResultType cgiFormRadio(
+ 	char *name, char **valuesText, int valuesTotal, 
+ 	int *result, int defaultV);	
+ 
++extern const char* cgiFormFileGetTempfileName(char* name);
++
+ /* The paths returned by this function are the original names of files
+ 	as reported by the uploading web browser and shoult NOT be
+ 	blindly assumed to be "safe" names for server-side use! */
Signature · 1 line
1.7.8.6
#4 lore raw

PATCH 2/3 Restore cgiFormFileGetTempfileName and make creation permissions more secure

David, All,

On 2015-01-22 14:11 -0500, David Bender spake thusly:

package/cgic/cgic-0001-file_enhancements.patch

Quoted 8 lines
---
 package/cgic/cgic-0001-file_enhancements.patch |   81 ++++++++++++++++++++++++
 1 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 package/cgic/cgic-0001-file_enhancements.patch
package/cgic/cgic-0001-file_enhancements.patch +0 -0

While fixing the eye-candy in this new cgic package, I stumbled on this patch you are adding.

First and foremost, you forgot to add a dewscription for this patch, and you SoB-line.

Without a description, it is not easy to see what this patch does. After some digging around, I realised it does two things:
- fix the creation of temporary files (good)
- adds a new feature (bad)

Thus, it should have been two separate patches.

cgiFormFileGetTempfileName() is a function that is not called anywhere in the cgic code, and so I conclude it is only exported as an entrypoint in the generated library. This is thus a new feature.

We usually refuse to cary feature-patches in Buildroot, unles there is a very good reason to do so. Since you mention that this is "restoring" it, do you mean it was present in a previous version and got dropped, and legacy code might use that function? In this case, it might be OK to re-add it...

Anyway, I've split this in two.

Regards,
Yann E. MORIN.

Quoted 89 lines

new file mode 100644
index 0000000..f09a73f

package/cgic/cgic-0001-file_enhancements.patch new file +81 -0
@@ -0,0 +1,81 @@
+diff -rupN cgic206/cgic.c cgic206_tempfile/cgic.c
+--- cgic206/cgic.c	2014-03-16 18:17:11.000000000 -0400
++++ cgic206_tempfile/cgic.c	2015-01-21 11:58:45.436384908 -0500
+@@ -22,6 +22,8 @@
+ #define CGICDEBUGEND
+ #endif /* CGICDEBUG */
+ 
++#define _GNU_SOURCE
++
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -34,11 +36,11 @@
+ #include <io.h>
+ 
+ /* cgic 2.01 */
+-#include <fcntl.h>
+ 
+ #else
+ #include <unistd.h>
+ #endif /* WIN32 */
++#include <fcntl.h>
+ #include "cgic.h"
+ 
+ #define cgiStrEq(a, b) (!strcmp((a), (b)))
+@@ -636,16 +638,17 @@ static cgiParseResultType getTempFileNam
+ 		window between the file's creation and the
+ 		chmod call (glibc 2.0.6 and lower might
+ 		otherwise have allowed this). */
++	mode_t umode;
+ 	int outfd; 
++	umode = umask(0600);
+ 	strcpy(tfileName, cgicTempDir "/cgicXXXXXX");
+-	outfd = mkstemp(tfileName);
++	outfd = mkostemp(tfileName, O_CLOEXEC | O_NOATIME);
++	umask(umode);
+ 	if (outfd == -1) {
+ 		return cgiParseIO;
+ 	}
+-	close(outfd);
+-	/* Fix the permissions */
+-	if (chmod(tfileName, 0600) != 0) {
+-		unlink(tfileName);
++
++	if (close(outfd)) {
+ 		return cgiParseIO;
+ 	}
+ #else
+@@ -1275,6 +1278,20 @@ cgiFormResultType cgiFormFileContentType
+ 	}
+ }
+ 
++const char* cgiFormFileGetTempfileName(
++	char* name)
++{
++	cgiFormEntry *e;
++	e = cgiFormEntryFindFirst(name);
++	if (!e) {
++		return NULL;
++	} else if (!strlen(e->tfileName)) {
++		return NULL;
++	} else {
++		return e->tfileName;
++	}
++}
++
+ cgiFormResultType cgiFormFileSize(
+ 	char *name, int *sizeP)
+ {
+diff -rupN cgic206/cgic.h cgic206_tempfile/cgic.h
+--- cgic206/cgic.h	2014-03-16 18:17:11.000000000 -0400
++++ cgic206_tempfile/cgic.h	2015-01-21 11:53:02.915148026 -0500
+@@ -141,6 +141,8 @@ extern cgiFormResultType cgiFormRadio(
+ 	char *name, char **valuesText, int valuesTotal, 
+ 	int *result, int defaultV);	
+ 
++extern const char* cgiFormFileGetTempfileName(char* name);
++
+ /* The paths returned by this function are the original names of files
+ 	as reported by the uploading web browser and shoult NOT be
+ 	blindly assumed to be "safe" names for server-side use! */
Signature · 1 line
1.7.8.6
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 3/3 use TARGET_CONFIGURE_OPTS instead of homegrown ENV

In reply to David Bender
---
 package/cgic/cgic.mk |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
package/cgic/cgic.mk +2 -5
index 378e1cd..a575a16 100644
@@ -9,14 +9,11 @@ CGIC_SOURCE = cgic206.tar.gz
 CGIC_SITE = http://boutell.com/cgic
 CGIC_LICENSE = Custom
 CGIC_LICENSE_FILES = license.txt
-
-CGIC_ENV = AR=$(TARGET_CROSS)ar \
-	CC=$(TARGET_CROSS)gcc \
-	RANLIB=$(TARGET_CROSS)ranlib
+CGIC_INSTALL_STAGING = YES
 
 define CGIC_BUILD_CMDS
 	(cd $(@D); \
-		$(CGIC_ENV) \
+		$(TARGET_CONFIGURE_OPTS) \
 		make libcgic.a \
 		)
 endef
Signature · 1 line
1.7.8.6
#6 lore raw

PATCH 3/3 use TARGET_CONFIGURE_OPTS instead of homegrown ENV

David,
Seems like you should have squashed this into a single "cigic: new package" patch, no? Forgot to rebase?
Danomi -

Quoted 34 lines · David Bender
---
 package/cgic/cgic.mk |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
package/cgic/cgic.mk +2 -6
index 378e1cd..a575a16 100644
@@ -9,14 +9,11 @@ CGIC_SOURCE = cgic206.tar.gz
 CGIC_SITE = http://boutell.com/cgic
 CGIC_LICENSE = Custom
 CGIC_LICENSE_FILES = license.txt
-
-CGIC_ENV = AR=$(TARGET_CROSS)ar \
-       CC=$(TARGET_CROSS)gcc \
-       RANLIB=$(TARGET_CROSS)ranlib
+CGIC_INSTALL_STAGING = YES
 
 define CGIC_BUILD_CMDS
        (cd $(@D); \
-               $(CGIC_ENV) \
+               $(TARGET_CONFIGURE_OPTS) \
                make libcgic.a \
                )
 endef
--

1.7.8.6

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

PATCH 3/3 use TARGET_CONFIGURE_OPTS instead of homegrown ENV

Danomi, David,All,

On 2015-01-22 16:32 -0500, Danomi Manchego spake thusly:

Quoted 3 lines

David,
Seems like you should have squashed this into a single "cigic: new package" patch, no? Forgot to rebase?

In fact, I asked David to send his patches as-is, because we discussed on IRC an issue remaining about licensing information that did not get saved for some of the packages while it got saved for the others.

I was supposed to review the patches tonight (UTC+1), but got delayed due to heavy electricity work in the house...

Of course, you are entirely right: the patches about each single package should have been squahes. That can be done later when we have solved the licensing info issue.

Thanks for your early review! ;-)

Regards,
Yann E. MORIN.

Quoted 35 lines · David Bender
Quoted 34 lines
---
 package/cgic/cgic.mk |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
package/cgic/cgic.mk +2 -6
index 378e1cd..a575a16 100644
@@ -9,14 +9,11 @@ CGIC_SOURCE = cgic206.tar.gz
 CGIC_SITE = http://boutell.com/cgic
 CGIC_LICENSE = Custom
 CGIC_LICENSE_FILES = license.txt
-
-CGIC_ENV = AR=$(TARGET_CROSS)ar \
-       CC=$(TARGET_CROSS)gcc \
-       RANLIB=$(TARGET_CROSS)ranlib
+CGIC_INSTALL_STAGING = YES
 
 define CGIC_BUILD_CMDS
        (cd $(@D); \
-               $(CGIC_ENV) \
+               $(TARGET_CONFIGURE_OPTS) \
                make libcgic.a \
                )
 endef
--

1.7.8.6

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 1/3 cgic: new package

In reply to David Bender

David,

On Thu, Jan 22, 2015 at 2:11 PM, David Bender <[email protected]> wrote:
snip

Quoted 7 lines
package/cgic/cgic.mk new file +6 -0
@@ -0,0 +1,36 @@
+################################################################################
+#
+# cgic
+#
+################################################################################
+

package/cgic/cgic.mk line 16

Quoted 10 lines
package/cgic/cgic.mk new file +10 -0
+CGIC_VERSION = 2.06
+CGIC_SOURCE = cgic206.tar.gz
+CGIC_SITE = http://boutell.com/cgic
+CGIC_LICENSE = Custom
+CGIC_LICENSE_FILES = license.txt
+
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+       CC=$(TARGET_CROSS)gcc \
+       RANLIB=$(TARGET_CROSS)ranlib
+

Could use TARGET_CONFIGURE_OPTS instead of defining your own CGIC_ENV.

package/cgic/cgic.mk line 22

Quoted 6 lines
package/cgic/cgic.mk new file +6 -0
+define CGIC_BUILD_CMDS
+       (cd $(@D); \
+               $(CGIC_ENV) \
+               make libcgic.a \
+               )
+endef

Instead of a compound cd/make, why not just use -C? Should use $(MAKE) as well.

define CGIC_BUILD_CMDS

    $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) libcgic.a

endef

Same comment for the steps below.

Danomi -

Quoted 21 lines
package/cgic/cgic.mk new file +14 -1
+
+define CGIC_INSTALL_STAGING_CMDS
+       (cd $(@D); \
+               PREFIX=$(STAGING_DIR) make install \
+               )
+endef
+
+define CGIC_INSTALL_TARGET_CMDS
+       (cd $(@D); \
+               PREFIX=$(TARGET_DIR) make install \
+               )
+endef
+
+$(eval $(generic-package))
--

1.7.8.6

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#9 lore raw

PATCH 1/3 cgic: new package

In reply to David Bender

David, All,

On 2015-01-22 14:11 -0500, David Bender spake thusly:

Quoted 1 line

Added cgic library.

As for benejson, the three patches adding cgic should be squashed into a single patch.

I'll handle that and resubmit it as well.

Thanks for your contribution! :-)

Regards,
Yann E. MORIN.

Quoted 127 lines
---
 package/Config.in                             |    1 +
 package/cgic/Config.in                        |    6 ++++
 package/cgic/cgic-0000-prepare_makefile.patch |   40 +++++++++++++++++++++++++
 package/cgic/cgic.mk                          |   36 ++++++++++++++++++++++
 4 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 package/cgic/Config.in
 create mode 100644 package/cgic/cgic-0000-prepare_makefile.patch
 create mode 100644 package/cgic/cgic.mk
package/Config.in +1 -0
index 266de13..a6fa27d 100644
@@ -816,6 +816,7 @@ menu "Networking"
 	source "package/agentpp/Config.in"
 	source "package/c-ares/Config.in"
 	source "package/canfestival/Config.in"
+	source "package/cgic/Config.in"
 	source "package/cppzmq/Config.in"
 	source "package/czmq/Config.in"
 	source "package/filemq/Config.in"
package/cgic/Config.in new file +6 -0
new file mode 100644
index 0000000..402460d
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_CGIC
+	bool "cgic"
+	help
+	  C CGI library
+
+	  http://www.boutell.com/cgic/
package/cgic/cgic-0000-prepare_makefile.patch new file +40 -0
new file mode 100644
index 0000000..46b7a81
@@ -0,0 +1,40 @@
+Binary files cgic206/cgic.o and cgic206-br/cgic.o differ
+Binary files cgic206/libcgic.a and cgic206-br/libcgic.a differ
+diff -rupN cgic206/Makefile cgic206-br/Makefile
+--- cgic206/Makefile	2014-03-16 18:17:11.000000000 -0400
++++ cgic206-br/Makefile	2015-01-16 11:18:03.714874000 -0500
+@@ -1,15 +1,14 @@
+-CFLAGS=-g -Wall
+-CC=gcc
+-AR=ar
+-RANLIB=ranlib
+ LIBS=-L./ -lcgic
+ 
+ all: libcgic.a cgictest.cgi capture
+ 
+ install: libcgic.a
+-	cp libcgic.a /usr/local/lib
+-	cp cgic.h /usr/local/include
+-	@echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.
++	cp libcgic.a $(PREFIX)/usr/lib
++	cp cgic.h $(PREFIX)/usr/include
++	@echo libcgic.a is in $(PREFIX)/usr/lib. cgic.h is in $(PREFIX)/usr/include.
++
++cgi.o: cgic.c cgic.h
++	$(CC) $(CFLAGS) cgic.c -o cgic.o
+ 
+ libcgic.a: cgic.o cgic.h
+ 	rm -f libcgic.a
+@@ -19,10 +18,10 @@ libcgic.a: cgic.o cgic.h
+ #mingw32 and cygwin users: replace .cgi with .exe
+ 
+ cgictest.cgi: cgictest.o libcgic.a
+-	gcc cgictest.o -o cgictest.cgi ${LIBS}
++	$(CC) cgictest.o -o cgictest.cgi ${LIBS}
+ 
+ capture: capture.o libcgic.a
+-	gcc capture.o -o capture ${LIBS}
++	$(CC) capture.o -o capture ${LIBS}
+ 
+ clean:
+ 	rm -f *.o *.a cgictest.cgi capture
package/cgic/cgic.mk new file +36 -0
new file mode 100644
index 0000000..378e1cd
@@ -0,0 +1,36 @@
+################################################################################
+#
+# cgic
+#
+################################################################################
+
+CGIC_VERSION = 2.06
+CGIC_SOURCE = cgic206.tar.gz
+CGIC_SITE = http://boutell.com/cgic
+CGIC_LICENSE = Custom
+CGIC_LICENSE_FILES = license.txt
+
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+	CC=$(TARGET_CROSS)gcc \
+	RANLIB=$(TARGET_CROSS)ranlib
+
+define CGIC_BUILD_CMDS
+	(cd $(@D); \
+		$(CGIC_ENV) \
+		make libcgic.a \
+		)
+endef
+
+define CGIC_INSTALL_STAGING_CMDS
+	(cd $(@D); \
+		PREFIX=$(STAGING_DIR) make install \
+		)
+endef
+
+define CGIC_INSTALL_TARGET_CMDS
+	(cd $(@D); \
+		PREFIX=$(TARGET_DIR) make install \
+		)
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.8.6
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'