Serebriakov / pink-pony

Automatically exported from code.google.com/p/pink-pony
0 stars 0 forks source link

Patch to better integrate for system-wide installation #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Presently, pink-pony assumes it's running out of it's own directory, and
that's not always the case.  I've started maintaining a gentoo ebuild in my
overlay (http://micolous.id.au/projects/gentoo-overlay/) which contains a
patch to make it install nicer, putting all the datafiles in
/usr/share/games/pink-pony and the configuration in /etc/pink-pony.options.

While it's not perfect yet (the game's "home" directory should probably be
a config option, some config options are ignored such as the textures for
PonyPoints, and it doesn't allow for per-user pink-pony configuration (or
"overlaying" configurations)), it's a step forward towards making
everything harmonious.

I've attached a patch with my changes against 1.2.1 to make it install
properly.  Presently, most paths are changed by the define PONY_HOME in
lib/cinque.hh.  By changing this to "./" (or "data/"), you can make it
revert to the old behaviour of checking for datafiles in the present
working directory (eg: for windows).

Original issue reported on code.google.com by micol...@gmail.com on 28 Aug 2009 at 5:00

Attachments:

GoogleCodeExporter commented 9 years ago
Hello micolous,

I think I already found a relatively good solution to this problem.
The tarball already provides information on how to install the game as a 
distribution
package. Please take a look at the INSTALL file and the stuff in the install/ 
folder.

The idea is to use a shell script that changes into the resource directory and 
starts
the binary with ~/.config/pony.options as config file. If there is no such 
config
file, it creates a copy from the resource folder automatically.

The main advantage of this aproach is that every user can have his/her local 
config
file that can be changed without root privileges. This is crucial for the 
settings
screen to work.

Take a look at the attached file listing for this arch linux PKGBUILD:
http://aur.archlinux.org/packages.php?ID=28350 
/usr/bin/pink-pony is the shell-script. The real binary is 
/usr/share/pink-pony/Pony.

What do you think about this solution? 

Original comment by gin...@gmail.com on 28 Aug 2009 at 8:23

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Ginquo,

I went for my solution mainly because it was what every other game on Gentoo 
does,
with the exception of non-free games (which generally can't be modified to play
nicely in this fashion, and require similar shell-script hacks).

According to the Filesystem Hierarchy Standard, /usr/share should only contain
architecture-independent data (ie: no binaries).  I've seen other software use
/usr/lib for holding programs that don't like to play nice.

I do agree though that the lack of settings saving abilities in the version 
created
by my patch is a bad thing though, and that is something that needs to be 
addressed
properly.

I think one other solution to integrating with Linux could be that it has a 
fixed set
of paths to search for the configuration file in (eg: /etc/pink-pony, 
~/.pink-pony/)
if no configuration file is specified, and having the "PONY_HOME" set as a 
variable
in that file.  So that if a relative file path is entered for a texture or other
data, it looks relative to PONY_HOME, and if an absolute path is entered, then 
it
looks for that absolute file.  This should also mean that all file paths that 
are
presently hard coded must also go into that configuration file.

It would also allow for a user to install a "total conversion mod" of pink-pony 
for
themselves without effecting other users, should such a day come when they 
exist.  8)

--michael

Original comment by micol...@gmail.com on 31 Aug 2009 at 12:14

GoogleCodeExporter commented 9 years ago
If /usr/share may not contain binary files, then /usr/lib would probably be a 
good
place to put the executable.
The FreeBSD port of pink-pony ( http://www.freshports.org/games/pink-pony/ ) 
put the
executable in /usr/libexec. This directory doesn't seem to be common in linux
distros, though.

The *nice* way to do it would probably be to make the working dir configurable 
in the
config file and move there with chdir() in the main function. This would still 
not
solve the problem of finding and creating the config file at the correct place. 
There
is also the problem that chdir is not portable..

To be honest, I don't really see the problem with the current setup. 
Shell-Script
wrappers in /usr/bin are very common. (Just test "grep -lm 1 "#\! /bin/sh"
/usr/bin/*" on your distro. I'm sure you will find quite a lot of scripts.)
It's also by far the easiest, most portable and least intrusive way to install 
the
game as a distribution package.
The "every other game does that" argument is a bit weak. Putting the config 
into /etc
is definately not a user friendly solution.

Original comment by gin...@gmail.com on 1 Sep 2009 at 4:11

GoogleCodeExporter commented 9 years ago
I'm not at all suggesting that the *only* configuration should be in /etc, I'm 
just
saying that *a* configuration, the system-wide one, should be (just like every 
other
application, game or not).

chdir seems only to be not portable to Windows, where it is _chdir instead. 
Microsoft claim[1] this is ISO C++ compliant, unlike chdir.  I can't find 
anything in
my /usr/include about it outside of WINE and other compatibility headers.

I think to be able to handle the different operating systems' HOMEs properly, 
it is
going to require a check function that is platform specific anyway, at least 
for UNIX
vs. Windows Vista and earlier vs. Windows 7 (as there is a new
FOLDERTYPEID_SavedGames[2] for storing saved games).

[1]: <http://msdn.microsoft.com/en-us/library/ms235420%28VS.80%29.aspx>
[2]: <http://msdn.microsoft.com/en-au/library/bb762581%28VS.85%29.aspx>

Original comment by micol...@gmail.com on 2 Sep 2009 at 1:25

GoogleCodeExporter commented 9 years ago
If you want the master config file in /etc/, this can easily be done by editing 
the
shell-script.

The script would then look something like this:

#!/bin/sh

cd /usr/share/pink-pony

if [ $# -ge 1 ]; then
    /usr/lib/Pony $1
else
    if [ ! -f ~/.config/pony.options ]; then
    mkdir -p ~/.config/
    cp /etc/pony.options ~/.config/pony.options
    fi

    /usr/lib/Pony ~/.config/pony.options
fi

This creates new config files from the master in /etc and calls the binary in
/usr/lib. No patches needed.

Original comment by gin...@gmail.com on 4 Sep 2009 at 2:29

Attachments:

GoogleCodeExporter commented 9 years ago
Okay, I'm closing this issue now.

I guess this wasn't what you wanted, but making all the paths 
global/configurable
would have been too much work for too little benefit.

Sorry.

Original comment by gin...@gmail.com on 21 Sep 2009 at 9:07