--- Portfile.orig	2008-03-25 15:23:42.000000000 +0100
+++ Portfile	2008-03-31 12:55:18.000000000 +0200
@@ -1,31 +1,116 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
 # $Id$
 
 PortSystem 1.0
 name             pike
-version          7.6.24
+version          7.6.112
 categories       lang
-maintainers      nomaintainer
+maintainers      gmx.de:exodusd openmaintainer
 description      dynamic programming language
 long_description \
-	Pike is a dynamic programming language with a syntax \
-	similar to Java and C. It is simple to learn, does \
-	not require long compilation passes and has powerful \
-	built-in data types allowing simple and really fast \
-	data manipulation.
+	    Pike is a dynamic programming language with a syntax \
+        similar to Java and C. It is simple to learn, does \
+	    not require long compilation passes and has powerful \
+	    built-in data types allowing simple and really fast \
+	    data manipulation.
 homepage         http://pike.ida.liu.se/
 platforms        darwin
 
 master_sites     ${homepage}pub/pike/all/${version}/
 distname         Pike-v${version}
-checksums        md5 4e39c43a00c6566a9638ef48499bbc82
-
-use_configure    no
-
-build.args       CONFIGUREARGS="--prefix=${prefix}"
-build.target
+checksums        md5 3ba03096741d6df839d32a940f4a865c \
+                 sha1 211050346d8efc01068e8ea7443f4743116a51be \
+                 rmd160 8983d5bc150beabd1796ff8f05df43e5cf36f467
+
+patchfiles       patch-Request.pike
+
+depends_lib      port:zlib port:gmp port:nettle
+depends_build    port:zlib port:gmp port:nettle
+#default_variants +image +pcre
+
+variant newstyle description {New directory layout for Pike, where everything \
+                              is installed in (prefix)/pike/(pike-version)} {
+    destroot.violate_mtree yes
+}
+
+variant image description {Images (JPEG, PNG, GIF, TIFF) support for Pike} {
+    configure.args-append --with-jpeglib --with-gif --with-tifflib
+    depends_lib-append port:jpeg port:tiff port:libpng port:libungif
+    depends_build-append port:jpeg port:tiff port:libpng port:libungif
+}
+
+variant ttf description {TrueType (TTF) support (using FreeType) for Pike} {
+    configure.args-append --with-freetype
+    depends_lib-append port:freetype
+    depends_build-append port:freetype
+}
+
+variant pcre description {Regular expression support (using PCRE) for Pike} {
+    configure.args-append --with-libpcre
+    depends_lib-append port:pcre
+    depends_build-append port:pcre
+}
+
+variant mysql description {MySQL database support for Pike} {
+    configure.args-append --with-mysql
+    depends_lib-append lib:libmysqlclient:mysql5
+    depends_build-append lib:libmysqlclient:mysql5-devel
+}
+
+variant doc description {Pike documentation} {
+    build.target-append doc
+}
+
+configure.args --mandir=${prefix}/share/man \
+    --with-include-path=${prefix}/include \
+    --with-lib-path=${prefix}/lib \
+    --with-zlib
+
+configure {
+    # setup the build.args here, because then the configure.args from the
+    # variants will have been assembled:
+    if {[variant_isset newstyle]} {
+        build.args CONFIGUREARGS="--prefix=${prefix} ${configure.args}" \
+            INSTALLARGS="--new-style"
+        destroot.destdir buildroot=${destroot} INSTALLARGS="--new-style"
+    } else {
+        build.args CONFIGUREARGS="--prefix=${prefix} ${configure.args}" \
+            INSTALLARGS="--traditional"
+        destroot.destdir buildroot=${destroot} INSTALLARGS="--traditional"
+    }
+}
 
 test.run         yes
 test.target      verify
 
 destroot.target  install_nodoc
-destroot.destdir buildroot=${destroot}
+
+post-destroot {
+    if {[variant_isset newstyle]} {
+        # new style directory layout: all in ${prefix}/pike/${version}/
+        delete file ${destroot}${prefix}/pike/${version}/doc/src
+        xinstall -d ${destroot}${prefix}/pike/${version}/doc
+        xinstall -W ${worksrcpath} README COPYING COPYRIGHT ANNOUNCE \
+            COMMITTERS ${destroot}${prefix}/pike/${version}/doc/
+        if {[variant_isset doc]} {
+            move ${worksrcpath}/refdoc/modref \
+                ${destroot}${prefix}/pike/${version}/doc/
+            move ${worksrcpath}/refdoc/traditional_manual \
+                ${destroot}${prefix}/pike/${version}/doc/
+        }
+    } else {
+        # traditional, MacPorts tree compliant directory layout
+        delete file ${destroot}${prefix}/bin/pike.syms
+        move ${destroot}${prefix}/man/man1/pike.1 \
+            ${destroot}${prefix}/share/man/man1/
+        xinstall -d ${destroot}${prefix}/share/doc/pike-${version}
+        xinstall -W ${worksrcpath} README COPYING COPYRIGHT ANNOUNCE \
+            COMMITTERS ${destroot}${prefix}/share/doc/pike-${version}
+        if {[variant_isset doc]} {
+            move ${worksrcpath}/refdoc/modref \
+                ${destroot}${prefix}/share/doc/pike-${version}
+            move ${worksrcpath}/refdoc/traditional_manual \
+                ${destroot}${prefix}/share/doc/pike-${version}
+        }
+    }
+}
