Re: Crrcsim's data files' location

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2008-07-16 at 21:45 +0300, Joonas Sarajärvi wrote:

> According to the Fedora Games Packaging guidelines, the data files of
> Crrcsim should end up in /usr/share/crrcsim, not in
> /usr/share/games/crrcsim. While I agree with the guideline, Crrcsim's
> configure script doesn't (yet) support this and it always wants to put
> files under the games directory.
> 
> Would someone have any pointers on solving the situation?

Not too long ago, someone asked about packaging crrcsim on fedora-devel,
so I whipped it together. Feel free to take anything useful from my spec
file.

~spot
diff -up crrcsim-0.9.9/config.cpp.BAD crrcsim-0.9.9/config.cpp
--- crrcsim-0.9.9/config.cpp.BAD	2008-07-16 15:53:48.000000000 -0400
+++ crrcsim-0.9.9/config.cpp	2008-07-16 15:56:22.000000000 -0400
@@ -705,6 +705,7 @@ void T_Config::getSearchPathList(std::ve
   // CRRC_DATA_PATH                       (LINUX)
   // /usr/local/share/games/crrcsim       (LINUX)
   // /usr/share/games/crrcsim             (LINUX)
+  // /usr/share/crrcsim                   (LINUX)
 
   // cwd
   if (dirname != "")
@@ -756,6 +757,12 @@ void T_Config::getSearchPathList(std::ve
       s.append(dirname);
       pathlist.push_back(s);
     }
+    s = "/usr/share/crrcsim/";
+    if (s != data_path)    // avoid adding this path twice
+    {
+      s.append(dirname);
+      pathlist.push_back(s);
+    }
   }
   else
   {
@@ -770,6 +777,10 @@ void T_Config::getSearchPathList(std::ve
     {
       pathlist.push_back("/usr/share/games/crrcsim");
     }
+    if (data_path != "/usr/share/crrcsim")  // avoid adding this path twice
+    {
+      pathlist.push_back("/usr/share/crrcsim");
+    }
   }
   #endif
   #if defined(__APPLE__) || defined(MACOSX)

Attachment: CRRCsim.desktop
Description: application/desktop

Summary: A Model-Airplane Flight Simulation Program
Name: crrcsim
Version: 0.9.9
Release: 3%{?dist}
# Some of the code is GPLv2+, but some of it is GPLv2.
# The combined work is therefore the more restrictive of the two.
# TODO: Clarify licensing with upstream
License: GPLv2
Group: Amusements/Games
URL: http://crrcsim.sourceforge.net/
Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: CRRCsim.desktop
Patch0: crrcsim-0.9.9-support_usr_share_crrcsim.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL-devel
BuildRequires: portaudio-devel
BuildRequires: freeglut-devel
BuildRequires: plib-devel
BuildRequires: libXi-devel
BuildRequires: libXt-devel
BuildRequires: libXmu-devel
BuildRequires: desktop-file-utils

%description
Crrcsim is a model-airplane flight simulation program. Using it, you can learn
how to fly model aircraft, test new aircraft designs, and improve your
skills by practicing on your computer. 

It rules! The flight model is very realistic. The flight model parameters are
calculated based on a 3D representation of the aircraft. Stalls are properly
modelled as well. Model control is possible with your own rc transmitter, or
any input device such as joystick, mouse, keyboard ...

%prep
%setup -q
# This enables crrcsim to also look in /usr/share/crrcsim instead of just /usr/share/games/crrcsim/
%patch0 -p1 -b .support_usr_share_crrcsim

# This sets the Makefile to set CRRC_DATA_PATH to /usr/share/crrcsim
sed -i 's|share/games|share|g' Makefile.in

# This fixes the install to go into /usr/share/crrcsim
for i in models/engine/Makefile.in models/Makefile.in models/battery/Makefile.in \
         objects/Makefile.in packages/icons/Makefile.in scenery/Makefile.in      \
         sounds/f3f/default/Makefile.in sounds/f3f/sport/Makefile.in             \
         sounds/Makefile.in textures/Makefile.in; do
  sed -i 's|$(datadir)/games|$(datadir)|g' $i
done
     
# convert to utf-8
# TODO: Have upstream fix this in their source tree for future releases.
for i in documentation/thermals/table*.cpp documentation/changelog.txt; do
  iconv -f iso-8859-1 -t utf-8 -o $i{.utf8,}
  mv $i{.utf8,}
done

# Fix end-of-line encoding
# TODO: Have upstream fix this in their source tree for future releases.
for i in documentation/Install_Win32.txt documentation/input_method/PARALLEL_1_to_3/crrcsim_at90s1200.hex \
         documentation/instructions.txt documentation/dlportio.txt documentation/compile.txt; do
  sed -i -e 's|\r||g' $i
done

# Fix exec perm on sourcecode
# TODO: Have upstream fix this in their source tree for future releases.
chmod -x glconsole.*

%build
%configure
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install

desktop-file-install --vendor=""                        \
        --dir=%{buildroot}%{_datadir}/applications      \
        %{SOURCE1}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc COPYING
%{_datadir}/crrcsim/
%{_defaultdocdir}/%{name}/
%{_bindir}/crrcsim
%{_datadir}/applications/CRRCsim.desktop

%changelog
* Wed Jul 16 2008 Tom "spot" Callaway <tcallawa@xxxxxxxxxx> 0.9.9-3
- minor spec cleanups

* Tue Jun 24 2008 Tom "spot" Callaway <tcallawa@xxxxxxxxxx> 0.9.9-2
- clean up spec file
- add changelog
- be consistent with macros
- use buildroot properly
- don't put files in /usr/local
- don't list unnecessary Requires (rpm picks up the library deps automatically)
- clarify license
- fix desktop file
- use dist tag rather than hardcoding
_______________________________________________
Fedora-games-list mailing list
Fedora-games-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-games-list

[Index of Archives]     [Fedora Music]     [Fedora Extras]     [Kernel]     [Fedora Desktop]     [Fedora Directory]     [PAM]     [CentOS]     [Gimp]     [Yosemite News]     [Yosemite Camping]

  Powered by Linux