# -*- 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

PortSystem              1.0

name                    arb
epoch                   2
version                 6.0.6
revision                2
checksums               rmd160  3bc93a511a6eabb108e9811a3c66ea25182da19f \
                        sha256  8b1fc3fd11bbb05aca4731ac8803c004a4f2b6b87c11b543660d07ea349a6c21 \
                        size    13286019

categories              science
maintainers             nomaintainer

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 database search and query.  The Silva Comprehensive Ribosomal RNA Database (http://www.arb-silva.de/) \
                        maintains up-to-date databases.  An active community of scientists exchanges 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.

license                 Restrictive/Distributable

master_sites            http://download.arb-home.de/release/${name}-${version}/
distname                arb-${version}-source
extract.suffix          .tgz
worksrcdir              arbsrc_15220

# bin/mix
conflicts               elixir

depends_build           port:makedepend \
                        port:pkgconfig

depends_lib             port:openmotif \
                        port:lynx \
                        port:gsed \
                        port:sablotron \
                        port:glw \
                        port:glew \
                        port:xfig \
                        port:gv \
                        port:xorg-libXaw \
                        port:gtime \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:libpng \
                        port:readline \
                        port:zlib \
                        path:libexec/coreutils/libstdbuf.so:coreutils

pre-patch {
    # DOS to UNIX line endings so we can patch.
    reinplace -W ${worksrcpath} "s|\r||g" \
                        GDE/MUSCLE/src/globalsosx.cpp \
                        GDE/MUSCLE/src/subfams.cpp
}

patchfiles              patch-ARB-config.makefile.diff \
                        patch-ARB-globalsosx.cpp.diff \
                        patch-ARB-intro.fig.diff \
                        patch-ARB-subfams.cpp.diff \
                        changeset_18439.diff \
                        patch-ARB-arb.diff
                        
platform darwin {
    if {${os.major} < 11} {
        depends_build-append path:libexec/coreutils/libstdbuf.so:coreutils

        configure.env-append INSTALL=${prefix}/bin/ginstall
    }
}

configure               {
                        if {${build_arch} eq "ppc" || ${build_arch} eq "i386"} {
                            set is64bit 0
                        } else {
                            set is64bit 1
                        }

                        file copy ${worksrcpath}/config.makefile.template ${worksrcpath}/config.makefile
                        reinplace "s|@@64BIT@@|${is64bit}|g" ${worksrcpath}/config.makefile
                        reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/SH/arb_macsetup
}

build.env-append        PREFIX=${prefix} \
                        ARBHOME=${worksrcpath} \
                        PATH=${worksrcpath}/bin:$env(PATH)

compiler.blacklist      *gcc-4.0 *gcc-4.2 {clang < 138}

build.args-append       CXX=${configure.cxx} \
                        CC=${configure.cc}

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

destroot                {
                        # Give the default settings a recognizable name ending in .default
                        file rename ${worksrcpath}/lib/arb_tcp.dat ${worksrcpath}/lib/arb_tcp.dat.default
                        file rename ${worksrcpath}/lib/macros ${worksrcpath}/lib/macros.default

                        xinstall -m 0755 {*}[glob ${worksrcpath}/bin/*] ${destroot}${prefix}/bin

                        file mkdir ${destroot}${prefix}/share/arb/bin
                        file copy ${worksrcpath}/PERL_SCRIPTS ${destroot}${prefix}/share/arb/PERL_SCRIPTS
                        file copy ${worksrcpath}/GDEHELP ${destroot}${prefix}/share/arb/GDEHELP
                        file copy ${worksrcpath}/lib ${destroot}${prefix}/share/arb/lib
                        file copy ${worksrcpath}/SH ${destroot}${prefix}/share/arb/SH
                        file copy ${worksrcpath}/demo.arb ${destroot}${prefix}/share/arb

                        file mkdir ${destroot}${prefix}/lib/help
                        file copy ${worksrcpath}/HELP_SOURCE/oldhelp ${destroot}${prefix}/lib/help

                        ln -s ${prefix}/bin/arb_pt_server ${destroot}${prefix}/share/arb/bin/arb_pt_server
                        ln -s ${prefix}/bin/arb_name_server ${destroot}${prefix}/share/arb/bin/arb_name_server
                        ln -s ${prefix}/bin/muscle ${destroot}${prefix}/share/arb/bin/muscle

                        xinstall -m 777 -d ${destroot}${prefix}/share/arb/lib/pts
}

# to be investigated later
universal_variant       no

post-activate           {
                        # Provide users with copies of the default configuration and macros
                        # if the user doesn't already have them.
                        if {![file exists ${prefix}/share/arb/lib/arb_tcp.dat]} {
                            xinstall -m 777 ${prefix}/share/arb/lib/arb_tcp.dat.default \
                                ${prefix}/share/arb/lib/arb_tcp.dat
                        }
                        if {![file exists ${prefix}/share/arb/lib/macros]} {
                            file copy ${prefix}/share/arb/lib/macros.default \
                                ${prefix}/share/arb/lib/macros
                            fs-traverse item ${prefix}/share/arb/lib/macros {
                                file attributes ${item} -permissions a+w
                            }
                        }
}

notes "
****************************************************************
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) Easy - open a new terminal window and type arb_macsetup to set the necessary environment variables automatically.  This script also enables keyboard shortcuts used in the sequence editor.

or
	
B) More difficult - follow the steps below:

1)
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
2)
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

C) to set up ARB for another user on this computer log into their account and type ${prefix}/bin/arb_macsetup

************************************************************************************************************************************
You can set up keyboard shortcuts manually by creating a text file in your home folder called .xmodmap that contains the text below:
************************************************************************************************************************************

clear Mod1
clear Mod2
keycode 63 = Mode_switch
keycode 66 = Meta_L
keycode 69 = Meta_R
add Mod1 = Meta_L Meta_R
add Mod2 = Mode_switch

*******************************************************************
Use keys Control+Command Arrow Key to jump over bases
Use Keys Option Arrow Key to pull in bases across alignment gaps
Use the right Command Key plus a letter key to activate a menu item
*******************************************************************

*****************************
Type 'arb' to start using ARB
*****************************

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

User generated macros, arb_tcp.dat and pt_servers have been preserved,
but you should keep backups of these just in case.  They are located at:

${prefix}/share/arb/lib/macros/
${prefix}/share/arb/lib/arb_tcp.dat
${prefix}/share/arb/lib/pts/

Default settings are maintained at:

${prefix}/share/arb/lib/macros.default/
${prefix}/share/arb/lib/arb_tcp.dat.default

These notes can be viewed at any time by typing 'port notes arb'

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

livecheck.type          regex
livecheck.url           http://download.arb-home.de/build/
livecheck.regex         ${name}-(\[0-9.\]+)
