Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#17216 closed enhancement (wontfix)

cgilib port enhancement

Reported by: mike@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: Cc: raimue (Rainer Müller)
Port: cgilib

Description

This modifies cgilib so that it builds using GNU autotools. It then uses configure to determine if a system provides strndup (Mac OS X does not), fixing bug #15453.

The pre-configure block requires some explanation. I want to keep the autotools patch small. As a result, things like "missing" are not included. I need to run aclocal, libtoolize, etc. in the proper order.

Change History (9)

comment:1 Changed 16 years ago by mike@…

Trac doesn't seem to be accepting attachments. Here is Portfile-cgilib.patch:

--- Portfile.orig 2008-05-16 17:23:36.000000000 -0400 +++ Portfile 2008-11-12 20:46:53.000000000 -0500 @@ -5,7 +5,7 @@

name cgilib version 0.6 categories www devel

-maintainers nomaintainer +maintainers mikep

description CGI Library

@@ -21,19 +21,19 @@

master_sites http://www.infodrom.org/projects/cgilib/download/

checksums md5 392f00a4ce90426606efcb6ce705fd75

-use_configure no -build.target "" -build.args CFLAGS="-O3 -fPIC -I." -post-build {

  • system "ranlib ${worksrcpath}/libcgi.a"

-} +patchfiles cgilib-autotools.patch \ + cgilib-strndup.patch -destroot.args INSTALL_OPTS_LIB='-m 644 -p' -destroot {

  • xinstall -d -m 755 ${destroot}${prefix}/include \
  • ${destroot}${prefix}/lib ${destroot}${prefix}/man/man3
  • eval xinstall -m 644 [glob ${worksrcpath}/*.h] ${destroot}${prefix}/include
  • eval xinstall -m 755 [glob ${worksrcpath}/libcgi*] ${destroot}${prefix}/lib
  • eval xinstall -m 755 [glob ${worksrcpath}/*.3] ${destroot}${prefix}/share/man/man3

+pre-configure { + # Need to do this manually because of ordering of libtoolize + exec aclocal + exec libtoolize --force + # No idea why exec does not work here. Execution stops after + # automake as if it exits with non-zero, but I confirmed that + # it is exiting with 0. + open "| automake --add-missing --foreign" + exec autoconf + # Patch leaves configure as non-executable. + exec chmod +x configure

}

comment:2 Changed 16 years ago by mike@…

--- Portfile.orig	2008-05-16 17:23:36.000000000 -0400
+++ Portfile	2008-11-12 20:46:53.000000000 -0500
@@ -5,7 +5,7 @@
 name            cgilib
 version         0.6
 categories	www devel
-maintainers     nomaintainer
+maintainers     mikep
 
 description	CGI Library
 
@@ -21,19 +21,19 @@
 master_sites    http://www.infodrom.org/projects/cgilib/download/
 
 checksums       md5 392f00a4ce90426606efcb6ce705fd75
-use_configure	no
 
-build.target	""
-build.args      CFLAGS="-O3 -fPIC -I."
-post-build {
-		system "ranlib ${worksrcpath}/libcgi.a"
-}
+patchfiles      cgilib-autotools.patch \
+                cgilib-strndup.patch
 
-destroot.args	INSTALL_OPTS_LIB='-m 644 -p'
-destroot {
-		xinstall -d -m 755 ${destroot}${prefix}/include \
-			${destroot}${prefix}/lib ${destroot}${prefix}/man/man3
-		eval xinstall -m 644 [glob ${worksrcpath}/*.h] ${destroot}${prefix}/include
-		eval xinstall -m 755 [glob ${worksrcpath}/libcgi*] ${destroot}${prefix}/lib
-		eval xinstall -m 755 [glob ${worksrcpath}/*.3] ${destroot}${prefix}/share/man/man3
+pre-configure {
+                # Need to do this manually because of ordering of libtoolize
+                exec aclocal
+                exec libtoolize --force 
+                # No idea why exec does not work here. Execution stops after
+                # automake as if it exits with non-zero, but I confirmed that
+                # it is exiting with 0.
+                open "| automake --add-missing --foreign"
+                exec autoconf
+                # Patch leaves configure as non-executable.
+                exec chmod +x configure
 }

comment:3 Changed 16 years ago by mike@…

cgilib-autotools.patch

diff -u --recursive --new-file ../cgilib-0.6-vanilla/configure.ac ./configure.ac
--- ../cgilib-0.6-vanilla/configure.ac	1969-12-31 19:00:00.000000000 -0500
+++ ./configure.ac	2008-11-12 19:27:37.000000000 -0500
@@ -0,0 +1,9 @@
+AC_INIT(cgi.c)
+
+AM_INIT_AUTOMAKE(cgilib, 0.6)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+AC_OUTPUT(Makefile)
diff -u --recursive --new-file ../cgilib-0.6-vanilla/Makefile ./Makefile
--- ../cgilib-0.6-vanilla/Makefile	2008-11-12 19:27:31.000000000 -0500
+++ ./Makefile	1969-12-31 19:00:00.000000000 -0500
@@ -1,46 +0,0 @@
-#   Copyright (c) 1998,9,2001,7,8 by Martin Schulze <joey@infodrom.org>
-#
-#   This program is free software; you can redistribute it and/or modify
-#   it under the terms of the GNU General Public License as published by
-#   the Free Software Foundation; either version 2 of the License, or
-#   (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#   GNU General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program; if not, write to the Free Software Foundation
-#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-CFLAGS = -Wall -O2 -g
-IFLAGS = -I.
-LDFLAGS = -L.
-#LIBS = -lcgi
-
-OBJS = cgi.o cookies.o aux.o
-
-CC += $(IFLAGS)
-
-libcgi.a: $(OBJS)
-	ar rc $@ $^
-
-cgitest: cgitest.o libcgi.a
-	$(CC) $(CFLAGS) $(IFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-jumpto: jumpto.o libcgi.a
-	$(CC) $(CFLAGS) $(IFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-all: libcgi.a cgitest jumpto
-
-install: cgitest
-	install -m 755 cgitest /usr/lib/cgi-bin
-
-clean:
-	rm -f cgitest cgitest.o jumpto jumpto.o libcgi.a $(OBJS) *.[35].html
-
-htmlman:
-	for f in *.[35]; do \
-	  man -l $$f|rman -f HTML --title $$f -r "%s.%s.html" > $$f.html; \
-	done
diff -u --recursive --new-file ../cgilib-0.6-vanilla/Makefile.am ./Makefile.am
--- ../cgilib-0.6-vanilla/Makefile.am	1969-12-31 19:00:00.000000000 -0500
+++ ./Makefile.am	2008-11-12 19:27:37.000000000 -0500
@@ -0,0 +1,32 @@
+
+#   Copyright (c) 1998,9,2001,7,8 by Martin Schulze <joey@infodrom.org>
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software Foundation
+#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+lib_LTLIBRARIES = libcgi.la
+
+libcgi_la_SOURCES = cgi.c cookies.c aux.c
+
+bin_PROGRAMS = cgitest jumpto
+
+cgitest_SOURCES = cgitest.c
+cgitest_LDADD = libcgi.la
+
+jumpto_SOURCES = cgitest.c
+jumpto_LDADD = libcgi.la
+
+include_HEADERS = aux.h cgi.h
+
+man_MANS =  cgi.5 cgiDebug.3 cgiEscape.3 cgiFree.3 cgiFreeList.3 cgiGetCookie.3 cgiGetCookies.3 cgiGetFile.3 cgiGetFiles.3 cgiGetValue.3 cgiGetVariables.3 cgiHeader.3 cgiInit.3 cgiRedirect.3 cgiSetHeader.3 cgiSetType.3

comment:4 Changed 16 years ago by mike@…

cgilib-strndup.patch

diff -u --recursive ../cgilib-0.6-vanilla/cgi.c ./cgi.c
--- ../cgilib-0.6-vanilla/cgi.c	2008-11-12 18:42:35.000000000 -0500
+++ ./cgi.c	2008-11-12 19:03:45.000000000 -0500
@@ -841,6 +841,18 @@
     }
 }
 
+#ifndef HAVE_STRNDUP
+char *strndup(const char *s, size_t n) {
+    char *fnval;
+
+    if ((fnval = (char *)malloc (n + 1)) == NULL)
+	return NULL;
+    strncpy(fnval, s, n);
+    fnval[n] = '\0';
+    return fnval;
+}
+#endif
+
 /*
  * Local variables:
  *  c-indent-level: 4
diff -u --recursive ../cgilib-0.6-vanilla/cgi.h ./cgi.h
--- ../cgilib-0.6-vanilla/cgi.h	2008-11-12 18:42:35.000000000 -0500
+++ ./cgi.h	2008-11-12 18:58:03.000000000 -0500
@@ -142,6 +142,10 @@
  */
 char *cgiEscape (char *string);
 
+#ifndef HAVE_STRNDUP
+char *strndup(const char *s, size_t n);
+#endif
+
 #ifdef __cplusplus
 extern }
 #endif
diff -u --recursive ../cgilib-0.6-vanilla/configure.ac ./configure.ac
--- ../cgilib-0.6-vanilla/configure.ac	2008-11-12 19:04:09.000000000 -0500
+++ ./configure.ac	2008-11-12 18:57:10.000000000 -0500
@@ -6,4 +6,6 @@
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 
+AC_CHECK_FUNCS(strndup)
+
 AC_OUTPUT(Makefile)

comment:5 Changed 16 years ago by raimue (Rainer Müller)

Cc: raimue@… added

Trac usually accepts attachment. What error message did you get?

Preferred way to run additional tools would be system:

system "cd ${worksrcpath} && aclocal"

Thanks for your interest in becoming maintainer of this port, but please add your full email address (you can use obfuscation).

comment:6 Changed 16 years ago by mf2k (Frank Schima)

Port: cgilib added

comment:7 Changed 16 years ago by raimue (Rainer Müller)

Resolution: wontfix
Status: newclosed

The current cgilib port builds fine for me so I don't see a need for these patches.

comment:8 Changed 16 years ago by mike@…

Yes, cgilib 0.6 now compiles again. I have no idea what fixed bug number #15453.

comment:9 Changed 16 years ago by (none)

Milestone: Port Enhancements

Milestone Port Enhancements deleted

Note: See TracTickets for help on using tickets.