diff --git a/CMakeLists.txt b/CMakeLists.txt index 03d6609..5e4756d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,8 @@ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/cellar") # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +include(Ronn) + find_package(PythonInterp) find_package(PythonModule) find_python_module(cogapp REQUIRED) @@ -117,6 +119,9 @@ add_dependencies(cellar cog) # effectively redundant but a couple of the bin's # files are cogged, so this is mostly for people # looking at CMakeLists.txt for hints +generate_manpage(cellar 1) +add_manpage_target() + install(TARGETS cellar ${cellar_LIBRARIES} RUNTIME DESTINATION bin LIBRARY DESTINATION lib/cellar diff --git a/cmake/Modules/Ronn.cmake b/cmake/Modules/Ronn.cmake new file mode 100644 index 0000000..fe6b696 --- /dev/null +++ b/cmake/Modules/Ronn.cmake @@ -0,0 +1,41 @@ +find_program(RONN ronn) +find_program(GZIP gzip) + +if(NOT RONN OR NOT GZIP) + message(WARNING "Not generating manpages") + if(NOT RONN) + message(WARNING " ronn not installed") + endif(NOT RONN) + if (NOT GZIP) + message(WARNING " gzip (somehow) not installed") + endif(NOT GZIP) + macro(generate_manpage) # Empty, won't do anything + endmacro(generate_manpage) + macro(add_manpage_target) # ditto + endmacro(add_manpage_target) +else(NOT RONN OR NOT GZIP) + set(manpages) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/man") + macro(generate_manpage TARGET SECTION) + set(ronnfile "${CMAKE_SOURCE_DIR}/doc/${TARGET}.${SECTION}.ronn") + set(outfile "${CMAKE_CURRENT_BINARY_DIR}/man/${TARGET}.${SECTION}") + add_custom_command(OUTPUT "${outfile}" + DEPENDS "${ronnfile}" + COMMAND ${RONN} + # BULLSHIT: ronn doesn't let you specify your own output filenames, + # have to hack it with shell redirecting + ARGS -r --pipe "${ronnfile}" > "${outfile}" + ) + add_custom_command(OUTPUT "${outfile}.gz" + DEPENDS "${outfile}" + COMMAND "${GZIP}" + ARGS -f "${outfile}" + ) + set(manpages ${manpages} "${outfile}.gz") + endmacro(generate_manpage) + + macro(add_manpage_target) # this is a macro so we can call it after we've generated all our manpages + add_custom_target(man ALL DEPENDS ${manpages}) + install(FILES ${manpages} DESTINATION "${MAN_INSTALL_DIR}/man${SECTION}" OPTIONAL) + endmacro(add_manpage_target) +endif(NOT RONN OR NOT GZIP) diff --git a/doc/cellar.1.ronn b/doc/cellar.1.ronn new file mode 100644 index 0000000..6deb81d --- /dev/null +++ b/doc/cellar.1.ronn @@ -0,0 +1,37 @@ +cellar(1) - bottle management tool for WINE connoisseurs +======================================================== + +## SYNOPSIS + +`cellar` [-dv] [-b ] [--] + +## DESCRIPTION + +`cellar` is a tool for managing WINE bottles. `cellar` arguments are divided like this: + + * First, [GLOBAL OPTIONS][] are processed. These control things like program verbosity, which bottle to use, + and other settings that are relevant no matter what you're doing. + * Second, cellar takes a [COMMAND][#COMMANDS], and that command probably has its own set of arguments and flags. + TCLAP is generally used as the command line parser, which provides a -- argument to separate the command from + the global options (e.g. `cellar -v -- create bottlename`). If the program seems to be interpreting a flag + ambiguously, try this first. + +## GLOBAL OPTIONS + + * `-v`, `--verbose`: + Enable verbose output. + + * `-d', `--dryrun`: + Don't actually do anything, just print what you would do. Implies `--verbose`. + + * `-b`, `--bottle `: + Specify that you want to use the bottle named , instead of the one activated with the "cellar activate" + command. + +## COMMANDS + +TODO: Generate this. + +## COPYRIGHT + +Copyright © 2017 Nicholas O'Connor. Provided under the terms of the MIT license: https://opensource.org/licenses/MIT