How to handle the install location (prefix)?

Cesare Tirabassi norsetto at alice.it
Mon Sep 3 11:07:53 BST 2007


Alexander Gitter wrote:
> Hi,
>
> I'm currently creating a package for a game called "sfz" with the
> following directory layout in mind:
>
> - /usr/bin for the executable
> - /usr/share/sfz for the data files
>
> Is it a good idea to define a prefix-macro in the source code and use
> that whereever the game tries to access some of its data?
>
> Something like
>
> --------
> #define DATA_PREFIX "/usr/share/sfz/"
> open_file(DATA_PREFIX, "subdir/button.png");
> --------
>
> (Note that DATA_PREFIX wouldn't really be hardcoded but rather be a
> compiletime/configure option like --prefix=... )
>
>
> Or is there a better way for doing these things?
>
> Another problem that just occured to me - the game needs to
> create/write files in its data directory - think configuration,
> savegames, downloadable plugins. This is a problem, since the
> permissions in /usr/share are 755 root:root and therefore the user is
> not able to create files.
>
> How do other packages handle those issues? I'd really appreciate some
> hints on this!
>   
 From my limited experience, your approach to configure access to data 
seems sound, but for saving files, configuration, etc. I would use the 
user's /home directory (consider dotdirs for this), and for the game 
binary I would use /usr/games.

For plugins I think you have two options:

1) you handle the download and installation through your executable
2) you let the packaging system handle it for you (either entirely or 
partially)

 From a packager's point of view the latter is preferred, so that the 
system configuration can be handled properly.

The Debian Policy addresses Games specific issues in chapter 11.11 and 
FHS related issues in chapters 9 to 11.

Cesare



More information about the Ubuntu-motu-mentors mailing list