PortSystem  1.0
PortGroup   gnustep 1.0

name            Etoile-devel
version         0.1.9
revision        7
platforms       darwin
maintainers     nomaintainer
homepage        http://www.etoile-project.org/

description     GNUstep based user environement
long_description \
    Etoile intends to be an innovative GNUstep-based user environment \
    built from the ground up on highly modular and light components \
    with project and document orientation in mind.
    
fetch.type      svn
svn.revision    2100
svn.url         http://svn.gna.org/svn/etoile/trunk/Etoile

####################### DEVELOPMENT FETCH ##############################
#fetch {
#    file copy ${portpath}/Etoile ${workpath}
#}
########################################################################

depends_lib         port:SQLClient \
                    path:bin/dbus-daemon:dbus \
                    port:oniguruma5 \
                    port:poppler

worksrcdir          Etoile

patchfiles          patch-etoile.make \
                    patch-PopplerKit-config.sh \
                    patch-xmpp-GNUmakefile

array set gnustep.post_flags {
    Frameworks/AddressesKit/Frameworks/AddressView  -lAddresses
    Frameworks/BookmarkKit                          -lCollectionKit
    Frameworks/SystemConfig                         -lX11
}

post-patch {
    reinplace "s|SCSound.m||" \
        ${worksrcpath}/Frameworks/SystemConfig/Source/GNUmakefile
    reinplace "s|/usr|${prefix}|g" \
        ${worksrcpath}/Services/Private/System/GNUmakefile
}

# We don't build corner because StepTalk is not available yet in MP
build.args      corner=no debug=yes
destroot.args   corner=no debug=yes

post-destroot {

    xinstall -d ${destroot}${prefix}/GNUstep/System/Library/Etoile
    xinstall -m 644 ${worksrcpath}/Services/Private/System/SystemTaskList.plist \
        ${destroot}${prefix}/GNUstep/System/Library/Etoile

    xinstall -d ${destroot}${prefix}/share/xsessions
    xinstall -m 644 ${worksrcpath}/Services/Private/System/etoile.desktop \
        ${destroot}${prefix}/share/xsessions

    set chan [open ${destroot}${prefix}/bin/etoile w]
	puts $chan ". ${prefix}/GNUstep/System/Library/Makefiles/GNUstep.sh; etoile_system"
	close $chan
	file attributes ${destroot}${prefix}/bin/etoile -permissions 0755

    xinstall -d ${destroot}${prefix}/GNUstep/Local/Library/Themes
    copy ${worksrcpath}/Bundles/Camaelon/Nesedah.theme \
        ${destroot}${prefix}/GNUstep/Local/Library/Themes

    copy ${worksrcpath}/Services/User/Calc/Calc.app \
        ${destroot}${prefix}/GNUstep/Local/Applications

    ln -s ${destroot}${prefix}/GNUstep/Local/Applications/Calc.app/Calc \
        ${destroot}${prefix}/GNUstep/Local/Tools

    delete ${destroot}${prefix}/GNUstep/Local/Library/Headers/AddressBook
    ln -s ${destroot}${prefix}/GNUstep/Local/Library/Headers/Addresses \
        ${destroot}${prefix}/GNUstep/Local/Library/Headers/AddressBook
}