# Fix ports/65653:
#  * Rename port from clearsilver-py to py-clearsilver
#  * Make it build the Python module
#  * Move manual pages from pkg-plist to Makefile
#  * Add myself to the Whom port header ;-)
# -- Rui Lopes <rui@ruilopes.com>
diff -u py-clearsilver.orig/Makefile py-clearsilver/Makefile
--- py-clearsilver.orig/Makefile	Tue Apr 20 10:11:48 2004
+++ py-clearsilver/Makefile	Tue Apr 20 10:03:44 2004
@@ -1,30 +1,68 @@
-# New ports collection makefile for:   WiLiKi
-# Date created:                22 August 2003
-# Whom:                        Kimura Fuyuki <fuyuki@nigredo.org>
+# New ports collection makefile for: ClearSilver
+# Date created:                      17 April 2004
+# Whom:                              KueiFeng Li <thinker@branda.to>
+# Whom:                              Rui Lopes <rui@ruilopes.com>
 #
-# $FreeBSD: ports/www/wiliki/Makefile,v 1.7 2004/02/13 15:33:09 dannyboy Exp $
+# $FreeBSD$
 #
 
 PORTNAME=	clearsilver
 PORTVERSION=	0.9.7
-CATEGORIES+=	www
+CATEGORIES=	www python
 MASTER_SITES=	http://www.clearsilver.net/downloads/
-PKGNAMESUFFIX=	-py
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 
-MAINTAINER?=	thinker@branda.to
-COMMENT?=	A fast, powerful, and language-neutral template system
+MAINTAINER=	thinker@branda.to
+COMMENT=	A fast, powerful, and language-neutral template system
 
-HAS_CONFIGURE=	yes
+GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
 USE_PYTHON=	yes
+USE_REINPLACE=	yes
+MANCOMPRESSED=	no
 
 CONFLICTS=	clearsilver-0.*
 
-CONFIGURE_ARGS+=	\
-		--disable-apache \
-		--disable-perl \
-		--disable-ruby \
-		--disable-java \
-		--disable-csharp
+CONFIGURE_ARGS=	--disable-apache --disable-perl --disable-ruby \
+		--disable-java --disable-csharp --with-python=${PYTHON_CMD}
+
+MAN3=	cBroadcast.3 cCreate.3 cDestroy.3 cSignal.3 cWait.3 \
+	cgi_cookie_authority.3 cgi_cookie_clear.3 cgi_cookie_set.3 \
+	cgi_cs_init.3 cgi_debug_init.3 cgi_destroy.3 cgi_display.3 cgi_error.3 \
+	cgi_filehandle.3 cgi_init.3 cgi_neo_error.3 cgi_output.3 cgi_parse.3 \
+	cgi_redirect.3 cgi_redirect_uri.3 cgi_register_parse_cb.3 \
+	cgi_url_escape.3 cgi_url_escape_more.3 cgi_url_unescape.3 \
+	cgi_vredirect.3 cgiwrap_getenv.3 cgiwrap_init_emu.3 cgiwrap_init_std.3 \
+	cgiwrap_iterenv.3 cgiwrap_putenv.3 cgiwrap_read.3 cgiwrap_write.3 \
+	cgiwrap_writef.3 cgiwrap_writevf.3 cs_destroy.3 cs_dump.3 cs_init.3 \
+	cs_parse_file.3 cs_parse_string.3 cs_register_strfunc.3 cs_render.3 \
+	dictCleanup.3 dictCreate.3 dictDestroy.3 dictModifyValue.3 dictNext.3 \
+	dictReleaseLock.3 dictRemove.3 dictSearch.3 dictSetValue.3 fCreate.3 \
+	fDestroy.3 fFind.3 fLock.3 fUnlock.3 filter_create_fd.3 \
+	filter_create_fp.3 filter_wait.3 hdf_copy.3 hdf_destroy.3 hdf_dump.3 \
+	hdf_dump_format.3 hdf_dump_str.3 hdf_get_attr.3 hdf_get_child.3 \
+	hdf_get_copy.3 hdf_get_int_value.3 hdf_get_node.3 hdf_get_obj.3 \
+	hdf_get_value.3 hdf_get_valuef.3 hdf_get_valuevf.3 hdf_init.3 \
+	hdf_obj_attr.3 hdf_obj_child.3 hdf_obj_name.3 hdf_obj_next.3 \
+	hdf_obj_top.3 hdf_obj_value.3 hdf_read_string.3 \
+	hdf_read_string_ignore.3 hdf_remove_tree.3 hdf_search_path.3 \
+	hdf_set_attr.3 hdf_set_buf.3 hdf_set_copy.3 hdf_set_int_value.3 \
+	hdf_set_symlink.3 hdf_set_value.3 hdf_set_valuef.3 hdf_sort_obj.3 \
+	hdf_write_file.3 hdf_write_file_atomic.3 hdf_write_string.3 mCreate.3 \
+	mDestroy.3 mLock.3 mUnlock.3 nerr_ignore.3 nerr_log_error.3 \
+	nerr_pass.3 nerr_pass_ctx.3 nerr_raise.3 skipDelete.3 skipFreeList.3 \
+	skipInsert.3 skipNewList.3 skipNext.3 skipRelease.3 skipSearch.3 \
+	wdb_keys.3
+ 
+post-patch:
+	@# Exclude lemon.c, it gives some errors and its not used at all.
+	@${MV} ${WRKSRC}/cs/lemon.c ${WRKSRC}/cs/lemon.c.not_used
+	@# Remove CFLAGS when building the python module, pydistfile is used
+	@# and will do the right thing.
+	@${REINPLACE_CMD} -E 's,(\$$\(PYTHON\)),CFLAGS="" \1,g' ${WRKSRC}/python/Makefile
+
+# This target is only meant to be used by the port maintainer.
+x-generate-plist:
+	(/usr/ports/Tools/scripts/plist -d -m /etc/mtree/BSD.local.dist ${PREFIX}|sed -E 's,.*share/nls/.+$$,,g;s,.*man/.*,,g'|tr -s '\n';echo %%PYTHON_SITELIBDIR%%/neo_cgi.so) > temp-pkg-plist
 
 .include <bsd.port.mk>
diff -u py-clearsilver.orig/distinfo py-clearsilver/distinfo
--- py-clearsilver.orig/distinfo	Tue Apr 20 10:11:48 2004
+++ py-clearsilver/distinfo	Mon Apr 19 12:07:50 2004
@@ -1 +1,2 @@
 MD5 (clearsilver-0.9.7.tar.gz) = a83844356c92b0ce060c5ba08e55c401
+SIZE (clearsilver-0.9.7.tar.gz) = 377694
diff -u py-clearsilver.orig/pkg-descr py-clearsilver/pkg-descr
--- py-clearsilver.orig/pkg-descr	Tue Apr 20 10:11:48 2004
+++ py-clearsilver/pkg-descr	Mon Apr 19 13:24:06 2004
@@ -1,13 +1,15 @@
-ClearSilver is a fast, powerful, and language-neutral template system. It is
+ClearSilver is a fast, powerful, and language-neutral template system.  It is
 designed to make it easy to create template driven static or dynamic
 websites.
 
-ClearSilver is first and foremost designed to be extremely fast. It is coded
+ClearSilver is first and foremost designed to be extremely fast.  It is coded
 completely in C and exported to your script language of choice (i.e. Python,
-Perl). As a result, it is notably faster than template systems written in a
-script language. However, its design has additional benefits. It is also one
+Perl).  As a result, it is notably faster than template systems written in a
+script language.  However, its design has additional benefits.  It is also one
 of the only template systems available which allows you to easily
 mix-and-match multiple programming languages with the same templates, even
-on the same page. This allows you to optimize your website by writing
+on the same page.  This allows you to optimize your website by writing
 C-modules to handle speed-sensitive sections, while leaving the majority of
 your site in easy to write script code.
+
+WWW: http://www.clearsilver.net/
diff -u py-clearsilver.orig/pkg-plist py-clearsilver/pkg-plist
--- py-clearsilver.orig/pkg-plist	Tue Apr 20 10:11:48 2004
+++ py-clearsilver/pkg-plist	Tue Apr 20 09:39:07 2004
@@ -1,145 +1,34 @@
-man/man3/cBroadcast.3
-man/man3/cCreate.3
-man/man3/cDestroy.3
-man/man3/cSignal.3
-man/man3/cWait.3
-man/man3/cgi_cookie_authority.3
-man/man3/cgi_cookie_clear.3
-man/man3/cgi_cookie_set.3
-man/man3/cgi_cs_init.3
-man/man3/cgi_debug_init.3
-man/man3/cgi_destroy.3
-man/man3/cgi_display.3
-man/man3/cgi_error.3
-man/man3/cgi_filehandle.3
-man/man3/cgi_init.3
-man/man3/cgi_neo_error.3
-man/man3/cgi_output.3
-man/man3/cgi_parse.3
-man/man3/cgi_redirect.3
-man/man3/cgi_redirect_uri.3
-man/man3/cgi_register_parse_cb.3
-man/man3/cgi_url_escape.3
-man/man3/cgi_url_escape_more.3
-man/man3/cgi_url_unescape.3
-man/man3/cgi_vredirect.3
-man/man3/cgiwrap_getenv.3
-man/man3/cgiwrap_init_emu.3
-man/man3/cgiwrap_init_std.3
-man/man3/cgiwrap_iterenv.3
-man/man3/cgiwrap_putenv.3
-man/man3/cgiwrap_read.3
-man/man3/cgiwrap_write.3
-man/man3/cgiwrap_writef.3
-man/man3/cgiwrap_writevf.3
-man/man3/cs_destroy.3
-man/man3/cs_dump.3
-man/man3/cs_init.3
-man/man3/cs_parse_file.3
-man/man3/cs_parse_string.3
-man/man3/cs_register_strfunc.3
-man/man3/cs_render.3
-man/man3/dictCleanup.3
-man/man3/dictCreate.3
-man/man3/dictDestroy.3
-man/man3/dictModifyValue.3
-man/man3/dictNext.3
-man/man3/dictReleaseLock.3
-man/man3/dictRemove.3
-man/man3/dictSearch.3
-man/man3/dictSetValue.3
-man/man3/fCreate.3
-man/man3/fDestroy.3
-man/man3/fFind.3
-man/man3/fLock.3
-man/man3/fUnlock.3
-man/man3/filter_create_fd.3
-man/man3/filter_create_fp.3
-man/man3/filter_wait.3
-man/man3/hdf_copy.3
-man/man3/hdf_destroy.3
-man/man3/hdf_dump.3
-man/man3/hdf_dump_format.3
-man/man3/hdf_dump_str.3
-man/man3/hdf_get_attr.3
-man/man3/hdf_get_child.3
-man/man3/hdf_get_copy.3
-man/man3/hdf_get_int_value.3
-man/man3/hdf_get_node.3
-man/man3/hdf_get_obj.3
-man/man3/hdf_get_value.3
-man/man3/hdf_get_valuef.3
-man/man3/hdf_get_valuevf.3
-man/man3/hdf_init.3
-man/man3/hdf_obj_attr.3
-man/man3/hdf_obj_child.3
-man/man3/hdf_obj_name.3
-man/man3/hdf_obj_next.3
-man/man3/hdf_obj_top.3
-man/man3/hdf_obj_value.3
-man/man3/hdf_read_string.3
-man/man3/hdf_read_string_ignore.3
-man/man3/hdf_remove_tree.3
-man/man3/hdf_search_path.3
-man/man3/hdf_set_attr.3
-man/man3/hdf_set_buf.3
-man/man3/hdf_set_copy.3
-man/man3/hdf_set_int_value.3
-man/man3/hdf_set_symlink.3
-man/man3/hdf_set_value.3
-man/man3/hdf_set_valuef.3
-man/man3/hdf_sort_obj.3
-man/man3/hdf_write_file.3
-man/man3/hdf_write_file_atomic.3
-man/man3/hdf_write_string.3
-man/man3/mCreate.3
-man/man3/mDestroy.3
-man/man3/mLock.3
-man/man3/mUnlock.3
-man/man3/nerr_ignore.3
-man/man3/nerr_log_error.3
-man/man3/nerr_pass.3
-man/man3/nerr_pass_ctx.3
-man/man3/nerr_raise.3
-man/man3/skipDelete.3
-man/man3/skipFreeList.3
-man/man3/skipInsert.3
-man/man3/skipNewList.3
-man/man3/skipNext.3
-man/man3/skipRelease.3
-man/man3/skipSearch.3
-man/man3/wdb_keys.3
+bin/cstest
+bin/static.cgi
 include/ClearSilver/ClearSilver.h
+include/ClearSilver/cgi/cgi.h
+include/ClearSilver/cgi/cgiwrap.h
+include/ClearSilver/cgi/date.h
+include/ClearSilver/cgi/html.h
+include/ClearSilver/cs/cs.h
 include/ClearSilver/cs_config.h
+include/ClearSilver/util/dict.h
+include/ClearSilver/util/filter.h
+include/ClearSilver/util/neo_date.h
 include/ClearSilver/util/neo_err.h
 include/ClearSilver/util/neo_files.h
+include/ClearSilver/util/neo_hash.h
+include/ClearSilver/util/neo_hdf.h
 include/ClearSilver/util/neo_misc.h
+include/ClearSilver/util/neo_net.h
 include/ClearSilver/util/neo_rand.h
-include/ClearSilver/util/ulist.h
-include/ClearSilver/util/neo_hdf.h
+include/ClearSilver/util/neo_server.h
 include/ClearSilver/util/neo_str.h
-include/ClearSilver/util/neo_date.h
-include/ClearSilver/util/wildmat.h
-include/ClearSilver/util/neo_hash.h
-include/ClearSilver/util/ulocks.h
 include/ClearSilver/util/rcfs.h
 include/ClearSilver/util/skiplist.h
-include/ClearSilver/util/dict.h
-include/ClearSilver/util/filter.h
-include/ClearSilver/util/neo_net.h
-include/ClearSilver/util/neo_server.h
-lib/libneo_utl.a
-include/ClearSilver/cgi/cgi.h
-include/ClearSilver/cgi/cgiwrap.h
-include/ClearSilver/cgi/date.h
-include/ClearSilver/cgi/html.h
-include/ClearSilver/cs/cs.h
-lib/libneo_cs.a
-bin/cstest
+include/ClearSilver/util/ulist.h
+include/ClearSilver/util/ulocks.h
+include/ClearSilver/util/wildmat.h
 lib/libneo_cgi.a
-bin/static.cgi
+lib/libneo_cs.a
+lib/libneo_utl.a
 %%PYTHON_SITELIBDIR%%/neo_cgi.so
+@dirrm include/ClearSilver/util
 @dirrm include/ClearSilver/cs
 @dirrm include/ClearSilver/cgi
-@dirrm include/ClearSilver/util
 @dirrm include/ClearSilver