glest/glest-source

make a Debian package

Opened this issue · 6 comments

make a .deb ZetaGlest package

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

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.

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 ?

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

ok, I commited some changes.

From the top zetaglest-source directory:

  • mkdir build
  • cd build
  • cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/local -DZETAGLEST_DATA_INSTALL_PATH=$HOME/local/data/zetaglest
  • make
  • make install

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.

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.