Blob Blame History Raw
Name:           skychart
Version:        3.0.1.5
Release:        6.20081026svn%{?dist}
Summary:        Planetarium software for the advanced amateur astronomer

# svn export -r1050 https://skychart.svn.sourceforge.net/svnroot/skychart/trunk@1050 skychart-3.0.1.5
# tar czf skychart-3.0.1.5.tar.gz skychart-3.0.1.5

Group:          Amusements/Graphics
License:        GPLv2+
URL:            https://sourceforge.net/projects/skychart/
Source0:        %{name}-%{version}.tar.gz
Source1:        skychart.desktop
Patch0:         skychart-3.0.1.5-config.patch
Patch1:         skychart-3.0.1.5-wl.patch
Patch2:         skychart-3.0.1.5-paths.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# FIXME: http://koji.fedoraproject.org/koji/taskinfo?taskID=918916
ExcludeArch:    ppc64

BuildRequires:  lazarus >= 0.9.26
BuildRequires:  ImageMagick
BuildRequires:  desktop-file-utils
BuildRequires:  dos2unix
BuildRequires:  gtk2-devel
Requires:       xdg-utils
Requires:       tzdata

%description
This program enables you to draw sky charts, making use of the data in 16
catalogs of stars and nebulae. In addition the position of planets,
asteroids and comets are shown.

The purpose of this program is to prepare different sky maps for a
particular observation. A large number of parameters help you to choose
specifically or automatically which catalogs to use, the colour and the
dimension of stars and nebulae, the representation of planets, the display
of labels and coordinate grids, the superposition of pictures, the
condition of visibility and more. All these features make this celestial
atlas more complete than a conventional planetarium.


%prep
%setup -q
%{__unzip} -q tools/doc/wiki_doc.zip -d tools/doc

%patch0 -p1 -b .config
%patch1 -p1 -b .wl
%patch2 -p1 -b .paths
find . -type f -print0 |xargs -0 chmod 644


%build
lazbuild --widgetset=gtk2 --primary-config-path=$PWD/.lazarus skychart/component/cdccomponents.lpk
lazbuild --widgetset=gtk2 --primary-config-path=$PWD/.lazarus skychart/cdc.lpi

# TODO: more libraries. Only 404 seems essential though.
make %{_smp_mflags} CFLAGS="%{optflags} -fPIC" -C skychart/library/plan404

# Create the Icon Theme Specification compilant icon file
convert skychart/bitmaps/mainicon/mainicon.ico skychart.png

# Fix exotic EOL encodings
dos2unix -qk tools/doc/html_doc/en/feature_class_fichiers/common.css
dos2unix -qk tools/doc/html_doc/en/feature_class_fichiers/custom.css
dos2unix -qk tools/doc/releasenotes_ru.txt
dos2unix -qk tools/doc/releasenotes_ua.txt

# A couple of files in Ukrainian documentation have their names and
# links incorrectly escaped, which makes those not UTF-8 compilant as
# well as links broken
charset_fix () { sed -r '
        # Special characters in file names are
        # prefixed by %% vs. %%25 in HTML
        s/\xd1%%(25)?81/с/g
        s/\xd1%%(25)?82/т/g
        s/\xd1%%(25)?8[fF]/я/g
'; }

for ORIGNAME in $(find tools/doc/wiki_doc/uk -name '*.html')
do
        NEWNAME=$(echo $ORIGNAME |charset_fix)
        charset_fix <$ORIGNAME >$ORIGNAME.utf8
        touch -r $ORIGNAME $ORIGNAME.utf8
        rm -f $ORIGNAME
        mv $ORIGNAME.utf8 $NEWNAME
done


%install
rm -rf $RPM_BUILD_ROOT

# Directory structure
install -d $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_libdir}
install -d $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -d $RPM_BUILD_ROOT%{_datadir}/applications
install -d $RPM_BUILD_ROOT%{_datadir}/skychart

# Binary
install -pm 0755 skychart/units/skychart \
        $RPM_BUILD_ROOT%{_bindir}

# Libraries
install -pm 0755 skychart/library/plan404/libplan404.so \
        $RPM_BUILD_ROOT%{_libdir}

# Icon
install -pm 0644 skychart.png $RPM_BUILD_ROOT%{_datadir}/pixmaps

# Menu entry
desktop-file-install --vendor=fedora %{SOURCE1} \
        --dir=$RPM_BUILD_ROOT%{_datadir}/applications

# Data (Yes, tools/install_data.sh exists, but is outdated)
(
        cd tools
        find data/{common_names,earthmap,horizon,language,planet,sample,Themes} -type f
        find data/constellation -maxdepth 1 -type f
        find data/eclipses -type f -name '*.png' -o -name '*.txt'
        find cat -type f -not -regex '.*/src.*' -not -name '*.prj'
        find doc -type f -not -name '*.zip'
) |xargs tar cf - -C tools |tar xf - -C $RPM_BUILD_ROOT%{_datadir}/skychart


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_libdir}/*.so
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%dir %{_datadir}/skychart
%{_datadir}/skychart/data
%{_datadir}/skychart/cat
%doc %{_datadir}/skychart/doc
%doc skychart/gpl.txt


%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig


%changelog
* Wed Apr 08 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 3.0.1.5-6.20081026svn
- Enable GTK2 UI

* Fri Mar 27 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 3.0.1.5-5.20081026svn
- Fix desktop entry categories

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.1.5-4.20081026svn
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Dec 01 2008 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 3.0.1.5-3.20081026svn
- Own /usr/share/skychart (#474037)

* Thu Nov 06 2008 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 3.0.1.5-2.20081026svn
- Temporarily disable ppc64 build due to a compiler bug

* Wed Oct 29 2008 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 3.0.1.5-1.20081026svn
- Rebase to later upstream, since we have more recent fpc and lazarus now

* Sun Oct 26 2008 Lubomir Rintel (Fedora Astronomy) <lkundrak@v3.sk> - 3.0.1.3-1.20071015svn
- Initial packaging attempt