Score:1

dpkg-buildpackage: install to /usr/games instead of /usr bin

cn flag

I'm building my first Debian package for a small game project, and it builds fine from the C sources, but the compiled executable gets installed in /usr/bin. How can I get it installed in /usr/games instead?

I've tried adding it to debian/install like so:

obj-x86_64-linux-gnu/mygame usr/games

but that only works when building a package for x86_64, because on other architectures, the build directory is obviously going have a different name.

Score:2
zw flag

You can try to learn by small example like https://packages.ubuntu.com/source/hirsute/xball .

This xball package has the following in debian/rules:

override_dh_auto_configure:
    dh_auto_configure -- \
        --prefix=/usr \
        --bindir=/usr/games \
        --datadir=/usr/share/games/xball

in the above --bindir=/usr/games will do what you want.

You can do the same for your code.


Update based on comment from OP. For cmake based build:

I ended up looking at blockattack, which does this:

override_dh_auto_configure: 
  dh_auto_configure -- \
      -DCMAKE_BUILD_TYPE=Release \ -DINSTALL_BIN_DIR=/usr/games \
      -DINSTALL_DATA_DIR=share/games/blockattack
cn flag
This seemed good, but didn't work. Could it be because my project is built with cmake, not autotools?
N0rbert avatar
zw flag
I do not really know, all Ubuntu repository is available as examples for you. Try to find cmake-built package to use it as prototype.
cn flag
For cmake, I ended up looking at blockattack, which does this: override_dh_auto_configure: dh_auto_configure -- \ -DCMAKE_BUILD_TYPE=Release \ -DINSTALL_BIN_DIR=/usr/games \ -DINSTALL_DATA_DIR=share/games/blockattack Thanks for your help!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.