-
Notifications
You must be signed in to change notification settings - Fork 175
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
Fix:cmake:Fix the way we set the LIB_DIR when LIBDIR is set #574
Conversation
OK, I'll check if this still works. But would you mind redoing the patch without the indention fix? It's impossible to find what you actually changed. Or at least do one commit fixing only the indention, and then another doing the change. That's one of the consequences i pointed to in #569 |
CMakeLists.txt
Outdated
MESSAGE(STATUS " LIB_DIR (highest subdirectory if LIBDIR) is set to '${LIB_DIR}'") | ||
ENDIF (CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
ELSE (NOT LIBDIR) | ||
SET (LIB_DIR ${LIBDIR}/navit CACHE PATH "Navit lib path") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traditionally I would not and never want navit to add any sub directory if specifying LIBDIR maually. So if you want it to be "lib/navit" then one should set it to "lib/navit" and not just "lib". Otherwise it could never be "lib/something". If one wants the libraries reside just in "/lib" that's the way to do it.
It's fine for the default to be "lib/navit". So I think it was OK as it was before.
But now I'm confused. Why strippes the cmake script all starting folder names from LIB_DIR if LIBDIR is set? So When do i use LIBDIR and when LIB_DIR?
Sailfish build sets LIB_DIR directly and doesn't care for LIBDIR. And that (still) results in a working binary.
You can try yourself too if you want, by just getting the cmake command out of sailfish's spec file. There's nothing sailfish specific in setting odd paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LIBDIR is the standard GNU and cmake variable that tells the root of the directory where ALL the libs should be (in a subfolder per package usually). See the link I put in the original description.
LIB_DIR is where Navit itself should have its library, so it is supposed to be $LIBDIR/navit
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added navit directory is exactly my problem. On sailfish this would not be allowed. That's why I don't like adding a hard coded path here. If anything is manually provided we should just use that.
Whithout overriding LIB_DIR directly it's impossible to get rid of it. That's why I added the possibility to override LIB_DIR directly then. And used just that for Sailfish in the end (before I decided not to use modules at all)
With your change now, it's impossible again to put the .so files directly into /usr/lib because it always adds "navit" with no way to overome that. This way we would need another var to make it:
LIB_DIR = ${LIBDIR}/${LIB_ADD_DIR}
And then get rid of the hardcoded "navit" directories in the "LIBDIR not set" block above as well.
So:
Step 1: determine LIBDIR if not set
Step 2: make LIB_DIR equal to LIBDIR/LIB_ADD_DIR
Then for Sailfish I could use LIBDIR=share/ LIB_ADD_DIR="harbour-navit/lib/" to get the requested share/harbour-navit/lib. With -DCMAKE_INSTALL_PREFIX:PATH=/usr this makes the silly but required path /usr/share/harbour-navit/lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the fact that you added LIB_DIR
is awesome, don't get me wrong and I think it's a perfectly correct use-case and we should keep it like this.
This change is more about the distros that use the GNU standards, to get the retro-compatibility with existing build systems.
The reason LIBDIR is overwritten in Debian is that we store the libs in lib
even for 64bits versions.
If we go with a LIBDIR_SUFFIX
or LIB_ADD_DIR
I think we should probably set it to PACKAGE_NAME
by default and then be able to overwrite it.
But that would cause an issue if a distro decides to install all the library inside lib
as the LIB_ADD_DIR
variable would need to stay unset.
So I think the best way to do it is what you did with allowing the overwrite of LIB_DIR
and leave the old default (which added the navit path) like this PR does.
I just saw your comment about the indentation stuff, sorry for that. If I split the commit now I'm afraid we'll loose the current discussion thread that we have so let me summarize it outside of the code review comment and I'll do the split right after.
I think also that we should change the hardcoded |
Commit split. |
…ard compatibility
Rebased from trunk and removed the un-necessary re-formatting now that trunk has them. |
Previously we were able to set
LIBDIR
to standard values likelib
and the/navit
folder would be added to it later on.With #215 there have been some enhancements in the handling of
LIB_DIR
whenLIBDIR
is not set by settingLIB_DIR
directly tolib/navit
orlib64/navit
. The problem is when you do setLIBDIR
, then just the last folder of the provided path is taken as it was before. This causes 2 issues:/navit
is never added to it so you end up adding your libs tolib
orlib64
directlySo I propose we don't change the
LIBDIR
provided and setLIB_DIR
to${LIBDIR}/navit
ifLIBDIR
is provided but notLIB_DIR
(with that change we'll be able to have the same behavior as before #215).@metalstrolch could you test that this behavior would do fine on Sailfish OS please?
Note: the file had a bunch of mixed spaces and tabs so I used vim to reindent everything to tabs.
Thanks
Joseph