Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm writing a cross platform game at the moment, and I'm wondering what folders I should put everything in. For windows it's fine because everything all just goes in the same folder. But for linux there's /bin and /usr/bin and /usr/share and all these other folders that I don't know what to do with. So I'm wondering what a standard way of laying out game files is (binaries, shared libraries, resources, maps, textures etc).
Could just chuck everything in the same directory as with Windows and leave it up to the packagers to put stuff in it's correct spot. This is how it's done with Nexuiz, Warsow, Tremulous, Sauerbraten, the list goes on...
It wouldn't be seen as you being slack, lots of people do it for sake of convenience. That way a distro can choose to have it in /usr/share or /opt
well it's more for loading resources. If I want to load an image I might do something like:
LoadImage("res/sdk/toolbar.tga");
and that would mean the executable needs to be in the base folder.
So I could do something like have an ini file that points to all the folder paths, but even then I'd still need to know what to put in the ini.
Well I can't tell you the "best" way to do it but I can tell you that there are plenty of games being distributed that require the executable to be run from the base directory. This works as it's not hard to drop a shell script into /usr/bin that cd's to the correct location and runs the executable. Another option could be to let people pass the basedir to the executable as an option, eg.
The one linux game that I have is Civilization. It installs a directory /usr/local/games/CivCTP. This directory the binary and data directories needed to run. The setup program asks where you want to create the symbolic link to the binary. The options are the common directories that would be in someones path; /usr/bin/ and /usr/local/bin are the most logical.
According to the Filesystem Hierarchy Standard, the proper location would be /usr/local/bin/, however this location may not be in everyones path variable. Everyone has /usr/bin/ in their PATH so offering to create a link their would be wanted.
If you have libraries of your own, you could have a lib directory in your partition and the install program (or package system) could add the location to your library location in /etc/ld.so.conf and then run "ldconfig".
A distro's package system will usually use /usr/ as it's base directory. The /usr/local/ hierarchy is for programs that a user installs, such as from a tarball installation.
You might also check out documentation for Linux Standard Base for recommendations.
On my system at least, /usr/local/lib is in my /etc/ld.so.conf. I have /usr/local/lib64 as well because I have an Amd64 in my laptop. Your install script might grep for '/usr/local/lib' in /etc/ld.so.conf and add it to the end and run "ldconfig" if it isn't found.
grep '/usr/local/lib$' || echo '/usr/local/lib/' >> /etc/ldconfig ; ldconfig
would do it.
The '/usr/local/lib' path entry will most likely exist.
so does ldconfig just put whatever is in /etc/ld.so.conf in the library search path, so whenever you start up a program that needs one of those libraries it searches all those paths?
ldconfig takes the library locations found in ld.so.conf, and examines the headers of the libraries in those locations. From that information it may make changes to ld.so.cache which contains links to the libraries. The ld.so.cache is used by the loader when it needs to load a library.
Weighing out of this thread but again, dump it all in one directory and let the packager worry about it. Different distros do things differently and you can't cover them all.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.