File EMBOSS.spec of Package EMBOSS

#
# spec file for package EMBOSS
#
# Copyright (c) 2016 SUSE LINUX 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/
#


# TODO:
# fix jemboss and enable it
# This would involve packaging jalview (specifically, the Applet)
# The jalview code has a LOT of bundled pre-built jars.
# Find out what patch-1-24.gz actually does and if it's still necessary on 6.6.0

#jemboss is disabled by default due to the fact it bundles a few .jar files which are not built from source.
%bcond_with jemboss

#use --with sunjava if sun's jre is used
%bcond_with sunjava

%if %{with sunjava}
%define _java /usr/java/default
%endif

%define emhome %{_datadir}/EMBOSS

Name:           EMBOSS
Version:        6.6.0
Release:        0
Summary:        The European Molecular Biology Open Software Suite
License:        GPL-2.0+ and LGPL-2.1+ and BSD-3-Clause
Group:          Productivity/Scientific/Other

# Files under jemboss/, ajax/ensembl/ are LGPLv2+
# Files under ajax/pcre/ are BSD
# Files under ajax/zlib/ are zlib/libpng
Url:            http://www.emboss.org/

Source0:        ftp://emboss.open-bio.org/pub/%{name}/%{name}-%{version}.tar.gz
Source1:        %{name}-rpmlintrc

# Upstream patch
#Patch0:         patch-1-24.gz

Patch1:         EMBOSS-6.6.0-system-pcre.patch
Patch2:         EMBOSS-6.6.0-system-expat.patch
Patch3:         EMBOSS-6.6.0-system-zlib.patch
Patch4:         EMBOSS-6.6.0-implicit_declarations.patch
Patch5:         EMBOSS-6.6.0-disable_end_update.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  autoconf >= 2.64
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gd-devel
BuildRequires:  libexpat-devel
BuildRequires:  libharu-devel
BuildRequires:  libmysqlclient-devel
BuildRequires:  glibc-devel
BuildRequires:  pam-devel
BuildRequires:  pcre-devel
BuildRequires:  postgresql-devel
BuildRequires:  unzip
BuildRequires:  xorg-x11-libX11-devel
BuildRequires:  zlib-devel

%if 0%{?suse_version} <= 1120
BuildRequires:  libpng-devel
%else
BuildRequires:  libfreetype6
BuildRequires:  libpng16-compat-devel
%endif

%if %{with jemboss}
BuildRequires:  ant
BuildRequires:  classpathx-mail
BuildRequires:  desktop-file-utils
BuildRequires:  gnu-jaf
BuildRequires:  java-1_6_0-openjdk-devel
BuildRequires:  jpackage-utils
BuildRequires:  regexp
BuildRequires:  xerces-j2
%endif

%if %{with sunjava}
Requires:       jdk = 2000:1.6.0_17-fcs
%endif

%description
EMBOSS is a free Open Source software analysis package specially
developed for the needs of the molecular biology (e.g. EMBnet) user community.
The software automatically copes with data in a variety of formats and even
allows transparent retrieval of sequence data from the web. Also, as extensive
libraries are provided with the package, it is a platform to allow other
scientists to develop and release software in true open source spirit.
EMBOSS also integrates a range of currently available packages and tools for
sequence analysis into a seamless whole.

Reference for EMBOSS: Rice,P. Longden,I. and Bleasby,A.
"EMBOSS: The European Molecular Biology Open Software Suite"
Trends in Genetics June 2000, vol 16, No 6. pp.276-277


%package devel
Summary:        Development tools for programs which will use the %{name} library
Group:          Development/Libraries/Other
Requires:       %{name}-libs = %{version}-%{release}
Requires:       gd-devel
Requires:       glibc-devel
Requires:       libexpat-devel
Requires:       libharu-devel
%if 0%{?suse_version} <= 1120
Requires:       libpng-devel
%else
Requires:       libpng16-compat-devel
%endif
Requires:       pam-devel
Requires:       pcre-devel
Requires:       zlib-devel


%description devel
The %{name}-devel package includes the header files and static libraries
necessary for developing programs which will use the %{name} library.

%package libs
Summary:        Shared libraries for %{name}
Group:          System/Libraries

%description libs
The %{name}-libs package includes the dynamic libraries necessary for %{name}.

%package docs
Summary:        Documentation for %{name}
Group:          Documentation/Other

%description docs
The %{name}-docs package includes the documentation for %{name}.

%package test
Summary:        Test files for %{name}
Group:          Productivity/Scientific/Other

%description test
The %{name}-test package includes the test files for %{name} development.

%if %{with jemboss}
%package -n jemboss
Summary:        Java interface to %{name}
Group:          Applications/Engineering
Requires:       %{name} = %{version}-%{release}
Requires:       gnu-jaf
Requires:       java >= 1:1.6.0
Requires:       javamail
Requires:       jpackage-utils
Requires:       regexp
Requires:       xerces-j2

%description -n jemboss
Jemboss is a Java interface to EMBOSS, developed at
the HGMP-RC and in close collaboration with the EMBOSS
development team. It is distributed as part of the EMBOSS
software.

Documentation on Jemboss can be found at:
http://www.hgmp.mrc.ac.uk/Software/EMBOSS/Jemboss/
%endif

%prep
%setup -q
#%%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

#these files were executable for some reason
chmod 644 emboss/prettyplot.c emboss/polydot.c emboss/supermatcher.c

%if %{with jemboss}
#use newer log4j version
sed -i "s@log4j-1.2.8@log4j-1.2.14@" \
    jemboss/lib/axis/Makefile.am \
    jemboss/lib/axis/Makefile.in \
    jemboss/utils/makeFileManagerJNLP.sh \
    jemboss/utils/makeJNLP.sh

#use system java libraries
rm jemboss/lib/{activation,jakarta-regexp-1.2,jemboss,mail,xerces}.jar
build-jar-repository -s -p jemboss/lib activation regexp javamail xerces-j2
mv jemboss/lib/regexp.jar jemboss/lib/jakarta-regexp-1.2.jar
mv jemboss/lib/javamail.jar jemboss/lib/mail.jar
mv jemboss/lib/xerces-j2.jar jemboss/lib/xerces.jar
%endif

%build
autoreconf -fi
%if %{with sunjava}
export PATH=$PATH:%{_java}/bin/
%endif

# Remove bundled expat, pcre and zlib to make sure that system versions are used
rm -rf ajax/{expat,pcre,zlib}

%configure \
  --disable-static \
  --with-x \
  --with-auth \
  --with-thread \
  --includedir=%{_includedir}/EMBOSS \
  --enable-systemlibs \
%ifarch ppc64 sparc64 x86_64
  --enable-64 \
%endif
%if %{with jemboss}
  --with-java=/usr/lib/jvm/java/include \
  --with-javaos=/usr/lib/jvm/java/include/linux
%endif
%if %{with sunjava}
  --with-java=%{_java}/include
  --with-javaos=%{_java}/include/linux
%endif

make %{?_smp_mflags}

%install
%if %{with sunjava}
export PATH=$PATH:%{_java}/bin/
%endif

make install DESTDIR=%{buildroot}

install -m 755 -d %{buildroot}/%{_sysconfdir}/profile.d
cat << __EOF__ >> %{buildroot}/%{_sysconfdir}/profile.d/emboss.sh
export PLPLOT_LIB=%{emhome}
export EMBOSS_ACDROOT=%{emhome}/acd
export EMBOSS_DOCROOT=%{_datadir}/doc/packages/EMBOSS
export EMBOSS_DATABASE_DIR=%{emhome}/data
export EMBOSS_DATA=%{emhome}/data
__EOF__

cat << __EOF__ >> %{buildroot}/%{_sysconfdir}/profile.d/emboss.csh
setenv PLPLOT_LIB %{emhome}
setenv EMBOSS_ACDROOT %{emhome}/acd
setenv EMBOSS_DOCROOT %{_datadir}/doc/packages/EMBOSS
setenv EMBOSS_DATABASE_DIR %{emhome}/data
setenv EMBOSS_DATA %{emhome}/data
__EOF__

#this file has zero length, so kill it
rm %{buildroot}%{_datadir}/EMBOSS/test/data/dna.aln

%if %{with jemboss}
#fix executable permissions
pushd %{buildroot}%{_datadir}/EMBOSS/jemboss/utils
chmod +x install-jemboss-server.sh keys.sh makeFileManagerJNLP.sh makeJar.csh \
     makeJNLP.sh
popd
pushd %{buildroot}%{_datadir}/EMBOSS/jemboss/api
chmod +x getClasses.pl makeDocs.csh
popd
%endif

#rename conflicting binaries
mv %{buildroot}%{_bindir}/chaos %{buildroot}%{_bindir}/em_chaos

#move doc to /usr/share/doc/packages/EMBOSS
mkdir -p %{buildroot}%{_datadir}/doc/packages/EMBOSS
mv %{buildroot}%{_datadir}/EMBOSS/doc/manuals %{buildroot}%{_datadir}/doc/packages/EMBOSS
mv %{buildroot}%{_datadir}/EMBOSS/doc/programs %{buildroot}%{_datadir}/doc/packages/EMBOSS
mv %{buildroot}%{_datadir}/EMBOSS/doc/tutorials %{buildroot}%{_datadir}/doc/packages/EMBOSS
rm -rf %{buildroot}%{_datadir}/EMBOSS/doc
ln -s ../doc/packages/EMBOSS %{buildroot}%{_datadir}/EMBOSS/doc
mv AUTHORS ChangeLog FAQ INSTALL NEWS README THANKS LICENSE COPYING %{buildroot}%{_datadir}/doc/packages/EMBOSS

%fdupes %{buildroot}

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_bindir}/*
%exclude %{_bindir}/runJemboss.csh
%exclude %{_bindir}/jembossctl
%{_datadir}/EMBOSS
%exclude %{_datadir}/EMBOSS/jemboss
%exclude %{_datadir}/EMBOSS/test
%exclude %{_datadir}/EMBOSS/doc
%config %{_sysconfdir}/profile.d/*

%files devel
%defattr(-,root,root,-)
%{_libdir}/*.so
%{_libdir}/*.la
%{_includedir}/EMBOSS

%files libs
%defattr(-,root,root,-)
%{_libdir}/*.so.*

%files docs
%defattr(-,root,root,-)
%{_datadir}/doc/packages/EMBOSS
%{_datadir}/EMBOSS/doc

%files test
%defattr(-,root,root,-)
%{_datadir}/EMBOSS/test

%if 0%{?with_jemboss} || 0%{?with_sunjava}
%files -n jemboss
%defattr(-,root,root,-)
%doc jemboss/README jemboss/resources jemboss/api
%{_bindir}/runJemboss.csh
%{_bindir}/jembossctl
%{_datadir}/applications/jemboss.desktop
%{_datadir}/EMBOSS/jemboss
%endif

%changelog
openSUSE Build Service is sponsored by