On Thu, Jul 7, 2011 at 11:33 PM, Richard Shaw <[email protected]> wrote:
>>> 3. There's no man pages for the binaries. It's not an absolute
>>> requirement for Fedora but it's *STRONGLY* recommend for any command
>>> line program.
>>
>> From work that Larry just posted it looks like idiff, iinfo, iprocess,
>> and possibly iconvert, maketx may dissappear in the near future, so I
>> doubt there will be much interest in writing comprehensive docs for
>> these right now.  Would it be sufficient for a quick & dirty job to use
>> txt2man on the --help output?
>
> That should do it. The packaging guidelines only require that they exist.

Ok, I spent some time (more than expected) getting this working.  The
build system should now autogenerate man pages on unix systems when
txt2man and python can be found.  (patch attached. for reviewers, see the
pull request as before, https://github.com/OpenImageIO/oiio/pull/118)

> 4. Would it be a lot of work to get a cmake option added to respect
> either CMAKE_INSTALL_LIBDIR or LIB_INSTALL_DIR? This would get the
> library in the proper location (/usr/lib{,64}) without having to
> manually move them around.

Should be possible.

> 5. Also, there's a non-critical error in the configuration. Here's the 
> snippet:
> """
> -- Looking for system HDF5
> CMake Warning (dev) at /usr/share/cmake/Modules/FindHDF5.cmake:59 (include):
>  File /usr/share/cmake/Modules/FindHDF5.cmake includes
>  /builddir/build/BUILD/OpenImageIO-oiio-8055b0f/src/cmake/modules/SelectLibraryConfigurations.cmake
>  (found via CMAKE_MODULE_PATH) which shadows
>  /usr/share/cmake/Modules/SelectLibraryConfigurations.cmake.  This may cause
>  errors later on .

IIRC we pulled this cmake package directly from the cmake repo so that
our build system would still work with older cmake versions.  Hopefully
it's not a problem.

> 6. There are a number of warnings in the build but no errors. Is
> anyone interested in reviewing them to see if they actually need to be
> fixed?
>
> What I did was to create a pseudo-index by grepping through the build
> log for "warning" with line numbers since anyone looking into the
> warning would probably need to see the lines above and/or below the
> warning.
>
> I can post both of those files online somewhere if anyone's interested.

Feel free to post them.  I may not find time to fix them personally
though perhaps someone else will.

> Most of these can be ignored but I'm concerned about:
> OpenImageIO.x86_64: W: private-shared-object-provides
> /usr/lib64/python2.7/site-packages/OpenImageIO.so
> OpenImageIO.so()(64bit)
>
> The description of the error:
> $ rpmlint -I private-shared-object-provides
> private-shared-object-provides:
> A shared object soname provides is provided by a file in a path from which
> other packages should not directly load shared objects from.  Such shared
> objects should thus not be depended on and they should not result in provides
> in the containing package.  Get rid of the provides if appropriate, for
> example by filtering it out during build.  Note that in some cases this may
> require disabling rpmbuild's internal dependency generator.

Haha!  This is the most obtuse explanation I've read in a while.  I've
read it a few times now, and I must say I have absolutely no idea what
it's telling me, and whether I should be worried.  I even looked it up
online, but no joy.

~Chris
commit 8ce99d0508725724f6177700f039412cf79d8ab6
Author: Chris Foster <[email protected]>
Date:   Fri Jul 8 02:00:23 2011 +1000

    Generate manual pages from "$tool --help"
    
    Generate manual pages using a combination of a simple python script to
    munge the output of "$tool --help", combined with the txt2man program.
    This is done only on unix-like systems when the necessary tools are
    found.

diff --git a/src/doc/CMakeLists.txt b/src/doc/CMakeLists.txt
index f80f283..e9d5adc 100644
--- a/src/doc/CMakeLists.txt
+++ b/src/doc/CMakeLists.txt
@@ -1,11 +1,37 @@
+project(documentation)
 set (public_docs openimageio.pdf CLA-INDIVIDUAL CLA-CORPORATE)
 
 install (FILES ${public_docs} DESTINATION doc COMPONENT documentation)
 
-install (FILES ${PROJECT_SOURCE_DIR}/../LICENSE
-               ${PROJECT_SOURCE_DIR}/../INSTALL
-               ${PROJECT_SOURCE_DIR}/../CHANGES
+install (FILES ${OpenImageIO_SOURCE_DIR}/../LICENSE
+               ${OpenImageIO_SOURCE_DIR}/../INSTALL
+               ${OpenImageIO_SOURCE_DIR}/../CHANGES
          DESTINATION .)
 
 install (DIRECTORY doxygen/html DESTINATION doc
          PATTERN .svn EXCLUDE)
+
+# generate man pages using txt2man and a tiny python script to munge the
+# result of "tool --help"
+find_program(txt2man txt2man)
+find_package(PythonInterp)
+if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
+    message (STATUS "Generating manual page docs")
+    set (cli_tools iinfo maketx idiff iv igrep iprocess iconvert)
+
+    foreach (tool ${cli_tools})
+        set (outfile "${documentation_BINARY_DIR}/${tool}.1")
+        list (APPEND manpage_files ${outfile})
+        add_custom_command (OUTPUT ${outfile}
+            COMMAND ${tool} --help |
+            ${PYTHON_EXECUTABLE} ${documentation_SOURCE_DIR}/help2man_preformat.py |
+            ${txt2man} -v OpenImageIO -s 1 -t ${tool} > ${outfile}
+            DEPENDS ${tool} help2man_preformat.py)
+    endforeach()
+
+    # force man page build before install
+    add_custom_target (man_pages ALL DEPENDS ${manpage_files})
+
+    install (FILES ${manpage_files}
+             DESTINATION doc/man COMPONENT documentation)
+endif()
diff --git a/src/doc/help2man_preformat.py b/src/doc/help2man_preformat.py
new file mode 100755
index 0000000..1941904
--- /dev/null
+++ b/src/doc/help2man_preformat.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+from __future__ import print_function
+import sys
+
+lines = [l.rstrip().replace('\t', ' '*8) for l in sys.stdin.readlines()]
+
+print('TITLE')
+print(lines[0])
+print()
+
+print('SYNOPSIS')
+for i,line in enumerate(lines[2:]):
+    if line.lstrip().startswith('-'):
+        optStart = i+2
+        break
+    print(line)
+
+print('''DESCRIPTION
+This program is part of the OpenImageIO (http://www.openimageio.org) tool suite.
+Detailed documentation is avaliable in pdf format with the OpenImageIO
+distribution.
+''')
+
+print('OPTIONS')
+for line in lines[optStart:]:
+    if not line.startswith(' '):
+        print()
+        print(line)
+    elif not line.lstrip().startswith('-'):
+        print(line.lstrip())
+    else:
+        print(line)
+print()
+
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to