GothenburgBitFactory / timewarrior

Timewarrior - Commandline Time Tracking and Reporting
https://timewarrior.net
MIT License
1.25k stars 94 forks source link

Configurability of CMake install directories #553

Closed aMOPel closed 1 year ago

aMOPel commented 1 year ago

TIMEW_MAN1DIR share/man/man1 TIMEW_MAN5DIR share/man/man5 TIMEW_MAN7DIR share/man/man7

I tried to install when specifying the above variables but they did not affect the destination directory of the man files.

Instead setting TIMEW_MANDIR would change the destination directory.

This is supported by the code.

TIMEW_MAN{1,5,7}DIR have no further references in the code, while TIMEW_MANDIR is used in /doc/man{1,7}/CMakeLists.txt.

Thank you for your work.

lauft commented 1 year ago

TIMEW_MAN{1,5,7}DIR seem to be referenced in the top level CMakeList.txt... 🤔

To dig deeper into this, please provide a bit more information:

aMOPel commented 1 year ago

TIMEW_MAN{1,5,7}DIR seem to be referenced in the top level CMakeList.txt... thinking

Sorry. I was imprecise.

I know there are references to TIMEW_MAN{1,5,7}DIR, but they don't seem to do anything. And there are more references to TIMEW_MANDIR.

$ rg TIMEW_MAN1DIR
INSTALL
68:    TIMEW_MAN1DIR          share/man/man1
77:    CMAKE_INSTALL_PREFIX/TIMEW_MAN1DIR  /usr/local/share/man/man1

CMakeLists.txt
36:SET (TIMEW_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1")
41:SET (TIMEW_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1")
$ rg TIMEW_MANDIR
CMakeLists.txt
35:SET (TIMEW_MANDIR  man      CACHE STRING "Installation directory for man pages")
40:SET (TIMEW_MANDIR  share/man      CACHE STRING "Installation directory for man pages")

doc/man7/CMakeLists.txt
20:         DESTINATION ${TIMEW_MANDIR}

doc/man1/CMakeLists.txt
20:         DESTINATION ${TIMEW_MANDIR}

I don't know cmake, so I can only assume that the references with CACHE STRING don't impact the destination of the man files, while the references with DESTINATION do.

Anyway. If I build and install with

git submodule update --init 
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DTIMEW_BINDIR=bin -DTIMEW_DOCDIR=doc/timew -DTIMEW_MAN1DIR=man/man1 -DTIMEW_MAN5DIR=man/man5 -DTIMEW_MAN7DIR=man/man7 . 
make
make install

The man files end up in $PREFIX/share/man/man{1,7} (there are no man5 pages), which is the default location.

And if I build and install with

git submodule update --init 
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DTIMEW_BINDIR=bin -DTIMEW_DOCDIR=doc/timew -DTIMEW_MANDIR=man . 
make
make install

The man files end up in $PREFIX/man/man{1,7} as intended.

Which system are you running

ubuntu 22.04

Which version of Timewarrior did you try to install?

cloned the repo and checked out release tag 1.5.0 https://github.com/GothenburgBitFactory/timewarrior/commit/3acf704195044fd6411e7a99f600e50783b2b41f

lauft commented 1 year ago

@aMOPel Thank you for your insights. There was indeed a bit more askew with the installation directories.

With the fix in 5910e83 ff the directories for the different man sections are now configurable, as well as the bin directory. I also flattened the doc directory a bit, removing the double 'doc' folder within.