The International Simutrans Forum

Development => Technical Documentation => Topic started by: Mailaender on December 28, 2012, 05:23:13 PM

Title: RPM packages for openSUSE
Post by: Mailaender on December 28, 2012, 05:23:13 PM
I have been working on http://software.opensuse.org/package/simutrans The latest version 112.1 now has a proper compiled package (also for x64). It is located in my home directory and soon to be pushed into games. Can't announce this in the appropriate forums as they seem to be admin-only posting areas.

Also I could not solve FHS compatibility on my own. The current package uses a crude workaround. It extracts everything to /usr/lib and symlinks the whole directory to ~/.simutrans. Don't even understand why they did this. What I want is:


What is the easiest way to achieve this? I had no success setting a path with --use_workdir and --objects=. It still expects assets to be in the same folder as the sim binary.

Another problem for packaging is that you have your documentation scattered on many different homepages. I currently packaged pak128 and pak64. Not sure if the other packages are compatible with version 112.1? Is the source code also licensed under the artistic license (which is quite unusual) or is this just for game files?
Title: Re: RPM packages for openSUSE
Post by: Ters on December 28, 2012, 06:01:25 PM
I think putting everything in /usr/share/simutrans and a wrapper script in /usr/bin that sets working directory to former and runs the game there should work.

~/simutrans is a separate directory for user-specific stuff, like save games, add-ons and settings. (Having this directory with a leading period is being discussed at the moment.)
Title: Re: RPM packages for openSUSE
Post by: Vonjo on December 28, 2012, 07:22:56 PM
Quote from: Mailaender on December 28, 2012, 05:23:13 PM
What I want is:

  • The binary or a shell script to start the game in /usr/bin. Having a binary in /usr/lib (also called libexecdir) is fine, too.
  • Game files (paks), fonts, configuration, music, skins, text loaded from /usr/share/simutrans.
You can use debian patches:

--- simutrans.orig/simmain.cc
+++ simutrans/simmain.cc
@@ -446,8 +446,9 @@
       strcat( umgebung_t::program_dir, path_sep );
    }
    else {
-      strcpy( umgebung_t::program_dir, argv[0] );
-      *(strrchr( umgebung_t::program_dir, path_sep[0] )+1) = 0;
+      // strcpy( umgebung_t::program_dir, argv[0] );
+      // *(strrchr( umgebung_t::program_dir, path_sep[0] )+1) = 0;
+      strcpy(umgebung_t::program_dir, "/usr/share/games/simutrans/");

       chdir( umgebung_t::program_dir );
    }

and if you want simutrans folder in home directory to be hidden:

--- simutrans.orig/simsys.cc
+++ simutrans/simsys.cc
@@ -39,7 +39,7 @@
#elif defined __APPLE__
    sprintf(buffer, "%s/Library/Simutrans", getenv("HOME"));
#else
-   sprintf(buffer, "%s/simutrans", getenv("HOME"));
+   sprintf(buffer, "%s/.simutrans", getenv("HOME"));
#endif

    dr_mkdir(buffer);


:)
Title: Re: RPM packages for openSUSE
Post by: Ters on December 28, 2012, 07:36:00 PM
The latter should wait for the outcome of http://forum.simutrans.com/index.php?topic=11173.0
Title: Re: RPM packages for openSUSE
Post by: prissi on December 28, 2012, 09:22:21 PM
Game and paks in different directories could be also achieved by the command linne:

cd /usr/share/games/simutrans/
/usr/bin/simutrans -use_workdir

will start simutrans using the persistent data from /usr/share/games/simutrans/
Title: Re: RPM packages for openSUSE
Post by: Mailaender on December 28, 2012, 09:39:05 PM
Quote from: prissi on December 28, 2012, 09:22:21 PM
Game and paks in different directories could be also achieved by the command linne:

cd /usr/share/games/simutrans/
/usr/bin/simutrans -use_workdir

will start simutrans using the persistent data from /usr/share/games/simutrans/

Aah, it is a boolean. Now I get it. Thanks. Will fix our bash script now knowing that.
Title: Re: RPM packages for openSUSE
Post by: Mailaender on December 28, 2012, 11:07:36 PM
Quote from: Mailaender on December 28, 2012, 05:23:13 PM
Is the source code also licensed under the artistic license (which is quite unusual) or is this just for game files?

Need to answer this myself. Just read the Artistic License. It is suitable for software and now I understand the brash "non-commercial" claim in the about text. I was worried that this is some kind of non-OSI Freeware license. All fine now.
Title: Re: RPM packages for openSUSE
Post by: Ters on December 29, 2012, 07:33:38 AM
Note that it's not any version of the Artistic License, but version 1.
Title: Re: RPM packages for openSUSE
Post by: Mailaender on December 29, 2012, 10:54:10 AM
We already fixed that when moving to http://spdx.org/licenses/