glest / glest-source

Glest is a network multi-player cross-platform 3D real-time strategy (RTS) game, where you create armies of units and battle different factions.
https://glest.io
GNU General Public License v3.0
56 stars 39 forks source link

make a Debian package #210

Open andy5995 opened 5 years ago

andy5995 commented 5 years ago

make a .deb ZetaGlest package

linux-player9 commented 5 years ago

How can I make a debian package of ZetaGlest from source with make or cmake ?

andy5995 commented 5 years ago

You can do it this way, but I haven't reviewed the cmakelists.txt files so I don't know if the *.deb package will contain everything required.

From the zetaglest-source/ top directory

mkdir build cd build cmake .. make package

You can speed up the build by using make -j? where ? is the number of cpu cores your PC has, plus 1. So if you have 4 cores, then make -j5 package.

linux-player9 commented 5 years ago

Ok thanks, I will try. Where should I place the zetaglest-data folder ? Or how can I tell the compiler where zetaglest should search the data ?

andy5995 commented 5 years ago

that's a bit broken right now. I made some changes a while back, and now I don't know how to fix them without breaking the Windows build. The ticket for that is #110 and we won't actually be able to do a release without that fixed.

But when that is fixed, the way to specify where to search for the data is passing an option when cmake is run. You can see available options by using

zetaglest-source/build$ cmake -LH ..

You'll see this option: ZETAGLEST_DATA_INSTALL_PATH:STRING=share/zetaglest/

So to specify where the zetaglest binary will look for data at runtime, you'd use

ZETAGLEST_DATA_INSTALL_PATH=/usr/share/zetaglest

some distros might prefer a different path for data, but on Debian that's the path to use if you want to specify an installation for all users.

To install without root privileges, one could do something like

ZETAGLEST_DATA_INSTALL_PATH=$HOME/local/data

and use this to install the binary package

ZETAGLEST_BIN_INSTALL_PATH=$HOME/local/bin

So after those options are passed to cmake and make is run, make install would install things to those directories.

The best way to create a Debian package (or for any distro), you use install paths like that, but when you run make install, you use DESTDIR

https://cmake.org/cmake/help/latest/envvar/DESTDIR.html

That will still build the program with the paths you specify, but it will put everything into a temp directory. Once that's done, you compress the package using dpkg (or rpm packaging tool) to make it into a distro-specific package.

What should happen when ZETAGLEST_DATA_INSTALL_PATH=/usr/share/zetaglest is used is that the path specified gets "hard-coded" in the ZG source during compilation, so when it is run, it will look for data in that directory. Unfortunately a patch I did a while back broke that because now it looks for these 7 files in the paths I specified here

https://github.com/ZetaGlest/zetaglest-source/blob/2a97657e54d9c89639d66bcb17eee47e075e0f63/mk/linux/glest.ini#L104

andy5995 commented 5 years ago

ok, I commited some changes.

From the top zetaglest-source directory:

for the data path, Instead of specifying the path to the data, I used an empty directory.

After the installed, I cd'ed to that directory then used, which created symlinks to my existing data.

~/local/data/zetaglest$ ln -s ~/src/ZetaGlest/zetaglest-data/* .

There will still be some kinks to work out. For instance, I didn't test yet as root, or by specifying no paths at all.

As I work on this more, I'll create some formal documentation.

andy5995 commented 5 years ago

While it will be easy to make a Debian package, getting it into the Debian repo anytime soon is not likely, as far as I know. According to the Debian guidelines, one must be a member of the Debian team to submit a package. We can, however, offer the debian package as a download.