# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 59128 2009-10-10 03:15:21Z macsforever2000@macports.org $

PortSystem              1.0

name                    arb
version                 5.1
epoch                   1
categories              science
maintainers             me.com:matt.cottrell 
platforms               darwin

description             ARB graphical DNA, RNA and amino acid sequence analysis tool

homepage                http://www.arb-home.de/

long_description        ARB is an application for genetic sequence analysis that includes tools for editing and aligning \
                        nucleotide and amino acid sequences.  Features include routines for designing fluorescence in situ \
                        hybridization (FISH) probes and PCR and sequencing primers.  Phylogenetic trees can be generated and \
                        sequences can be added to existing trees.  ARB maintains links between the phylogenetic trees and sequences \
                        for data base search and query.  The Silva Comprehensive Ribosomal RNA Database (http://www.arb-silva.de/) \
                        maintaines up-to-date databases.  64-bit ARB is built on 10.6 in order to work with the largest data bases. \
                        32-bit ARB is built on 10.5.  An active community of scientists exchange tips on the ARB Yahoo! discussion group \
                        (http://tech.groups.yahoo.com/group/arb_users/). Citation: Wolfgang Ludwig, et al. (2004) ARB: a software environment \
                        for sequence data. Nucleic Acids Research. 32:1363-1371.

fetch.type              svn
svn.url                 http://svn.mikro.biologie.tu-muenchen.de/svn/branches/stable_5.0
svn.revision            6215
svn.method              checkout
#fetch.user             coder              
#fetch.password         gimmeARBsource
#work around until ticket #21232 is resolved
svn.args                --username coder --password gimmeARBsource 

depends_lib             port:openmotif \
                        port:lynx \
                        port:gsed \
                        port:imake \
                        port:sablotron \
                        port:mesa \
                        port:glw \
                        port:glew \
                        port:tiff 

patchfiles              patch-ARB-config.makefile.diff \
                        patch-ARB-makefile.diff \
                        patch-ARB-RNA3D_GlobalHeader.hxx.diff \
                        patch-ARB-DARWIN.pl.diff
                       
worksrcdir              stable_5.0

use_configure           no
configure.env           ARBHOME=${worksrcpath}  
configure.env-append    PATH=${worksrcpath}/bin:$env(PATH)

configure               {
                        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/PERL2ARB/DARWIN.PL
                        reinplace "s| sed | gsed |g" ${worksrcpath}/GDEHELP/MENUS/align.menu
                        reinplace "s| sed | gsed |g" ${worksrcpath}/util/arb_check_build_env.pl
                        reinplace "s| sed | gsed |g" ${worksrcpath}/arb_install.sh
                        reinplace "s| sed | gsed |g" ${worksrcpath}/WINDOW/AW_status.cxx
                        reinplace "s| sed | gsed |g" ${worksrcpath}/SH/example_batch_probe_match.sh
                        reinplace "s| sed | gsed |g" ${worksrcpath}/GDEHELP/GDEmenus
                        reinplace "s| sed | gsed |g" ${worksrcpath}/GDEHELP/genhelp.sh
                        reinplace "s| sed | gsed |g" ${worksrcpath}/GDEHELP/genhelptree.sh
                        reinplace "s| sed | gsed |g" ${worksrcpath}/SOURCE_TOOLS/make_java_dependencies.sh
                        reinplace "s| sed | gsed |g" ${worksrcpath}/HELP_SOURCE/Makefile
                        reinplace "s| sed | gsed |g" ${worksrcpath}/AISC_COM/AISC/Makefile
                        reinplace "s| sed | gsed |g" ${worksrcpath}/GDEHELP/Makefile
                        reinplace "s| sed | gsed |g" ${worksrcpath}/HELP_SOURCE/genhelp/Makefile
                        reinplace "s| sed | gsed |g" ${worksrcpath}/GDEHELP/Makefile.helpfiles
                        file copy ${worksrcpath}/config.makefile.template ${worksrcpath}/config.makefile
                        reinplace "s|@@PREFIX@@|${prefix}|g" ${filespath}/arb_macsetup
                        file copy ${filespath}/arb_macsetup ${worksrcpath}/bin
}

platform darwin 9      {
post-configure         {
                       reinplace "s|ARB_64 := 1# compile 64bit ARB version|ARB_64 := 0# compile 64bit ARB version|g" ${worksrcpath}/config.makefile
}
}

build.env-append        ${configure.env}
build.env-append        PREFIX=${prefix}

destroot.keepdirs       ${destroot}${prefix}/share/arb/lib/pts

destroot                {
                        eval xinstall -m 0755 [glob ${worksrcpath}/bin/*] ${destroot}${prefix}/bin
                        file mkdir ${destroot}${prefix}/share/arb
                        file mkdir ${destroot}${prefix}/share/arb/bin
                        file copy ${worksrcpath}/lib ${destroot}${prefix}/share/arb/lib
                        file copy ${worksrcpath}/GDEHELP ${destroot}${prefix}/share/arb/GDEHELP
                        file mkdir ${destroot}${prefix}/lib/help
                        file copy ${worksrcpath}/HELP_SOURCE/oldhelp ${destroot}${prefix}/lib/help
                        file copy ${worksrcpath}/PERL_SCRIPTS ${destroot}${prefix}/share/arb/PERL_SCRIPTS
                        file copy ${worksrcpath}/SH ${destroot}${prefix}/share/arb/SH
                        file copy ${worksrcpath}/demo.arb ${destroot}${prefix}/share/arb
}

post-destroot           {
                        system "chmod a+w ${destroot}${prefix}/share/arb/lib/arb_tcp.dat"
                        system "chmod a+w ${destroot}${prefix}/share/arb/lib/pts"
                        system "chmod a+w ${destroot}${prefix}/share/arb/lib/macros"
                        system "ln -s ${prefix}/bin/arb_pt_server ${destroot}${prefix}/share/arb/bin/arb_pt_server"
                        system "ln -s ${prefix}/bin/arb_name_server ${destroot}${prefix}/share/arb/bin/arb_name_server"
}
                        
post-activate           {
                        system "rm -rf `find ${prefix}/share/arb -type d -name .svn`"

ui_msg "
****************************************************************
Before running ARB you must set ARBHOME and add ARB to your PATH
****************************************************************

You have two options (A is easier, B is more difficult):

A) Open a new terminal window and type arb_macsetup to set up your environment automatically

or
	
B) Follow the steps below:

1a)
bash users add the following lines to your ~/.profile or to your ~/.bashrc

      ARBHOME=${prefix}/share/arb;export ARBHOME
      PATH=${prefix}/share/arb/bin:\$PATH
      export PATH

      enter the following command:
      . ~/.profile
1b)
tcsh users add the following lines to your ~/.cshrc
      setenv ARBHOME ${prefix}/share/arb
      setenv PATH ${prefix}/share/arb\:\$PATH

      enter the following command:
      source ~/.cshrc
2)
type arb to start ARB

A demo data base is located at ${prefix}/share/arb.demo.arb

Please cite: Wolfgang Ludwig, et al. (2004) ARB: a software environment for sequence data. Nucleic Acids Research. 32:1363-1371
"
}