Blob Blame History Raw
Name:           rasmol
Summary:        Molecular Graphics Visualization Tool
Version:        2.7.5.2
Release:        4%{?dist}
License:        GPLv2 and LGPLv2
Group:          Applications/Engineering
URL:            http://www.rasmol.org
Source:         http://www.rasmol.org/software/rasmol-%{version}-13May11.tar.gz
Source1:        rasmol.png
Source2:        rasmol.desktop
Source3:        grasmol.desktop
Source4:        rasmol
Patch1:         rasmol-2.7.5-23Jul09-gtk.patch
Patch2:         rasmol-2.7.5-23Jul09-64b.patch
Patch3:         rasmol-2.7.5-23Jul09-man.patch
Patch4:         RasMol-2.7.5.2_sprintf.patch

BuildRequires:  desktop-file-utils
BuildRequires:  imake
BuildRequires:  libX11-devel
BuildRequires:  libXext-devel
BuildRequires:  libXi-devel
BuildRequires:  libXpm-devel

BuildRequires:  CVector-devel
BuildRequires:  NearTree-devel
BuildRequires:  CQRlib-devel
BuildRequires:  CBFlib-devel
BuildRequires:  xforms-devel

# GTK version:
BuildRequires:  gtk2-devel
BuildRequires:  vte-devel

# Script better support
Requires:       xterm

# Icons dir
Requires:       hicolor-icon-theme

%description
RasMol is a molecular graphics program intended for the visualization of
proteins, nucleic acids and small molecules. The program is aimed at
display, teaching and generation of publication quality images.

%package gtk
Summary:  GTK version of %{name}
Group:    Applications/Engineering
Requires: %{name}%{?_isa} = %{version}-%{release}
%description gtk
%{summary}.

%package doc
Summary:   Documentation and examples for %{name}
Group:     Applications/Engineering
BuildArch: noarch
%description doc
%{summary}.

%prep
%setup -qn RasMol-2.7.5.2
# Fix GTK2 headers dependency
%patch1 -p1
# 64b version require one more definition
%if "%{?__isa_bits}"  == "64"
%patch2 -p1
%endif
# Fix man file
%patch3 -p1
# Fix build error with -Werror=format-security
%patch4 -p1

pushd src
# Fix harcoded vars
# 1) All substitutions beside RASMOLDIR. It is what could brake compilation and compilation only so it is instalation safety.
# 2) RASMOLDIR. It is handle where place PDB and help files. If they (files) whould be in some
#    other place, /usr/lib/rpm/check-files will provide an error.
sed -i -e 's|PKGDIR = $(HOME)|PKGDIR = /usr|' -e 's|/usr/local|/usr|g' \
-e 's|RASMOLDIR = $(USRLIBDIR)/rasmol/|RASMOLDIR = %{_datadir}/rasmol/|' \
-e 's|CBFLIB_DIR)/include/cbflib|CBFLIB_DIR)/include/cbf|' Imakefile_base
# Fix 64b libs location
%if "%{?_lib}" == "lib64"
sed -i -e 's|_DIR)/lib|_DIR)/lib|' Imakefile_base
%endif
popd

# Mac only
rm data/RSML_fixup.csh
# Fix perms
chmod 0644 data/* doc/* ChangeLog/* html_graphics/*
chmod 0644 src/*.[ch]
chmod 0644 ChangeLog.html NOTICE README.html TODO.html history.html PROJECTS

# unzip pdf-s
ls doc/*.pdf.gz | xargs gzip -d

iconv -f ISO-8859-1 -t UTF-8 doc/itrasmol2721.hlp > doc/itrasmol2721_utf.hlp
mv doc/itrasmol2721_utf.hlp doc/itrasmol2721.hlp

%build
pushd src

# GTK version
./rasmol_build_options.sh --pixeldepth=32 --use_gtk
xmkmf

# mistake in sources packaging
unlink rasmol.man

make %{?_smp_mflags} CCOPTIONS="%{optflags}" EXTRA_LIBRARIES="%__global_ldflags"
mv rasmol grasmol

# Clean
make distclean

# Xlib version
./rasmol_build_options.sh --pixeldepth=32 --use_xformslib
xmkmf
make %{?_smp_mflags} CCOPTIONS="%{optflags}" EXTRA_LIBRARIES="%__global_ldflags"

popd

%install
make -C src DESTDIR="%{buildroot}" install install.man

# Make "rasmol" to be "binary rasmol" as main run will be in the script
mv %{buildroot}%{_bindir}/rasmol %{buildroot}%{_bindir}/rasmolb
# And it is "this" scrit that call rasmolb through xterm
install -D -p -m 755 %{SOURCE4} %{buildroot}%{_bindir}/rasmol

# Install GTK version of rasmol
install -D -p -m 755 src/grasmol %{buildroot}%{_bindir}/grasmol

install -p -d %{buildroot}%{_datadir}/rasmol/data
cp data/* %{buildroot}%{_datadir}/rasmol/data/

install -D -p -m 644 %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png

desktop-file-install -m 644 --dir=%{buildroot}%{_datadir}/applications/ %{SOURCE2}
desktop-file-install -m 644 --dir=%{buildroot}%{_datadir}/applications/ %{SOURCE3}

# Remove dublicates with -doc subpackage
rm -f %{buildroot}%{_datadir}/%{name}/{1crn,3cro}.pdb

# not all in doc/ must be in %%doc
# it should be here in %%install section as man page for rasmol is installed from doc/ dir
mv doc doc_prep && mkdir doc
mv doc_prep/*.pdf doc_prep/*.html doc_prep/Licenses.txt doc_prep/README doc_prep/*.hlp doc_prep/RASLIC doc/

%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%files
%doc ChangeLog
%doc GPL NOTICE RASLIC README.txt
%{_bindir}/rasmol
%{_bindir}/rasmolb
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/data
%{_mandir}/man1/%{name}.1*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png

%files gtk
%{_bindir}/grasmol
%{_datadir}/applications/grasmol.desktop

%files doc
%doc doc html_graphics
%doc ChangeLog.html ChangeLog.txt GPL NOTICE PROJECTS RASLIC README.html README.txt TODO.html TODO.txt history.html
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/data
%{_datadir}/%{name}/data/*

%changelog
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.5.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.5.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Feb 12 2014 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5.2-2
- Fix Werror=format-security build error.

* Tue Sep 24 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5.2-1
- Update to 2.7.5.2 version.

* Thu Sep 12 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-10
- Fixed dir ownership.
- Move some files from main package to -doc.

* Thu Jul 25 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-9
- Some missed -p key for install command.
- Added missed entries to the prev changelog section (man file and link flags).

* Mon Jul 22 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-8
- Fixed bogus dates.
- Added GPL file to the -doc subpackage.
- Added -p key to "install" command.
- Fixed man file. Added patch for it.
- Added Fedora link flags.

* Thu Mar 14 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-7
- Let apply 64b patch according to the __isa_bits macros.

* Wed Mar 13 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-6
- Remove update-desktop-database from post and postun scripts as .desktop files do not contain MimeType key.

* Wed Mar 13 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-5
- Dependency for -gtk subpackage uses ?_isa macros.
- Drop main package dependency for -doc subpackage.
- Fix files section for -doc according new deps.
- sed substitutions were commented.
- Fix previouse changelog (added last string).

* Mon Mar 04 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-4
- doc subpackage is noarch now.
- Some cleanups.
- Fix encoding for doc/itrasmol2721.hlp.

* Mon Mar 04 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-3
- Separate some docs and examples in -doc subpackage.

* Sun Mar 03 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-2
- Remove defattr in files section.
- Fix "rasmol" startup script.

* Mon Feb 25 2013 Dmitrij S. Kryzhevich <krege@land.ru> 2.7.5-1
- First build.