rpms/pingus/devel pingus-20060721-datapath.patch, NONE, 1.1 pingus-20060721-gettext.patch, NONE, 1.1 pingus.desktop, NONE, 1.1 pingus.png, NONE, 1.1 pingus.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Tue Jul 25 08:15:00 UTC 2006


Author: jwrdegoede

Update of /cvs/extras/rpms/pingus/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5356/devel

Modified Files:
	.cvsignore sources 
Added Files:
	pingus-20060721-datapath.patch pingus-20060721-gettext.patch 
	pingus.desktop pingus.png pingus.spec 
Log Message:
auto-import pingus-0.7.0-0.2.20060721 on branch devel from pingus-0.7.0-0.2.20060721.src.rpm

pingus-20060721-datapath.patch:

--- NEW FILE pingus-20060721-datapath.patch ---
--- pingus-20060721/src/pingus_main.hxx.datapath	2006-07-21 19:49:31.000000000 +0200
+++ pingus-20060721/src/pingus_main.hxx	2006-07-21 19:49:54.000000000 +0200
@@ -87,6 +87,7 @@
   void deinit_clanlib();
 
   void init_pingus();
+  void init_gettext();
   void init_path_finder();
   void deinit_pingus();
 
--- pingus-20060721/src/pingus_main.cxx.datapath	2006-07-21 19:42:41.000000000 +0200
+++ pingus-20060721/src/pingus_main.cxx	2006-07-21 19:50:20.000000000 +0200
@@ -570,9 +570,10 @@
   CFRelease(ref);
   path_manager.add_path(CL_String::get_path(std::string(resource_path) + "/data/"));
 #else
-  path_manager.add_path(CL_String::get_path(CL_System::get_exe_path() + "/data/"));
-  path_manager.add_path(CL_String::get_path(CL_System::get_exe_path() + "/../data/"));
-  path_manager.add_path(CL_String::get_path(CL_System::get_exe_path() + "/../share/games/pingus/"));
+  char *env_path;
+  path_manager.add_path(PINGUS_DATADIR);
+  if ((env_path=getenv("PINGUS_DATADIR")))
+    path_manager.add_path(env_path);
 #endif
 
   std::list<std::string> file_list;
@@ -585,7 +586,12 @@
                 << "-d option." << std::endl;
       exit(EXIT_FAILURE);
     }
+}
 
+// Initialize locale stuff
+void
+PingusMain::init_gettext()
+{
 #ifdef HAVE_GETTEXT
   textdomain("pingus");
   setlocale(LC_ALL, "");
@@ -830,12 +836,14 @@
 
   try
     {
-      init_path_finder();
+      init_gettext();
 
       quick_check_args(argc, argv);
       read_rc_file();
       check_args(argc, argv);
 
+      init_path_finder();
+
       print_greeting_message();
 #ifdef HAVE_GETTEXT
       setlocale(LC_ALL, font_encoding_locale);

pingus-20060721-gettext.patch:

--- NEW FILE pingus-20060721-gettext.patch ---
--- pingus-20060721/src/gettext.h.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/gettext.h	2006-07-21 12:36:49.000000000 +0200
@@ -19,7 +19,11 @@
 
 #ifndef HEADER_GETTEXT_HXX
 #define HEADER_GETTEXT_HXX
-
+#include <config.h>
+#ifdef HAVE_GETTEXT
+#include <libintl.h>
+#define _(String) gettext(String)
+#else
 #include "tinygettext/tinygettext.hxx"
 
 namespace Pingus {
@@ -28,5 +32,5 @@
 
 #define _(String)        ::Pingus::dictionary_manager.get_dictionary().translate(String).c_str()
 #define N_(id, id2, num) ::Pingus::dictionary_manager.get_dictionary().translate(id, di2, num).c_str()
-
+#endif /* HAVE_GETTEXT */
 #endif /* HEADER_GETTEXT_HXX */
--- pingus-20060721/src/pingus_main.cxx.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/pingus_main.cxx	2006-07-21 15:02:37.000000000 +0200
@@ -127,6 +127,7 @@
 	editor(false),
   refresh_rate(60)
 {
+  font_encoding_locale[0] = 0;
 }
 
 PingusMain::~PingusMain()
@@ -585,9 +586,14 @@
       exit(EXIT_FAILURE);
     }
 
+#ifdef HAVE_GETTEXT
+  textdomain("pingus");
+  setlocale(LC_ALL, "");
+#else
   dictionary_manager.add_directory(path_manager.complete("po/"));
   // Language is automatically picked from env variable
   // dictionary_manager.set_language("de"); 
+#endif
 
   const char* lang = getenv("LC_ALL");
   if(!lang) lang = getenv("LC_MESSAGES");
@@ -596,19 +602,52 @@
   {
     std::string language(lang);
     language.resize(2);
+#ifdef HAVE_GETTEXT
+    char *p;
+    strcpy(font_encoding_locale, lang);
+    /* remove encoding if any */
+    if ((p = strchr(font_encoding_locale, '.')))
+      *p = 0;
+    /* remove modifier if any */
+    if ((p = strchr(font_encoding_locale, '@')))
+      *p = 0;
+    /* Add a territory if none is present */
+    if (!strchr(font_encoding_locale, '_'))
+    {
+      unsigned int i;
+      char buf[16];
+      strcpy(buf, font_encoding_locale);
+      for (i=0; i<strlen(buf); i++)
+        buf[i] = toupper(buf[i]);
+      strcat(font_encoding_locale, "_");
+      strcat(font_encoding_locale, buf);
+    }
+#endif
     if(language == "cs" || language == "sr")
     {
+#ifdef HAVE_GETTEXT
+      strcat(font_encoding_locale, ".ISO-8859-2");
+#else
       dictionary_manager.set_charset("ISO-8859-2");
+#endif
       Pingus::Fonts::encoding = "ISO-8859-2";
     }
     else if(language == "tr")
     {
+#ifdef HAVE_GETTEXT
+      strcat(font_encoding_locale, ".ISO-8859-9");
+#else
       dictionary_manager.set_charset("ISO-8859-9");
+#endif
       Pingus::Fonts::encoding = "ISO-8859-9";
     }
     else
     {
+#ifdef HAVE_GETTEXT
+      strcat(font_encoding_locale, ".ISO-8859-1");
+#else
       dictionary_manager.set_charset("ISO-8859-1");
+#endif
       Pingus::Fonts::encoding = "ISO-8859-1";
     }
   }
@@ -643,10 +682,10 @@
 #endif
 
 #ifdef HAVE_GETTEXT
-  std::cout << _("getext support:               ok") << std::endl;
+  std::cout << _("gettext support:              ok") << std::endl;
   std::cout << _("gettext language:        english") << std::endl;
 #else
-  std::cout << "getext support: missing (only support for english will be available)" << std::endl;
+  std::cout << "getext support: missing, using tinygettext" << std::endl;
 #endif
 
   if (sound_enabled)
@@ -798,6 +837,9 @@
       check_args(argc, argv);
 
       print_greeting_message();
+#ifdef HAVE_GETTEXT
+      setlocale(LC_ALL, font_encoding_locale);
+#endif
 
       init_clanlib();
       init_pingus();
--- pingus-20060721/src/file_dialog_item.cxx.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/file_dialog_item.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -94,7 +94,7 @@
 							reader.read_string("levelname",   file_item.friendly_name);
 							reader.read_string("difficulty",  file_info);
 							file_item.is_accessible = true;
-							file_item.friendly_name = _(file_item.friendly_name);
+							file_item.friendly_name = _(file_item.friendly_name.c_str());
 							file_info = _("Difficulty: ") + file_info;
 							Savegame* sg = SavegameManager::instance()->get(file_item.friendly_name);
 							if (sg)
@@ -133,8 +133,8 @@
 								status = _("Finished!");
 								file_item.is_finished = true;
 							}
-							file_item.friendly_name = _(file_item.friendly_name);
-							file_info = _(file_info);
+							file_item.friendly_name = _(file_item.friendly_name.c_str());
+							file_info = _(file_info.c_str());
 
 						}
 						// Have to limit the size of the printed name
--- pingus-20060721/src/gettext.cxx.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/gettext.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -18,9 +18,9 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "gettext.h"
-
+#ifndef HAVE_GETTEXT
 namespace Pingus {
 TinyGetText::DictionaryManager dictionary_manager;
 }
-
+#endif
 /* EOF */
--- pingus-20060721/src/result_screen.cxx.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/result_screen.cxx	2006-07-21 14:39:16.000000000 +0200
@@ -177,7 +177,7 @@
 
   gc.print_center(Fonts::chalk_large, gc.get_width()/2, 
 									(float)CL_Display::get_height()/2 - 200,
-                  _(result.plf.get_levelname()));
+                  _(result.plf.get_levelname().c_str()));
 
   if (result.success())
     {
--- pingus-20060721/src/theme.cxx.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/theme.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -56,15 +56,15 @@
   if (verbose) std::cout << "Theme: loading: " << filename << std::endl;
   plt.parse(filename);
   
-  title_name = _(plt.get_name());
+  title_name = _(plt.get_name().c_str());
 
   level_filenames = plt.get_levels();
   load_levels();
 
-  if (_(plt.get_description()) != "-")
+  if (_(plt.get_description().c_str()) != "-")
     {
       description.set_font(font);
-      description.set_text(_(plt.get_description()), 350);
+      description.set_text(_(plt.get_description().c_str()), 350);
       has_description = true;
     }
   else
@@ -327,7 +327,7 @@
       try
 	      {
                 XMLPingusLevel plf(filename, filename);
-	        levelnames.push_back(_(plf.get_levelname()));
+	        levelnames.push_back(_(plf.get_levelname().c_str()));
 	      }
 	    catch (PingusError& err)
 	      {
--- pingus-20060721/src/worldmap/level_dot.cxx.gettext	2006-07-19 16:00:32.000000000 +0200
+++ pingus-20060721/src/worldmap/level_dot.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -131,7 +131,7 @@
 
   if (accessible())
     {
-      int length = Fonts::pingus_small.bounding_rect(0, 0, _(get_plf().get_levelname())).get_width() / 2;
+      int length = Fonts::pingus_small.bounding_rect(0, 0, _(get_plf().get_levelname().c_str())).get_width() / 2;
       int realpos = static_cast<int>(gc.world_to_screen(Vector(pos.x, pos.y, 0)).x);
       if (realpos - length < 0)
         pos_correction = realpos - length;
@@ -141,7 +141,7 @@
       gc.print_center(Fonts::pingus_small,
                       pos.x - (float)pos_correction,
                       pos.y - 40,
-                      _(get_plf().get_levelname()), 
+                      _(get_plf().get_levelname().c_str()), 
                       10000);
     }
   else
--- pingus-20060721/src/worldmap/worldmap.cxx.gettext	2006-07-19 16:00:32.000000000 +0200
+++ pingus-20060721/src/worldmap/worldmap.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -195,7 +195,7 @@
           gc.print_center(Fonts::chalk_small,
                           display_gc->get_width ()/2,
                           display_gc->get_height() - 20,
-                          _(leveldot->get_plf().get_levelname()));
+                          _(leveldot->get_plf().get_levelname().c_str()));
           
         }
       else
--- pingus-20060721/src/worldmap/worldmap_story.cxx.gettext	2006-07-19 16:00:32.000000000 +0200
+++ pingus-20060721/src/worldmap/worldmap_story.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -40,7 +40,7 @@
 	WorldMapStory::WorldMapStory(const FileReader &reader)
 	{
 		reader.read_string("title", title);
-		title = _(title);
+		title = _(title.c_str());
 		reader.read_string("music", music);
 		FileReader all_pages = reader.read_section("pages");
 
@@ -58,7 +58,7 @@
 			i->read_desc("surface", desc);
 			i->read_string("text", text);
 			// Translate the text and break it up.
-			text = StringFormat::break_line(_(text), 570, Fonts::chalk_normal);
+			text = StringFormat::break_line(_(text.c_str()), 570, Fonts::chalk_normal);
 			pages.push_back(StoryPage(desc, text, page_name));
 		}
 		std::stable_sort(pages.begin(), pages.end(), &StoryPageCompare);
--- pingus-20060721/src/tinygettext/tinygettext.hxx.gettext	2006-07-19 16:00:34.000000000 +0200
+++ pingus-20060721/src/tinygettext/tinygettext.hxx	2006-07-21 12:36:49.000000000 +0200
@@ -25,6 +25,7 @@
 #include <set>
 #include <string>
 
+#ifndef HAVE_GETTEXT
 namespace TinyGetText {
 
 typedef int (*PluralFunc)(int n);
@@ -149,6 +150,7 @@
 
 } // namespace TinyGetText
 
+#endif /* HAVE_GETTEXT */
 #endif
 
 /* EOF */
--- pingus-20060721/src/tinygettext/tinygettext.cxx.gettext	2006-07-19 16:00:34.000000000 +0200
+++ pingus-20060721/src/tinygettext/tinygettext.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include "tinygettext.hxx"
 
+#ifndef HAVE_GETTEXT
 //#define TRANSLATION_DEBUG
 
 namespace TinyGetText {
@@ -789,4 +790,7 @@
 
 } // namespace TinyGetText
 
+#endif /* HAVE_GETTEXT */
+
+
 /* EOF */
--- pingus-20060721/src/pingus_main.hxx.gettext	2006-07-21 14:56:52.000000000 +0200
+++ pingus-20060721/src/pingus_main.hxx	2006-07-21 14:56:52.000000000 +0200
@@ -54,6 +54,14 @@
   CL_Slot on_button_release_slot;
 
   CL_Slot on_exit_press_slot;
+#ifdef HAVE_GETTEXT
+  /* We need to set a modified local with the correct encoding for our fonts
+    but only after printing oru welcome header to stdout in the default
+    encoding. This is used to store the modified local, which gets build in
+    init_path_finder() but doesn't get used until print_greeting_message()
+    is done */
+  char font_encoding_locale[32];
+#endif
 public:
   PingusMain();
   virtual ~PingusMain();
--- pingus-20060721/src/start_screen.cxx.gettext	2006-07-19 16:00:35.000000000 +0200
+++ pingus-20060721/src/start_screen.cxx	2006-07-21 12:36:49.000000000 +0200
@@ -157,7 +157,7 @@
   gc.print_center(Fonts::chalk_large,
                   gc.get_width()/2,
                   (float)CL_Display::get_height()/2 - 200,
-                  _(plf.get_levelname()));
+                  _(plf.get_levelname().c_str()));
 
   gc.print_left(Fonts::chalk_normal,
                 (float)CL_Display::get_width()/2 - 290,
@@ -191,7 +191,7 @@
   if (description != "")
     return description;
 
-  description = _(plf.get_description());
+  description = _(plf.get_description().c_str());
 
   if (description == "")
     return description;


--- NEW FILE pingus.desktop ---
[Desktop Entry]
Encoding=UTF-8
Name=Pingus
Comment=Guide the penguins safely home before they drop of the cliff
Exec=pingus
Icon=pingus.png
Terminal=false
StartupNotify=false
Type=Application
Categories=Application;Game;ArcadeGame;


--- NEW FILE pingus.spec ---
%define snapshot_date 20060721
Name:           pingus
Version:        0.7.0
Release:        0.2.%{snapshot_date}%{?dist}
Summary:        Guide the penguins safely home before they drop of the cliff
Group:          Amusements/Games
License:        GPL
URL:            http://pingus.seul.org/
# create this by doing:
# svn checkout svn://svn.berlios.de/pingus/trunk
# rm -fr `find trunk -name .svn`
# mv trunk pingus-%{snapshot_date}
# tar cvfz pingus-%{snapshot_date}.tar.gz pingus-%{snapshot_date}
Source0:        pingus-%{snapshot_date}.tar.gz
Source1:        pingus.desktop
Source2:        pingus.png
Patch0:         pingus-20060721-gettext.patch
Patch1:         pingus-20060721-datapath.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  ClanLib-devel desktop-file-utils automake gettext

%description
A game inspired by the game Lemmings. You take command in the game of a bunch
of small penguins and have to guide them around in levels. Since the penguins
walk on their own, the player can only influence them by giving them commands,
like build a bridge, dig a hole or redirect all penguins in the other
direction. The goal of each level is to reach the exit, for which multiple
combination of commands are necessary. The game is presented in a 2D site view.


%prep
%setup -q -n %{name}-%{snapshot_date}
%patch0 -p1 -z .gettext
%patch1 -p1 -z .datapath
sed -i 's|$datadir/games/$PACKAGE|$datadir/$PACKAGE|g' configure.ac
./autogen.sh


%build
%configure --disable-dependency-tracking --disable-rpath
# we must rerun autoheader now, don't ask why. When doing a manual build this
# is done automaticly
autoheader
/bin/sh ./config.status config.h
echo "#define HAVE_GETTEXT" >> config.h
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# put pingus in normal dirs instead of games dirs
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mv $RPM_BUILD_ROOT%{_prefix}/games/%{name} $RPM_BUILD_ROOT%{_bindir}
mv $RPM_BUILD_ROOT%{_datadir}/games/%{name}/* \
  $RPM_BUILD_ROOT%{_datadir}/%{name}
# remove the developmemt utilities left in /usr/games
rm $RPM_BUILD_ROOT/usr/games/*
# fix missing metamap stuff
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/metamap
install -m 644 data/metamap/metamap.xml \
  $RPM_BUILD_ROOT%{_datadir}/%{name}/metamap

# fixup translation stuff
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}
for i in *.po; do
   POLANG=`echo $i|sed 's/\.po//'`
   mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/$POLANG/LC_MESSAGES
   msgfmt $i -o $RPM_BUILD_ROOT%{_datadir}/locale/$POLANG/LC_MESSAGES/pingus.mo
   rm $i
done
popd
%find_lang %{name}

# below is the desktop file and icon stuff.
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  --add-category X-Fedora                       \
  %{SOURCE1}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps
install -p -m 644 %{SOURCE2} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README TODO WISHLIST
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{_mandir}/man6/%{name}.6*


%changelog
* Sun Jul 23 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 0.7.0-0.2.20060721
- add missing BR: gettext

* Fri Jul 21 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 0.7.0-0.1.20060721
- initial Fedora Extras package


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/pingus/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	25 Jul 2006 08:04:21 -0000	1.1
+++ .cvsignore	25 Jul 2006 08:15:00 -0000	1.2
@@ -0,0 +1 @@
+pingus-20060721.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/pingus/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	25 Jul 2006 08:04:21 -0000	1.1
+++ sources	25 Jul 2006 08:15:00 -0000	1.2
@@ -0,0 +1 @@
+8d845e1344f62ebda8f2a36634ed35ca  pingus-20060721.tar.gz




More information about the fedora-extras-commits mailing list