# $Id$

PortSystem 1.0

name            python24-doc
version         2.4.4
categories      lang
license         PSF
platforms       darwin freebsd linux
maintainers     nomaintainer
description     HTML documentation for Python 2.4
long_description    HTML documentation for Python 2.4. Use by running \
                    'pydoc2.4 TOPIC', e.g. 'pydoc2.4 NUMBERS'.

homepage        http://www.python.org/
master_sites    ${homepage}ftp/python/${version}/ \
                ftp://ftp.python.org/pub/python/${version}/
dist_subdir     [lindex [split $name -] 0]
distname        Python-${version}
checksums       md5 0ba90c79175c017101100ebf5978e906
patchfiles      patch-configure \
                patch-Makefile.pre.in \
                patch-Lib-cgi.py \
                patch-Lib-site.py \
                patch-setup.py \
                patch-Include-pyport.h \
                patch-Mac-OSX-Makefile.in \
                patch-Mac-OSX-IDLE-Makefile.in \
                patch-Mac-OSX-PythonLauncher-Makefile.in

use_bzip2       yes

depends_lib     port:gettext port:python24 port:latex2html

configure.args  --enable-shared \
                --mandir=${prefix}/share/man \
                --bindir=${prefix}/bin \
                --libdir=${prefix}/lib \
                --without-readline \
                --enable-framework=${prefix}/Library/Frameworks \
                --disable-tk \
                --enable-ipv6

post-patch {
    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/cgi.py
    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Lib/site.py
    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/Mac/OSX/Makefile.in
    reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/setup.py
}

build.target	html
build.cmd	{ cd Doc && make }

destroot.target frameworkinstall maninstall
destroot {
	set framewdir ${prefix}/Library/Frameworks/Python.framework
	file mkdir ${destroot}${framewdir}/Versions/2.4/Resources/English.ljproj/Documentation
	system "cd $worksrcpath/Doc/html/ && \
		cp -r * ${destroot}${framewdir}/Versions/2.4/Resources/English.ljproj/Documentation"
}


# delete symlinks without version suffix, use python_select instead to choose version

platform puredarwin {
    configure.args-delete   --enable-framework=${prefix}/Library/Frameworks
    configure.args-append   --disable-toolbox-glue --disable-framework
    destroot.target     install maninstall
}

platform darwin 8 {
    configure.args-append --with-cxx=/usr/bin/g++-4.0
}

platform darwin 9 {
    configure.cppflags-append    -D__DARWIN_UNIX03
}

platform freebsd {
    configure.args-delete   --enable-framework=${prefix}/Library/Frameworks
    configure.args-append   --disable-framework
    build.target        all libpython2.4.so
    destroot.target     install maninstall
}

platform linux {
    configure.args-delete   --enable-framework=${prefix}/Library/Frameworks
    configure.args-append   --disable-framework
    build.target        all libpython2.4.so
    destroot.target     install maninstall
}

livecheck.type  regex
livecheck.url   http://www.python.org/download/releases/
livecheck.regex Python (2.4.\[0-9\]+)