# $Id$
PortSystem        1.0

name              eiffelstudio
set major_version 16.05
set minor_version 98969
version           ${major_version}.${minor_version}
categories        lang
license           GPL-2
platforms         darwin
maintainers       jann
description       The ISE Eiffel Compiler and IDE
long_description  EiffelStudio is a development environment for the \
                  Eiffel programming language developed by Eiffel Software. \
                  EiffelStudio includes a combination of tools integrated under \
                  a single user interface: compiler, interpreter, debugger, \
                  browser, metrics tool, profiler, diagram tool. \
                  The user interface rests on a number of specific UI paradigms, \
                  in particular "pick-and-drop" for effective browsing.
homepage          http://www.eiffel.com
master_sites      sourceforge:eiffelstudio:source \
                  http://ftp.eiffel.com/pub/beta/${major_version}:source \
                  http://www.jann-roeder.net/download/:launcher
depends_lib       port:gtk2 \
                  lib:libXtst:xorg-libXtst
depends_build     bin:bzip2:bzip2 \
                  port:pkgconfig

extract.suffix    .tar
extract.cmd       tar
extract.post_args
extract.pre_args  -xf
distname          eiffelstudio-${major_version}
set eiffel_launch eiffel_launcher_20091003.tar.bz2
distfiles         ${distname}${extract.suffix}:source \
                  ${eiffel_launch}:launcher
extract.only      ${distname}${extract.suffix}
worksrcdir        PorterPackage

checksums         ${distname}${extract.suffix} \
                    rmd160  289953b1d198b0088bd8d0f6363dbea2cec2e556 \
                    sha256  7154ee73671b7b29892d7b6ac5ef3819dc2aec95c262e95e9482c6f35a897e25 \
                  ${eiffel_launch} \
                    rmd160 f52af5b8b09ecdd21af4b1d89d2716597a9c1340 \
                    sha256 862bce03664b1ef554e3b8f432cdc77284912d606f6ac58dc47dd499c3a3f594

use_configure     no

set ise_platform ${os.platform}-${os.arch}
platform darwin i386     {
                    if {${build_arch} eq "i386"} {
                        set ise_platform macosx-x86
                    } elseif {${build_arch} eq "x86_64"} {
                        set ise_platform macosx-x86-64
                    }
                  }

platform darwin powerpc  {
                    set ise_platform macosx-ppc
                  }

build             {                   
                    system -W ${worksrcpath} "env CC=${configure.cc} ${worksrcpath}/compile_exes $ise_platform"

                    # Extract Eiffel Launcher
                    system "tar -xjf ${distpath}/${eiffel_launch} -C ${worksrcpath}/Eiffel_${major_version}/"
                  }

post-build        {
                    file attributes ${worksrcpath}/Eiffel_${major_version}/studio/spec/$ise_platform/bin/ec -permissions 0755
                  }

destroot          {
                    xinstall -m 755 -d ${destroot}${applications_dir}
                    file copy ${worksrcpath}/Eiffel_${major_version} ${destroot}${applications_dir}/

                    # Run ranlib on the libraries
                    system "ranlib ${destroot}${applications_dir}/Eiffel_${major_version}/studio/spec/$ise_platform/lib/*.a"
                  }

notes "
To complete the installation you have to add the following to your .bashrc or .profile file : \n\
export ISE_PLATFORM=$ise_platform \n\
export ISE_EIFFEL=${applications_dir}/Eiffel_${major_version} \n\
export GOBO=\$ISE_EIFFEL/library/gobo/svn \n\
export PATH=\$PATH:\$ISE_EIFFEL/studio/spec/\$ISE_PLATFORM/bin:\$GOBO/../spec/\$ISE_PLATFORM/bin \n\
"

livecheck.type    regex
livecheck.version ${minor_version}
livecheck.url     http://sourceforge.net/api/file/index/project-name/eiffelstudio/rss
livecheck.regex   [string range ${version} 0 2]/Build_(\\d+)/