some CMake variables(?) doubts from a future Ryzom packager [SOLVED]

Added by shackra about 3 years ago

Hello!!
I'm the guy how usually reports bugs for Parabola GNU/Linux-libre (and therefore, for ArchLinux too) and I want to package the game for the distro and I have some doubts regarding CMake's options.

Well, basically is regarding -DCMAKE_INSTALL_PREFIX variable, in my last build I set it to /usr for the Ryzom client build. The surprise was I saw some files and directories under /usr which should be under / (root directory) like "etc", for instances which is installed under /usr rather than on /. There is a way to change installation path depending of the directory (I can't remember, but there is one way using something like -DCMAKE_INSTALL_PREFIX, but dunno, I need help on this).

My another doubt is about the CMakeOptios from http://dev.ryzom.com/projects/ryzom/wiki/CMakeOptions, I'm not sure, but, I think some CMakeOptions will build some packages twice, for example,

-DWITH_NEL_TESTS=OFF -DWITH_LUA51=ON -DWITH_STATIC=ON -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_CLIENT=ON
will build just the Ryzom client and implicitly nel. Should I worry about others implicitly builds for Ryzom Server and Ryzom Tools what I already did during, i.e.: Ryzom Client build? and if in case two options will build implicitly, dunno, Nel. Would be better if I do a Nel package (for example) separately?


Replies (14)

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

Auto answering myself

jorge@Abril:~/MYAUR/ryzom/code$ cat CMakeLists.txt 
#-----------------------------------------------------------------------------
#
# NeL
#  Authors: Nevrax and the NeL Community
#  Version: 0.8.0
#
# Notes:
#   * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
#   * Changing specific install location variables:
#       * NL_ETC_PREFIX (default: $CMAKE_INSTALL_PREFIX/etc)
#       * NL_SHARE_PREFIX (default: $CMAKE_INSTALL_PREFIX/share)
#       * NL_BIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/bin)
#       * NL_SBIN_PREFIX  (default: $CMAKE_INSTALL_PREFIX/sbin)
#       * NL_LIB_PREFIX  (default: $CMAKE_INSTALL_PREFIX/lib)
#       * NL_DRIVER_PREFIX  (default: $CMAKE_INSTALL_PREFIX/lib (windows) or $CMAKE_INSTALL_PREFIX/lib/nel)
#   * Enable building of documentation: add -DBUILD_DOCUMENTATION:BOOL=ON - new make target: DoxygenDoc
#   * Updating version: update header (above) but also update NL_VERSION below.
#   * To build binary archive, use the 'package' target.
#     To build source archive, use the 'package_source' target.

cheers! :)

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by kervala about 3 years ago

There are too equivalent variables for Ryzom :

  • RYZOM_ETC_PREFIX for client_default.cfg
  • RYZOM_SHARE_PREFIX for Ryzom command line patcher translations
  • RYZOM_SBIN_PREFIX is not used
  • RYZOM_BIN_PREFIX for Ryzom tools
  • RYZOM_GAMES_PREFIX for Ryzom client

To create Ubuntu/Debian Ryzom Core packages I use :

cmake ../code -DCMAKE_INSTALL_PREFIX=/usr -DNL_ETC_PREFIX=/etc/nel -DNL_DRIVER_PREFIX=/usr/lib/nel -DRYZOM_ETC_PREFIX=/etc/ryzom -DRYZOM_SHARE_PREFIX=/usr/share/games/ryzom -DRYZOM_BIN_PREFIX=/usr/games -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_LIBWWW_STATIC=ON

If you want to package NeL and Ryzom separately, you shouldn't use -DWITH_STATIC=ON because under Linux all libraries are shared by default. Ryzom servers, Ryzom tools, Ryzom client with use the same NeL libraries and if you compile them in static your binaries will be bigger than in dynamic.

To create an unique Ryzom client package without shared libraries, I use :

cmake ../code -DCMAKE_INSTALL_PREFIX=/usr -DRYZOM_ETC_PREFIX=/opt/ryzom -DRYZOM_SHARE_PREFIX=/opt/ryzom -DRYZOM_BIN_PREFIX=/opt/ryzom -DRYZOM_GAMES_PREFIX=/opt/ryzom -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_LIBWWW_STATIC=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_INSTALL_LIBRARIES=OFF

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

kervala wrote:

There are too equivalent variables for Ryzom :

  • RYZOM_ETC_PREFIX for client_default.cfg
  • RYZOM_SHARE_PREFIX for Ryzom command line patcher translations
  • RYZOM_SBIN_PREFIX is not used
  • RYZOM_BIN_PREFIX for Ryzom tools
  • RYZOM_GAMES_PREFIX for Ryzom client

To create Ubuntu/Debian Ryzom Core packages I use :

cmake ../code -DNL_ETC_PREFIX=/etc/nel -DNL_DRIVER_PREFIX=/usr/lib/nel -DRYZOM_ETC_PREFIX=/etc/ryzom -DRYZOM_SHARE_PREFIX=/usr/share/games/ryzom -DRYZOM_BIN_PREFIX=/usr/games -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_LIBWWW_STATIC=ON

If you want to package NeL and Ryzom separately, you shouldn't use -DWITH_STATIC=ON because under Linux all libraries are shared by default. Ryzom servers, Ryzom tools, Ryzom client with use the same NeL libraries and if you compile them in static your binaries will be bigger than in dynamic.

To create an unique Ryzom client package without shared libraries, I use :

cmake ../code -DRYZOM_ETC_PREFIX=/opt/ryzom -DRYZOM_SHARE_PREFIX=/opt/ryzom -DRYZOM_BIN_PREFIX=/opt/ryzom -DRYZOM_GAMES_PREFIX=/opt/ryzom -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_LIBWWW_STATIC=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_INSTALL_LIBRARIES=OFF

Well, I got a problem regarding to the NL*_PREFIX (and RYZOM_*_PREFIX too)variables and it is driving me crazy, this is what I see on CMakeCache.txt:

NL_BIN_PREFIX:PATH=//bin
NL_LIB_PREFIX:PATH=//lib
NL_SBIN_PREFIX:PATH=//sbin
NL_SHARE_PREFIX:PATH=//share/nel
[...]
RYZOM_GAMES_PREFIX:PATH=//games
RYZOM_PREFIX:PATH=/
RYZOM_SBIN_PREFIX:PATH=//sbin

I used this command and options cmake -DWITH_RYZOM=OFF -DWITH_NEL_TESTS=OFF -DWITH_NEL=ON -DCMAKE_INSTALL_PREFIX="/" -DNL_ETC_PREFIX=/etc/nel -DNL_DRIVER_PREFIX=/usr/lib/nel -DRYZOM_ETC_PREFIX=/etc/ryzom -DRYZOM_SHARE_PREFIX=/usr/share/ryzom -DRYZOM_BIN_PREFIX=/usr/bin ..

A dirty hack was use sed before make -j3. But I dont like that :(

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by kervala about 3 years ago

Why don't you use -DCMAKE_INSTALL_PREFIX=/usr ?

Edit: I just noticed I forgot to add this to my cmake commands, that's because debhelper automatically set it :) Sorry !

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

kervala wrote:

Why don't you use -DCMAKE_INSTALL_PREFIX=/usr ?

Edit: I just noticed I forgot to add this to my cmake commands, that's because debhelper automatically set it :) Sorry !

glolfail... Ok, I'll take a closer look to CMakeCache.txt and change what I dont like with sed command, I don't have another option... DIRTY HACKS!! :D

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by kervala about 3 years ago

shackra wrote:

kervala wrote:

Why don't you use -DCMAKE_INSTALL_PREFIX=/usr ?

Edit: I just noticed I forgot to add this to my cmake commands, that's because debhelper automatically set it :) Sorry !

glolfail... Ok, I'll take a closer look to CMakeCache.txt and change what I dont like with sed command, I don't have another option... DIRTY HACKS!! :D

Please why don't you explain your problem ?

Changing manually CMakeCache.txt is a really bad way to fix something. If you can fix what you want using CMake options on command line, you should use them, else ask and explain what you're doing, we'll be able to help you.

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

I'm setting the package script for the packaging application on Parabola.
Fist, cmake was concatenating the CMAKE_INSTALL_PREFIX with the others Cmake's PREFIX variables leading to weird installation paths (like /usr/etc/nel/ instead of /etc/nel). But I fix that setting CMAKE_INSTALL_PREFIX to empty string ("") and changing the rest of the prefixes. No dirty hacks was required :D

But, during packaging time I got an error from cmake

jorge@Abril:~/coders/PKGBUILDs/ryzom/ryzom-split$ LC_ALL=C makepkg -si
==> Determining latest hg revision...
pulling from http://ryzom.hg.sourceforge.net:8000/hgroot/ryzom/ryzom
searching for changes
no changes found
resolving manifests
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  -> Version found: 2270
==> Making package: ryzom-nel 2270-1 (Mon Jun 11 20:36:35 CST 2012)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
==> Extracting Sources...
==> Removing existing pkg/ directory...
==> Starting build()...
==> Connecting to Ryzom Mercurial server....
pulling from http://ryzom.hg.sourceforge.net:8000/hgroot/ryzom/ryzom
searching for changes
no changes found
==> The Ryzom files are updated.
==> Ryzom Mercurial checkout done or server timeout
==> Entering fakeroot environment...
==> Starting package_ryzom-nel()...
CMake Error: The source directory "/home/jorge/coders/PKGBUILDs/ryzom/ryzom-split/src/ryzom/code/ryzom-nel/ " does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
==> ERROR: A failure occurred in package_ryzom-nel().
    Aborting...
jorge@Abril:~/coders/PKGBUILDs/ryzom/ryzom-split$ 

Which is very annoying and frustrating because is like cmake were omitting the ".." stuff and searching for the code in the actual directory.
I tried changing the path to where the code is (/home/jorge/coders/PKGBUILDs/ryzom/ryzom-split/src/ryzom/code/) but the same error is shown, CMake can be really annoying...

there is the relevant part of the packaging script:

  cd "$srcdir/$_hgrepo/code/ryzom-nel" 

  cmake -Wno-dev \
        -DWITH_RYZOM=OFF \
        -DWITH_NEL_TESTS=OFF \
        -DWITH_NEL=ON \ 
        -DCMAKE_INSTALL_PREFIX="$pkgdir" \ 
        -DNL_ETC_PREFIX=/etc/nel \
        -DNL_DRIVER_PREFIX=/usr/lib/nel \ 
        -DNL_SHARE_PREFIX=/usr/share/nel \ 
        -DNL_BIN_PREFIX=/usr/bin \ 
        -DNL_SBIN_PREFIX=/usr/sbin \
        -DNL_LIB_PREFIX=/usr/lib/nel \ 
        -DNL_DRIVER_PREFIX=/usr/lib/nel
        -DRYZOM_ETC_PREFIX=/etc/ryzom \
        -DRYZOM_SHARE_PREFIX=/usr/share/ryzom \ 
        -DRYZOM_BIN_PREFIX=/usr/bin ..

any help with this, Kervala?

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by kervala about 3 years ago

As I said previously, thay's very easy !

Did you already package something for your distro ?

Under Debian/Ubuntu, the CMAKE_INSTALL_PREFIX must be the final prefix once installed (= /usr), the temporary directory where all files are copied for generating the package is managed by Debian tools because Debian tools (debhelper) supports automake, cmake, bjam, etc... so when it sees CMake it uses automatically the right directories.

In your case, if you don't have any Gentoo tool who support CMake ( as http://devmanual.gentoo.org/eclass-reference/cmake-utils.eclass/index.html ), you'll have to use :

make install DESTDIR=<absolute path to where you want to create your package>

So instead of

cd "$srcdir/$_hgrepo/code/ryzom-nel" 

  cmake -Wno-dev \
        -DWITH_RYZOM=OFF \
        -DWITH_NEL_TESTS=OFF \
        -DWITH_NEL=ON \ 
        -DCMAKE_INSTALL_PREFIX="$pkgdir" \ 
        -DNL_ETC_PREFIX=/etc/nel \
        -DNL_DRIVER_PREFIX=/usr/lib/nel \ 
        -DNL_SHARE_PREFIX=/usr/share/nel \ 
        -DNL_BIN_PREFIX=/usr/bin \ 
        -DNL_SBIN_PREFIX=/usr/sbin \
        -DNL_LIB_PREFIX=/usr/lib/nel \ 
        -DNL_DRIVER_PREFIX=/usr/lib/nel
        -DRYZOM_ETC_PREFIX=/etc/ryzom \
        -DRYZOM_SHARE_PREFIX=/usr/share/ryzom \ 
        -DRYZOM_BIN_PREFIX=/usr/bin ..

just use :

cd "$srcdir/$_hgrepo/code/ryzom-nel" 

  cmake -Wno-dev \
        -DWITH_RYZOM=OFF \
        -DWITH_NEL_TESTS=OFF \
        -DWITH_NEL=ON \ 
        -DCMAKE_INSTALL_PREFIX=/usr \ 
        -DNL_ETC_PREFIX=/etc/nel \
        -DRYZOM_ETC_PREFIX=/etc/ryzom \
        ..

  make
  make DESTDIR=/home/login/packages/ryzom

Finally I don't know Gentoo packaging, so I can't help you on this, I think your problems don't come from CMake or Ryzom Core but from Gentoo packaging and you should see with Gentoo packagers if they can help you.

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

WTF!? I'm not packaging for Gentoo! D:
I'm packaging for Parabola!! Gentoo's wiki for packaging isn't helping me at all.-

DCMAKE_INSTALL_PREFIX must be $pkgdir, this is a rule for Parabola packaging and isn't optional.
I'll consult this on IRC!

chao! :)

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by kervala about 3 years ago

Sorry, I confounded Arch and Gentoo :(

CMAKE_INSTALL_PREFIX must be set to $pkgdir or files must be installed/copied to $pkgdir ?

That's not the same thing :)

Edit: In this case, use : make DESTDIR=$pkgdir

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

kervala wrote:

Sorry, I confounded Arch and Gentoo :(

CMAKE_INSTALL_PREFIX must be set to $pkgdir or files must be installed/copied to $pkgdir ?

That's not the same thing :)

Edit: In this case, use : make DESTDIR=$pkgdir

Well, we already discuss that on IRC :).
The question is: May I have to report this as a bug? Because Blender uses cmake and it builds quite well on Parabola/Arch. You either should take a look at CMake instructions for Blender, Kervala!

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by kervala about 3 years ago

shackra wrote:

kervala wrote:

Sorry, I confounded Arch and Gentoo :(

CMAKE_INSTALL_PREFIX must be set to $pkgdir or files must be installed/copied to $pkgdir ?

That's not the same thing :)

Edit: In this case, use : make DESTDIR=$pkgdir

Well, we already discuss that on IRC :).
The question is: May I have to report this as a bug? Because Blender uses cmake and it builds quite well on Parabola/Arch. You either should take a look at CMake instructions for Blender, Kervala!

Please did you try to create a package for Blender with their script ? Perhaps will you got the same error message.

Are you sure it's a bug ? You don't even know if it's related to CMake, Ryzom or your script :)

That's not CMake that return the error message, but your script saying a directory doesn't exist.

I suspect your problem is related to the fact Ryzom Core has a "code" directory before CMakeLists.txt.

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra about 3 years ago

kervala wrote:

Please did you try to create a package for Blender with their script ? Perhaps will you got the same error message.

I dont think so, we have in Parabola Blender-libre package ( https://projects.parabolagnulinux.org/abslibre.git/tree/libre/blender-libre/PKGBUILD ) which is a Blender package without proprietary dependencies build by Emulatorman and he haven't any issue. That means, our tools and the Blender cmakes rules are ok.

Are you sure it's a bug ? You don't even know if it's related to CMake, Ryzom or your script :)

Well, CMake works with blender-libre as I explained before, the rules on my PKGBUILD looks like the ones on the blender-libre PKGBUILD, therefore the bug have to be in the Ryzom's cmake instructions. As we said in Costa Rica "_Si no es gallo, debe ser gallina_".

That's not CMake that return the error message, but your script saying a directory doesn't exist.

Indeed, well, actually is the tools for packaging which are throwing the message, and the tools runs cmake, so, cmake is the one complaining about the source directory.

I suspect your problem is related to the fact Ryzom Core has a "code" directory before CMakeLists.txt.

Dunno, I didn't write the cmake rules xD. That's why you are our only hope to distribute Ryzom for Parabola, Kervala!

RE: some CMake variables(?) doubts from a future Ryzom packager - Added by shackra almost 3 years ago

This is solved!
the problem was the "\" characters for break the cmake command, when I remove them, the problem just disappeared! :O
I have other issues to think about for now xd

(1-14/14)