File ncbi.spec of Package ncbi

#
# spec file for package ncbi
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           ncbi
Summary:        NCBI Software Development Toolkit
License:        SUSE-Public-Domain
Group:          Productivity/Scientific/Other
Version:        6.1
Release:        0
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  openmotif-devel
BuildRequires:  tcsh
%if 0%{?suse_version} > 1140
BuildRequires:  libjpeg-devel
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(xmuu) 
BuildRequires:  pkgconfig(xp)
%endif
Source:         %{name}.tar.gz
Patch0:         ncbi-6.1-link-to-shared-motif.patch
Patch1:         ncbi-6.1-optflags.patch
Patch2:         ncbi-6.1-strncat-overflow.patch
Patch3:         ncbi-6.1-math-meaning.patch
Patch4:         ncbi-6.1-null-pointer.patch
Patch5:         ncbi-6.1-no-return.patch
Patch6:         ncbi-6.1-sequence-point.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools/ncbi.tar.gz
%define wwwblastdir /var/lib/wwwblast

%description
The NCBI Software Development Toolkit was developed for the production and
 distribution of GenBank, Entrez, BLAST, and related services by NCBI.

%package blast
Summary:        Basic Local Alignment and Search Tool
Group:          Productivity/Scientific/Other
Requires:       ncbi-data

%description blast
The NCBI Basic Local Alignment Search Tool (BLAST) finds regions of
local similarity between sequences. The program compares nucleotide or
protein sequences to sequence databases and calculates the statistical
significance of matches. BLAST can be used to infer functional and
evolutionary relationships between sequences as well as help identify
members of gene families.

%package tools
Summary:        Utilities from the NCBI toolkit
Group:          Productivity/Scientific/Other
Requires:       ncbi-data

%description tools
This packages includes the binaries excluding the blast programs. 
Also contains documentation and man pages.

%package wwwblast
Summary:        Web-interface to the NCBI BLAST set of programs
Group:          Productivity/Scientific/Other
Requires:       apache2
Url:            http://www.ncbi.nlm.nih.gov/BLAST/

%description wwwblast
The wwwblast package contains a suite of standalone programs that perform 
various similarity searches using the BLAST heuristic algorithm. Similar to 
the NCBI BLAST server http://www.ncbi.nlm.nih.gov/blast/. wwwblast provides
a graphic user interface (GUI) through the use of web forms. Individual 
program takes the user inputs from the web form and returns the search result 
to a browser window. There are different web forms for different BLAST 
programs.

%package data
Summary:        NCBI toolkit data files
Group:          Productivity/Scientific/Other

%description data
Data files used by programs in the NCBI toolkit.

%package devel
Summary:        NCBI toolkit header files needed for development
Group:          Development/Libraries/C and C++

%description devel
This package contains the header files required for development of software 
using the NCBI toolkit.

%prep
%setup -q -c %{name}
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6

# fix __DATE and __TIME  this causes the package to rebuild when not needed
BUILDTIME=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%H:%M')
BUILDDATE=$(LC_ALL=C date -ur %{_sourcedir}/%{name}.changes +'%b %d %Y')
sed -i "s/__TIME__/\"$BUILDTIME\"/" $(grep -rl '__TIME__' ncbi)
sed -i "s/__DATE__/\"$BUILDDATE\"/" $(grep -rl '__DATE__' ncbi)
sed -i 's/datetime/\dati/g' $(grep -rl 'datetime' ncbi)


#remove executable permissions
chmod -x ncbi/doc/blast/web_blast.pl
chmod -x ncbi/doc/fwd_check.sh
chmod -x ncbi/doc/fa2htgs/updateHtgsDoc

#remove zero-length files
cd ncbi/network/wwwblast
rm wwwblast.log psiblast.log rpsblast.log
sed -i 's:/usr/local/bin/perl:/usr/bin/perl:' config_setup.pl

%build
export CFLAGS="$RPM_OPT_FLAGS"
./ncbi/make/makedis.csh

%install
#install wwwblast *.cgi and *.REAL binaries
mkdir -p %{buildroot}/%{wwwblastdir}
cd ncbi
install -m 755 bin/*.REAL %{buildroot}/%{wwwblastdir}/
install -m 755 bin/*.cgi %{buildroot}/%{wwwblastdir}/
rm -rf bin/*.REAL
rm -rf bin/*.cgi

#all other binaries
mkdir -p %{buildroot}/%{_bindir}
install -m 755 bin/* %{buildroot}/%{_bindir}/

#devel files
mkdir -p %{buildroot}/%{_includedir}/ncbi

cd include
for m in `find . -type d`; do
	install -d -m 755 $m %{buildroot}/%{_includedir}/ncbi/$m
done

for n in `find . -type f`; do
	install -m 644 $n %{buildroot}/%{_includedir}/ncbi/$n
done
cd ..

#documentation
mkdir -p %{buildroot}/%{_mandir}/man1
install -m 644 doc/man/*.1 %{buildroot}/%{_mandir}/man1/
rm -rf doc/man

mkdir -p %{buildroot}/%{_docdir}/ncbi-blast
install -m 644 doc/blast/* %{buildroot}/%{_docdir}/ncbi-blast/
rm -rf doc/blast

#data files
mkdir -p %{buildroot}/%{_datadir}/ncbi/data
install -m 644 data/* %{buildroot}/%{_datadir}/ncbi/data

#wwwblast
cd network/wwwblast
for j in `find . -type d`; do
    install -d -m 755 %{buildroot}/%{wwwblastdir}/$j
done

mkdir -p %{buildroot}/%{wwwblastdir}/TmpGifs

for k in `find . -type f`; do
    install -m 644 $k %{buildroot}/%{wwwblastdir}/$k;
done

cd %{buildroot}/%{wwwblastdir}/
for m in `find . -name '*.cgi'`; do 
    chmod 755 $m; 
done

chmod 755 %{buildroot}/%{wwwblastdir}/db/CDD/rpsfdb.csh
chmod 755 %{buildroot}/%{wwwblastdir}/db/CDD/make_cdd.csh
chmod 755 %{buildroot}/%{wwwblastdir}/config_setup.pl

mkdir -p %{buildroot}/%{_sysconfdir}/apache2/conf.d

cat << __EOF__ >> %{buildroot}/%{_sysconfdir}/apache2/conf.d/wwwblast.conf
Alias /blast "/var/lib/wwwblast/"

<Directory "/var/lib/wwwblast">
    Options ExecCGI
    AllowOverride None
    AddHandler cgi-script .cgi .REAL
    Order allow,deny
    Allow from all
</Directory>
__EOF__

%fdupes -s %{buildroot}

%clean

%files blast
%defattr(-,root,root)
%{_bindir}/bl2seq
%{_bindir}/blastall
%{_bindir}/blastclust
%{_bindir}/blastpgp
%{_bindir}/copymat
%{_bindir}/fastacmd
%{_bindir}/formatdb
%{_bindir}/formatrpsdb
%{_bindir}/impala
%{_bindir}/makemat
%{_bindir}/megablast
%{_bindir}/rpsblast
%{_bindir}/seedtop
%{_docdir}/ncbi-blast

%files tools
%defattr(-,root,root)
%exclude %{_bindir}/bl2seq
%exclude %{_bindir}/blastall
%exclude %{_bindir}/blastclust
%exclude %{_bindir}/blastpgp
%exclude %{_bindir}/copymat
%exclude %{_bindir}/fastacmd
%exclude %{_bindir}/formatdb
%exclude %{_bindir}/formatrpsdb
%exclude %{_bindir}/impala
%exclude %{_bindir}/makemat
%exclude %{_bindir}/megablast
%exclude %{_bindir}/rpsblast
%exclude %{_bindir}/seedtop
%{_bindir}/*
%{_mandir}/man1/*
%doc ncbi/doc/*

%files wwwblast
%defattr(-,wwwrun,www)
%dir %attr(-,root,root) /etc/apache2
%dir %attr(-,root,root) /etc/apache2/conf.d
%config(noreplace) %attr(-,root,root) %{_sysconfdir}/apache2/conf.d/wwwblast.conf
%dir /var/lib/wwwblast
%config(noreplace) /var/lib/wwwblast/*.rc
%exclude /var/lib/wwwblast/Src
/var/lib/wwwblast/*

%files data
%defattr(-,root,root)
%{_datadir}/ncbi

%files devel
%defattr(-,root,root)
%{_includedir}/ncbi

%changelog
openSUSE Build Service is sponsored by