Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: make install DESTDIR="something" ignores GLOBAL_DIR option #8204

Closed
Nik-mmzd opened this issue Jun 7, 2020 · 8 comments
Closed

cmake: make install DESTDIR="something" ignores GLOBAL_DIR option #8204

Nik-mmzd opened this issue Jun 7, 2020 · 8 comments

Comments

@Nik-mmzd
Copy link

@Nik-mmzd Nik-mmzd commented Jun 7, 2020

Version of OpenTTD

Git commit 90e8491

Expected result

OpenTTD files being installed to selected GLOBAL_DIR

Actual result

OpenTTD files being installed to DEFAULT_GLOBAL_DIR

Steps to reproduce

cmake -DGLOBAL_DIR="/custom/global/dir" path/to/sources && make && make install (in my case, make install DESTDIR="path/to/install")

Maybe I did something wrong?

System: Arch Linux, cmake 3.17.2

PS can't find an option like old --binary-name; and does it still create a .desktop file at install step?
PPS Options list in COMPILING.md for cmake newbies like me maybe?

@glx22
Copy link
Contributor

@glx22 glx22 commented Jun 8, 2020

Based on https://cmake.org/cmake/help/v3.17/envvar/DESTDIR.html and https://cmake.org/cmake/help/v3.17/variable/CMAKE_INSTALL_PREFIX.html, I guess, with your steps, openttd is installed in "path/to/install/usr/local"
I think the right way to set a custom install dir is to invoke cmake with -DCMAKE_INSTALL_PREFIX="path/to/install"

And I think there's indeed an issue with DEFAULT_GLOBAL_DIR, it doesn't respect OPTION_INSTALL_FHS

@Nik-mmzd
Copy link
Author

@Nik-mmzd Nik-mmzd commented Jun 9, 2020

I guess, with your steps, openttd is installed in "path/to/install/usr/local

And this is what I'm trying to do. My problem is "I can't rename openttd GLOBAL_DIR to make it not collide with release version to have both compiled-from-git and release versions at same time"

@glx22 can you investigate this problem? I need this to be solved to be able to update AUR openttd-git package
So I need to set GLOBAL_DIR to something like ${CMAKE_INSTALL_PREFIX}/share/openttd-git (to avoid conflicts with openttd package)

@glx22
Copy link
Contributor

@glx22 glx22 commented Jun 11, 2020

GLOBAL_DIR is not used for install, it's only a define for openttd executable.
I think what you need is a way to configure XXX_DESTINATION_DIR in

if (OPTION_INSTALL_FHS)
set(BINARY_DESTINATION_DIR "bin")
set(DATA_DESTINATION_DIR "share/games/openttd")
set(DOCS_DESTINATION_DIR "share/doc/openttd")
set(MAN_DESTINATION_DIR "share/man/openttd")
else (OPTION_INSTALL_FHS)
set(BINARY_DESTINATION_DIR ".")
set(DATA_DESTINATION_DIR ".")
set(DOCS_DESTINATION_DIR ".")
set(MAN_DESTINATION_DIR ".")
endif (OPTION_INSTALL_FHS)

@Nik-mmzd
Copy link
Author

@Nik-mmzd Nik-mmzd commented Jun 11, 2020

GLOBAL_DIR is not used for install, it's only a define for openttd executable.

So, as far as I understand, if I will compile OpenTTD with -DGLOBAL_DIR="/games/openttd" and will install it (to /usr/local/games/openttd, because of defaults) OpenTTD will not be able to find it's own files? Seems like a bug

I think what you need is a way to configure XXX_DESTINATION_DIR

Yes, it'll be useful. Maybe, unify some variables like GLOBAL_DIR (make it dependent on DATA_DESTINATION_DIR)
Also, seems to be missing an option to rename man page, etc...

In some words: reimplement configurable binary-name, data-dir, doc-dir from old build script

@glx22
Copy link
Contributor

@glx22 glx22 commented Jun 12, 2020

GLOBAL_DIR must be a full path, not a relative. Anyway I'll check how to use cmake GNUInstallDirs module.

@Nik-mmzd
Copy link
Author

@Nik-mmzd Nik-mmzd commented Jun 12, 2020

GLOBAL_DIR="${CMAKE_INSTALL_PREFIX}${DATA_DESTINATION_DIR}" maybe? Or smth like it

@glx22
Copy link
Contributor

@glx22 glx22 commented Jun 12, 2020

Please test #8218, it may not be complete but should improve things.

@Nik-mmzd
Copy link
Author

@Nik-mmzd Nik-mmzd commented Jun 13, 2020

@glx22 Seems to be working, except one thing: man page name is always "openttd"

@glx22 glx22 closed this in #8218 Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.