Name: mars-sim
Version: 2.84
Release: 4%{?dist}
Summary: Mars Simulation Project
Group: Amusements/Games
License: GPLv2+
URL: http://mars-sim.sourceforge.net/
# The upstream tarball contains (useless) MPEG decoder binaries:
# http://download.sourceforge.net/mars-sim/MarsProject_%{version}.tar.gz
# Download the above tarball and strip it as follows:
# sh mars-sim-strip.sh MarsProject_2.84.tar.gz
Source0: MarsProject_2.84-fedora.tar.gz
Source1: mars-sim-strip.sh
Source2: mars-sim
Source3: mars-sim.png
Source4: mars-sim.desktop
Patch0: mars-sim-2.84-jfreegraph.patch
Patch1: mars-sim-2.84-manifest.patch
Patch2: mars-sim-2.84-paths.patch
Patch3: mars-sim-2.84-java15.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: log4j commons-collections jfreechart jcommon plexus-graph java >= 1.5 jpackage-utils
BuildRequires: %{requires} ant ant-junit java-devel >= 1.5 xerces-j2 >= 1.5 desktop-file-utils
# This currently can not be built with gcj due to various missing features
BuildConflicts: java-devel-gcj
# ^^^ Tamto je nam platne ako hadovi sandale, mock na to aj tak kasle:
BuildRequires: java-devel-openjdk >= 1.5
BuildArch: noarch
%description
The Mars Simulation Project is a free software Java project to create a
simulation of future human settlement of Mars.
The simulation is a multi-agent artificial society set in a detailed
virtual world.
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
Requires: jpackage-utils
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{name}
%patch0 -p1 -b .jfreegraph
%patch1 -p1 -b .manifest
%patch2 -p1 -b .paths
%patch3 -p1 -b .java15
# This is so that I can tap enter on a jar in mc to see manifest :)
find . -type f |xargs chmod -x
%build
# Remove prebuilt stuff -- map jar is not built
find \( -name '*.jar' -o -name '*.zip' \) \
\! -name 'map_data.jar' -exec rm -f '{}' \;
# Encodings
for F in docs/*.txt
do
# credits.txt has Mac line endings, other have PC
sed 's/\r$//g;s/\r/\n/g' $F |
iconv -f ISO-8859-1 -t UTF-8 >$F.conv
touch -r $F $F.conv
mv $F.conv $F
done
# Switch to native look and feel by default
# This can not be easily patched, as the file does not contain line breaks,
# and a xml editing tool would probably be an overkill
sed 's/look-and-feel="default"/look-and-feel="native"/' saved/ui_settings.xml >saved/ui_settings.xml.native
touch -r saved/ui_settings.xml saved/ui_settings.xml.native
mv saved/ui_settings.xml.native saved/ui_settings.xml
# Build classes and documentation
cd scripts
ant build document
%install
rm -rf $RPM_BUILD_ROOT
# Directory structure
install -d $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_javadir}/mars-sim
install -d $RPM_BUILD_ROOT%{_datadir}/mars-sim
install -d $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -d $RPM_BUILD_ROOT%{_datadir}/applications
install -d $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# Install JARs and version them
install -m 644 jars/*.jar *.jar $RPM_BUILD_ROOT%{_javadir}/%{name}
(cd $RPM_BUILD_ROOT%{_javadir}/%{name}; for F in *.jar; do
V=$(echo $F |sed 's/\.jar$/-%{version}.jar/')
mv $F $V
ln -s $V $F
done)
# JavaDoc and data files
cp -rp docs/help images sounds $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -rp conf saved $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -rp docs/javadoc/. $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# Executable
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/mars-sim
# Menu entry and icon
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/pixmaps/mars-sim.png
desktop-file-install --vendor=Fedora %{SOURCE4} \
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_javadir}/mars-sim
%{_datadir}/mars-sim
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%{_bindir}/mars-sim
%doc docs/configuration.txt docs/credits.txt
%doc docs/GPL_License.txt
%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}
%changelog
* Fri May 07 2009 Lubomir Rintel (Fedora Astronomy) <lkundrak@fedoraproject.org> - 2.84-4
- Fix desktop entry categories
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.84-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Thu Jul 24 2008 Lubomir Rintel (Fedora Astronomy) <lkundrak@fedoraproject.org> - 2.84-2
- plexus dependency renamed to plexus-graph
- Require proper JDK
* Sat Jul 19 2008 Lubomir Rintel (Fedora Astronomy) <lkundrak@fedoraproject.org> - 2.84-1
- Initial packaging