rpms/MegaMek/devel MegaMek-directories.patch, NONE, 1.1 MegaMek-icon.png, NONE, 1.1 MegaMek.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Thomas Fitzsimmons (fitzsim) fedora-extras-commits at redhat.com
Tue Oct 17 16:26:41 UTC 2006


Author: fitzsim

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

Modified Files:
	.cvsignore sources 
Added Files:
	MegaMek-directories.patch MegaMek-icon.png MegaMek.spec 
Log Message:
auto-import MegaMek-0.30.11-1 on branch devel from MegaMek-0.30.11-1.src.rpm

MegaMek-directories.patch:

--- NEW FILE MegaMek-directories.patch ---
diff -ur src.orig/megamek/client/bot/BotConfiguration.java src/megamek/client/bot/BotConfiguration.java
--- src.orig/megamek/client/bot/BotConfiguration.java	2006-09-18 01:20:30.000000000 -0400
+++ src/megamek/client/bot/BotConfiguration.java	2006-09-18 01:26:05.000000000 -0400
@@ -9,7 +9,7 @@
 
     static {
         try {
-            BotProperties.load(new FileInputStream("mmconf/bot.properties")); //$NON-NLS-1$
+            BotProperties.load(new FileInputStream(System.getProperty("user.home") + "/.megamek/mmconf/bot.properties")); //$NON-NLS-1$
         } catch (Exception e) {
             System.out.println("Bot properties could not be loaded, will use defaults"); //$NON-NLS-1$
         }
diff -ur src.orig/megamek/client/Client.java src/megamek/client/Client.java
--- src.orig/megamek/client/Client.java	2006-09-18 01:20:30.000000000 -0400
+++ src/megamek/client/Client.java	2006-09-18 01:30:01.000000000 -0400
@@ -922,7 +922,7 @@
                 case Packet.COMMAND_SEND_SAVEGAME:
                     String sFinalFile = (String)c.getObject(0);
                     try {
-                        File sDir = new File("savegames");
+                        File sDir = new File(System.getProperty("user.home") + "/.megamek/savegames");
                         if (!sDir.exists()) {
                             sDir.mkdir();
                         }
diff -ur src.orig/megamek/common/options/GameOptions.java src/megamek/common/options/GameOptions.java
--- src.orig/megamek/common/options/GameOptions.java	2006-09-18 01:20:30.000000000 -0400
+++ src/megamek/common/options/GameOptions.java	2006-09-18 01:26:15.000000000 -0400
@@ -41,7 +41,7 @@
 public class GameOptions extends AbstractOptions implements Serializable {
     static final long serialVersionUID = 5417081099101580392L;
 
-    private static final String GAME_OPTIONS_FILE_NAME = "mmconf/gameoptions.xml"; //$NON-NLS-1$
+    private static final String GAME_OPTIONS_FILE_NAME = System.getProperty("user.home") + "/.megamek/mmconf/gameoptions.xml"; //$NON-NLS-1$
     
     public GameOptions() {
         super();
diff -ur src.orig/megamek/common/preference/ClientPreferences.java src/megamek/common/preference/ClientPreferences.java
--- src.orig/megamek/common/preference/ClientPreferences.java	2006-09-18 01:20:31.000000000 -0400
+++ src/megamek/common/preference/ClientPreferences.java	2006-09-18 02:22:17.000000000 -0400
@@ -60,7 +60,27 @@
         store.setDefault(MAP_TILESET, "defaulthexset.txt");
         store.setDefault(MAX_PATHFINDER_TIME, MovePath.DEFAULT_PATHFINDER_TIME_LIMIT);
         store.setDefault(DATA_DIRECTORY,"data");
-        store.setDefault(LOG_DIRECTORY,"logs");
+        try {
+          File homeDataDir = new File(System.getProperty("user.home") + "/.megamek");
+          if (!homeDataDir.exists()) {
+            homeDataDir.mkdir();
+          }
+          File homeConfDir = new File(System.getProperty("user.home") + "/.megamek/mmconf");
+          if (!homeConfDir.exists()) {
+            homeConfDir.mkdir();
+          }
+          File homeSaveDir = new File(System.getProperty("user.home") + "/.megamek/savegames");
+          if (!homeSaveDir.exists()) {
+            homeSaveDir.mkdir();
+          }
+          File homeLogsDir = new File(System.getProperty("user.home") + "/.megamek/logs");
+          if (!homeLogsDir.exists()) {
+            homeLogsDir.mkdir();
+          }
+        } catch (Exception e) {
+          System.err.println("Unable to create " + System.getProperty("user.home") + "/.megamek directories");
+        }
+        store.setDefault(LOG_DIRECTORY,System.getProperty("user.home") + "/.megamek/logs");
         store.setDefault(MECH_DIRECTORY, store.getDefaultString(DATA_DIRECTORY) + File.separator + "mechfiles");
         store.setDefault(METASERVER_NAME, "http://www.damour.info/cgi-bin/james/metaserver");
         store.setDefault(GOAL_PLAYERS, 2);
diff -ur src.orig/megamek/common/preference/PreferenceManager.java src/megamek/common/preference/PreferenceManager.java
--- src.orig/megamek/common/preference/PreferenceManager.java	2006-09-18 01:20:31.000000000 -0400
+++ src/megamek/common/preference/PreferenceManager.java	2006-09-18 01:27:25.000000000 -0400
@@ -35,7 +35,7 @@
 
 public class PreferenceManager {
 
-    public static final String DEFAULT_CFG_FILE_NAME = "mmconf/clientsettings.xml";
+    public static final String DEFAULT_CFG_FILE_NAME = System.getProperty("user.home") + "/.megamek/mmconf/clientsettings.xml";
     public static final String CFG_FILE_OPTION_NAME = "cfgfilename";
     public static final String ROOT_NODE_NAME = "MegaMekSettings";
     public static final String CLIENT_SETTINGS_STORE_NAME = "ClientSettings";    
diff -ur src.orig/megamek/MegaMek.java src/megamek/MegaMek.java
--- src.orig/megamek/MegaMek.java	2006-09-18 01:20:30.000000000 -0400
+++ src/megamek/MegaMek.java	2006-09-18 01:29:28.000000000 -0400
@@ -361,7 +361,7 @@
 
     public void loadGame() {
         FileDialog fd = new FileDialog(frame, Messages.getString("MegaMek.SaveGameDialog.title"), FileDialog.LOAD); //$NON-NLS-1$
-        fd.setDirectory("savegames"); //$NON-NLS-1$
+        fd.setDirectory(System.getProperty("user.home") + "/.megamek/savegames"); //$NON-NLS-1$
         // limit file-list to savedgames only
         fd.setFilenameFilter(new FilenameFilter() {
             public boolean accept(File dir, String name) {
diff -ur src.orig/megamek/server/Server.java src/megamek/server/Server.java
--- src.orig/megamek/server/Server.java	2006-09-18 01:20:30.000000000 -0400
+++ src/megamek/server/Server.java	2006-09-18 01:30:41.000000000 -0400
@@ -673,7 +673,7 @@
         if (!sFinalFile.endsWith(".sav")) {
             sFinalFile = sFile + ".sav";
         }
-        sFinalFile = "savegames" + File.separator + sFinalFile;
+        sFinalFile = System.getProperty("user.home") + "/.megamek/savegames" + File.separator + sFinalFile;
         File f = new File(sFinalFile);
         try {
             ObjectInputStream ois = new ObjectInputStream(
@@ -699,7 +699,7 @@
             sFinalFile = sFile + ".sav";
         }
         try {
-            File sDir = new File("savegames");
+            File sDir = new File(System.getProperty("user.home") + "/.megamek/savegames");
             if (!sDir.exists()) {
                 sDir.mkdir();
             }


--- NEW FILE MegaMek.spec ---
# camel-case name at the request of the upstream maintainers.
Name:		MegaMek
Version:	0.30.11
Release:	1%{?dist}
Summary:	A portable, network-enabled BattleTech engine

Group:		Amusements/Games
License:	GPL
URL:		http://prdownloads.sourceforge.net/megamek/MegaMek-v0.30.11.zip
Source0:	MegaMek-v0.30.11.zip
# converted from data/images/misc/megamek-icon.gif
Source1:	MegaMek-icon.png
Patch0:		MegaMek-directories.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:		desktop-file-utils
BuildRequires:		java-gcj-compat-devel
Requires(post):		java-gcj-compat
Requires(postun):	java-gcj-compat
Provides:		megamek = %{version}-%{release}

%description
MegaMek is a community effort to implement the Classic BattleTech
rules in an operating-system-agnostic, network-enabled manner.

%prep
%setup -q -c -n MegaMek
%patch0 -p0
# remove included binaries and rebuild everything from source
rm -f MegaMek.exe MegaMek.jar
rm -f lib/TinyXML.jar lib/retroweaver-rt.jar
pushd src
  jar xf ../lib/Ostermiller.jar
  # remove hard-to-build sources that are not required
  rm -f com/Ostermiller/util/*CSV*
  rm -f com/Ostermiller/util/*CGI*
  rm -f com/Ostermiller/util/*Properties*
  rm -r com/Ostermiller/util/*Browser*
  rm -rf META-INF
  jar xf ../lib/PngEncoder.jar
  rm -rf META-INF
  rm -f LICENSE.txt PngEncoderB.html PngEncoder.html
  jar xf ../lib/TabPanel.jar
  rm -rf META-INF gov doc
  rm -f LICENSE README
  mv src/gov .
  rmdir src
  unzip -qq ../lib/tinyXML07-src.zip
  mv sources/*.java .
  mv sources/gd .
  rm -rf classes javadoc
  rmdir sources
  rm -f DevelopmentDiary-TinyXML.txt readme.txt gpl.txt
  jar xf ../lib/collections.jar
  rm -rf META-INF
  rm -f ../lib/collections.jar
  find -name \*.class | xargs rm -f
  rm -f ../lib/Ostermiller.jar ../lib/PngEncoder.jar
  rm -f ../lib/TabPanel.jar ../lib/tinyXML07-src.zip
  find -name .svn | xargs rm -rf
  cp ../l10n/megamek/client/*.properties megamek/client
  cp ../l10n/megamek/client/bot/*.properties megamek/client/bot
  cp ../l10n/megamek/common/*.properties megamek/common
  cp ../l10n/megamek/common/options/*.properties megamek/common/options
popd
find data docs mmconf -name .svn -print0 | xargs -0 rm -rf
find data docs mmconf -type f -print0 | xargs -0 chmod 644
find data docs mmconf -type d -print0 | xargs -0 chmod 755
rm -f mmconf/MegaMek.bat
mv docs/stats.pl .

%build
pushd src
  javac `find -name '*.java'`
  jar cf MegaMek.jar com gd gnu gov keypoint megamek *.class *.java
popd

cat > MegaMek.sh << EOF
#!/bin/sh

cd %{_datadir}/MegaMek
exec java -classpath %{_javadir}/MegaMek.jar megamek.MegaMek
EOF

cat > MegaMek.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=MegaMek
GenericName=A BattleTech engine
Comment=Play MegaMek
Exec=MegaMek
Icon=MegaMek-icon.png
Terminal=false
Type=Application
Categories=Game;BoardGame;
Version=%{version}
EOF

%install
rm -rf $RPM_BUILD_ROOT

install -dm 755 $RPM_BUILD_ROOT%{_javadir}
install -pm 644 src/MegaMek.jar \
  $RPM_BUILD_ROOT%{_javadir}/MegaMek.jar

install -dm 755 $RPM_BUILD_ROOT%{_datadir}/MegaMek
cp -r data docs mmconf $RPM_BUILD_ROOT%{_datadir}/MegaMek
install -pm 644 readme.txt \
  $RPM_BUILD_ROOT%{_datadir}/MegaMek/readme.txt

install -dm 755 $RPM_BUILD_ROOT%{_bindir}
install -pm 755 MegaMek.sh \
  $RPM_BUILD_ROOT%{_bindir}/MegaMek
install -pm 755 stats.pl \
  $RPM_BUILD_ROOT%{_bindir}/MegaMek-stats

install -dm 755 $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  --add-category X-Fedora \
  MegaMek.desktop

install -dm 755 $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -pm 644 %{SOURCE1} \
  $RPM_BUILD_ROOT%{_datadir}/pixmaps/MegaMek-icon.png

%{_bindir}/aot-compile-rpm

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi

%postun
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi

%files
%defattr(-,root,root,-)
%doc HACKING license.txt readme-German.txt readme.txt
%{_javadir}/MegaMek.jar
%{_datadir}/MegaMek
%{_bindir}/MegaMek
%{_bindir}/MegaMek-stats
%{_datadir}/applications/fedora-MegaMek.desktop
%{_datadir}/pixmaps/MegaMek-icon.png

%dir %attr(-,root,root) %{_libdir}/gcj/%{name}
%attr(-,root,root) %{_libdir}/gcj/%{name}/MegaMek.jar.*

%changelog
* Sat Sep 16 2006 Thomas Fitzsimmons <fitzsim at redhat.com> - 0.30.11-1
- Initial build.


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/MegaMek/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	17 Oct 2006 16:17:50 -0000	1.1
+++ .cvsignore	17 Oct 2006 16:26:11 -0000	1.2
@@ -0,0 +1 @@
+MegaMek-v0.30.11.zip


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/MegaMek/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	17 Oct 2006 16:17:50 -0000	1.1
+++ sources	17 Oct 2006 16:26:11 -0000	1.2
@@ -0,0 +1 @@
+9559f6d138f0b0854991a83cdba79b59  MegaMek-v0.30.11.zip




More information about the fedora-extras-commits mailing list