Skip to content

Commit

Permalink
generate man page with cmake; fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sagb committed May 13, 2024
1 parent c12783c commit 2cda17d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ if(NOT UTHASH_INCLUDE_DIRS)
message(FATAL_ERROR "Cannot find uthash.h, please install uthash")
endif()

#include_directories(${X11_INCLUDE_DIRS} ${XFT_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS} ${XRANDR_INCLUDE_DIRS} ${LIBPNG_INCLUDE_DIRS} ${XPM_INCLUDE_DIRS} ${UTHASH_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src)
include_directories(${X11_INCLUDE_DIRS} ${XFT_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS} ${XRANDR_INCLUDE_DIRS} ${LIBPNG_INCLUDE_DIRS} ${XPM_INCLUDE_DIRS} ${UTHASH_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/src)

set(PACKAGE "alttab")
Expand Down
33 changes: 12 additions & 21 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

Binaries
--------

* In Debian _sid_, _buster_ or their Ubuntu derivatives, install alttab from the official repository:
* In Debian or its derivatives, install alttab from the official repository:

```
apt install alttab
Expand Down Expand Up @@ -39,18 +38,18 @@ Building from source
--------------------

1. Install build dependencies.
Basic Xlib, Xft, Xrender, Xrandr, libpng, libxpm libraries
Cmake and basic Xlib, Xft, Xrender, Xrandr, libpng, libxpm libraries
and [uthash macros](http://troydhanson.github.io/uthash/) are required.
In Debian or Ubuntu:

```
apt install libx11-dev libxmu-dev libxft-dev libxrender-dev libxrandr-dev libpng-dev libxpm-dev uthash-dev
apt install cmake libx11-dev libxmu-dev libxft-dev libxrender-dev libxrandr-dev libpng-dev libxpm-dev uthash-dev
```

Maintainer or packager may also install cmake and ronn:
If you need to regenerate man page, also install ronn:

```
apt install cmake ronn
apt install ronn
```

2. Download:
Expand All @@ -59,13 +58,7 @@ Building from source
git clone https://github.com/sagb/alttab.git && cd alttab
```

3. If you changed alttab.1.ronn, update the man page:

```
cd doc ; ronn --roff alttab.1.ronn
```

4. Build, test, install:
3. Build, test, install:

```
mkdir build
Expand All @@ -90,13 +83,11 @@ Building from source

3. Build:

```
export CPATH=/usr/local/include
```
The proceed as with cmake as described above.
TODO: need test and report.
Proceed with cmake as described above. Former autotools build required
CPATH=/usr/local/include , perhaps cmake also needs this. Please test and report.

Usage notes
-----------
Usage
-----

See `README.md`
See README or man page.
Usually it should run fully functional without any argument: `alttab`.
26 changes: 25 additions & 1 deletion doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
install(FILES alttab.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
find_program(RONN_EXECUTABLE ronn)
set(MAN_PAGE_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/alttab.1.ronn)
set(MAN_PAGE ${CMAKE_CURRENT_SOURCE_DIR}/alttab.1)
if(RONN_EXECUTABLE)
add_custom_command(
OUTPUT ${MAN_PAGE}
COMMAND ${RONN_EXECUTABLE} --roff < ${MAN_PAGE_SOURCE} > ${MAN_PAGE}
COMMAND ${CMAKE_COMMAND} -E echo "Regenerated ${MAN_PAGE} from ${MAN_PAGE_SOURCE}."
DEPENDS ${MAN_PAGE_SOURCE}
COMMENT "Regenerating alttab.1 from alttab.1.ronn"
)
else()
add_custom_command(
OUTPUT ${MAN_PAGE}
COMMAND ${CMAKE_COMMAND} -E touch ${MAN_PAGE}
COMMAND ${CMAKE_COMMAND} -E echo "Touched ${MAN_PAGE}. Ronn not found."
DEPENDS ${MAN_PAGE_SOURCE}
COMMENT "Touching alttab.1 as ronn not found"
)
endif()
add_custom_target(UpdateManPage ALL
DEPENDS ${MAN_PAGE}
)
install(FILES ${MAN_PAGE} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)

install(FILES wm-setup.md icons.md mobile.md README alttab.ad DESTINATION ${CMAKE_INSTALL_DOCDIR})

0 comments on commit 2cda17d

Please sign in to comment.