Improve configurability of CMake install directories

Make installation of man pages configurable per section
Use configuration variable TIMEW_BINDIR
Update documentation

Closes #553

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2023-08-08 22:12:32 +02:00
parent be0243ba1a
commit bddb874034
9 changed files with 43 additions and 49 deletions

View file

@ -117,3 +117,4 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges
apkawel
Leon Grünewald
Ivo Forlin
aMOPel

View file

@ -32,17 +32,18 @@ set (PACKAGE_STRING "${PACKAGE} ${VERSION}")
string (TIMESTAMP PACKAGE_DATE "%Y-%m-%d")
if (FREEBSD OR DRAGONFLY)
set (TIMEW_MANDIR man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR man/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR man/man7 CACHE STRING "Installation directory for man pages, section 7")
set (TIMEW_MANDIR man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR ${TIMEW_MANDIR}/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR ${TIMEW_MANDIR}/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR ${TIMEW_MANDIR}/man7 CACHE STRING "Installation directory for man pages, section 7")
else (FREEBSD OR DRAGONFLY)
set (TIMEW_MANDIR share/man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR share/man/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR share/man/man7 CACHE STRING "Installation directory for man pages, section 7")
set (TIMEW_MANDIR share/man CACHE STRING "Installation directory for man pages")
set (TIMEW_MAN1DIR ${TIMEW_MANDIR}/man1 CACHE STRING "Installation directory for man pages, section 1")
set (TIMEW_MAN5DIR ${TIMEW_MANDIR}/man5 CACHE STRING "Installation directory for man pages, section 5")
set (TIMEW_MAN7DIR ${TIMEW_MANDIR}/man7 CACHE STRING "Installation directory for man pages, section 7")
endif (FREEBSD OR DRAGONFLY)
set (TIMEW_DOCDIR share/doc/timew CACHE STRING "Installation directory for doc files")
set (TIMEW_BINDIR bin CACHE STRING "Installation directory for Timewarrior executable")
message ("-- Configuring cmake.h")
configure_file (${CMAKE_SOURCE_DIR}/cmake.h.in

View file

@ -14,6 +14,8 @@
(thanks to Iúri Archer)
- #552 Extend XDG support to macOS
(thanks to Tadeas Uhlir)
- #553 Configurability of CMake install directories
(thanks to aMOPel)
- #554 Update documentation for command 'retag'
(thanks to quazgar)
- Use local man pages in tests

42
INSTALL
View file

@ -48,41 +48,35 @@ These commands are explained below:
# Build and configurations options
You can customize the configuration run with CMake variables.
This will modify the installation process:
To change the installation directory you use the following configuration variable:
$ cmake -DCMAKE_INSTALL_PREFIX=<path-to-installation-dir> .
CMake configuration variables are applied with the -D option and consist of a <name> and a <value>:
CMake configuration variables are applied with the `-D` option and consist of a `<name>` and a `<value>`:
$ cmake -D<name>=<value> .
To change the installation directory, use the `CMAKE_INSTALL_PREFIX` variable:
$ cmake -DCMAKE_INSTALL_PREFIX=<path-to-installation-dir> .
This variable defaults to `/usr/local` on UNIX/Linux systems.
Five more variables can customize the installation process.
The following table lists them and their defaults plus the `CMAKE_INSTALL_PREFIX`:
The following table lists them and their default values:
CMAKE_INSTALL_PREFIX /usr/local
TIMEW_BINDIR bin
TIMEW_DOCDIR share/doc/timew
TIMEW_MAN1DIR share/man/man1
TIMEW_MAN5DIR share/man/man5
TIMEW_MAN7DIR share/man/man7
| Variable | Default Value |
|-----------------|-------------------|
| `TIMEW_BINDIR` | `bin` |
| `TIMEW_DOCDIR` | `share/doc/timew` |
| `TIMEW_MANDIR` | `share/man` |
| `TIMEW_MAN1DIR` | `share/man/man1` |
| `TIMEW_MAN7DIR` | `share/man/man7` |
The corresponding `TIMEW_*` variables will be combined with `CMAKE_INSTALL_PREFIX` to get absolute installation directories:
On FreeBSD or DragonFly BSD systems, the `share/` directory is omitted for the `TIMEW_MAN*DIR` variables.
CMAKE_INSTALL_PREFIX/TIMEW_BINDIR /usr/local/bin
CMAKE_INSTALL_PREFIX/TIMEW_DOCDIR /usr/local/share/doc/timew
CMAKE_INSTALL_PREFIX/TIMEW_MAN1DIR /usr/local/share/man/man1
CMAKE_INSTALL_PREFIX/TIMEW_MAN5DIR /usr/local/share/man/man5
CMAKE_INSTALL_PREFIX/TIMEW_MAN7DIR /usr/local/share/man/man7
The `TIMEW_*` variables are combined with the value of `CMAKE_INSTALL_PREFIX` to get the absolute paths.
# Updating Timewarrior build
This section concerns itself with the description of the procedure needed to update the local Timewarrior build from the 'timew' Git repository.
To update the local Timewarrior build, you need to update the Git repository, including the `src/libshared` submodule.
To do that, run:
To update the local Timewarrior build, you need to update the Git repository, including the `src/libshared` submodule, run:
$ git pull --recurse-submodules
$ git submodule update

View file

@ -2,6 +2,6 @@ cmake_minimum_required (VERSION 3.8)
message ("-- Configuring holiday documentation")
install (FILES README DESTINATION ${TIMEW_DOCDIR}/doc/holidays)
install (FILES holidays.en-US DESTINATION ${TIMEW_DOCDIR}/doc/holidays)
install (FILES refresh DESTINATION ${TIMEW_DOCDIR}/doc/holidays)
install (FILES README DESTINATION ${TIMEW_DOCDIR}/holidays)
install (FILES holidays.en-US DESTINATION ${TIMEW_DOCDIR}/holidays)
install (FILES refresh DESTINATION ${TIMEW_DOCDIR}/holidays)

View file

@ -16,6 +16,4 @@ endforeach (SRC)
add_custom_target (man1 DEPENDS ${DOC_FILES})
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DESTINATION ${TIMEW_MANDIR}
FILES_MATCHING PATTERN "*.1")
install (FILES ${DOC_FILES} DESTINATION ${TIMEW_MAN1DIR})

View file

@ -16,6 +16,4 @@ endforeach (SRC)
add_custom_target (man7 DEPENDS ${DOC_FILES})
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DESTINATION ${TIMEW_MANDIR}
FILES_MATCHING PATTERN "*.7")
install (FILES ${DOC_FILES} DESTINATION ${TIMEW_MAN7DIR})

View file

@ -2,8 +2,8 @@ cmake_minimum_required (VERSION 3.8)
message ("-- Configuring theme documentation")
install (FILES README DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark_blue.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark_green.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES dark_red.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
install (FILES README DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark.theme DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark_blue.theme DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark_green.theme DESTINATION ${TIMEW_DOCDIR}/themes)
install (FILES dark_red.theme DESTINATION ${TIMEW_DOCDIR}/themes)

View file

@ -71,4 +71,4 @@ target_link_libraries (lex_executable timew libshared libshared
set_property (TARGET timew_executable PROPERTY OUTPUT_NAME "timew")
set_property (TARGET lex_executable PROPERTY OUTPUT_NAME "lex")
install (TARGETS timew_executable DESTINATION bin)
install (TARGETS timew_executable DESTINATION ${TIMEW_BINDIR})