# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# $Id: Portfile 63769 2010-02-14 15:48:07Z krischik@macports.org $
# vim: set fileencoding=utf-8 tabstop=8 shiftwidth=4 softtabstop=4 noexpandtab filetype=tcl :

PortSystem	    1.0

name		    sigil
version		    0.1.9
revision	    0
platforms	    darwin
categories	    editors
maintainers	    macports.org:krischik
description	    Sigil, the ePub editor
long_description					\
    Sigil is a multi-platform WYSIWYG ebook editor. It	\
    is designed to edit books in ePub format

homepage	    http://code.google.com/p/sigil
master_sites	    googlecode
distfiles	    Sigil-${version}-Code.zip
worksrcdir	    build 
use_zip		    yes
use_parallel_build  yes
universal_variant   no

checksums           md5     2025d332e221733a5d70919001c2e9c6 \
                    sha1    3e7266d0d6577da3ad808acc09833ef378d860d7 \
                    rmd160  38654c326299e69a8def0c6fecdbdfb89116e891

depends_build       bin:cmake:cmake \
		    bin:gmake:gmake
depends_lib	    path:bin/qmake-mac:qt4-mac

configure.env	    PATH="${prefix}/libexec/qt4-mac/bin:$env(PATH)"
configure.cmd	    "cmake"
configure.args	    "-G \"Unix Makefiles\" ${workpath}/Sigil-${version}-Code"

build.env	    PATH="${prefix}/libexec/qt4-mac/bin:$env(PATH)"
build.cmd	    "gmake"
build.args	    ""
build.target	    "Sigil"

platform x86_64 {
    pre-configure {
	reinplace "s|ppc;i386|x86_64|g" ${workpath}/Sigil-${version}-Code/CMakeLists.txt
    }
}

platform powerpc {
    pre-configure {
	reinplace "s|ppc;i386|ppc|g" ${workpath}/Sigil-${version}-Code/CMakeLists.txt
    }
}

platform i386 {
    pre-configure {
	reinplace "s|ppc;i386|i386|g" ${workpath}/Sigil-${version}-Code/CMakeLists.txt
    }
}

pre-configure {
    ui_msg "######################################################"
    ui_msg "# Note: SnowLeopard might need explicit +x86_64      #"
    ui_msg "######################################################"

    file mkdir ${worksrcpath}
}

destroot {
    xinstall -d ${destroot}${applications_dir}

    copy					\
	${worksrcpath}/bin/Sigil.app		\
	${destroot}${applications_dir}
}

