Wednesday, May 30, 2018

Installing Docutils 0.14

I've recently built and installed Python version 2.7.15 on Solaris 11 Express. Soon after I was trying to install the latest version of Mercurial (4.6 at the time of this writing), but on the last moments I've got to know the required dependency on Docutils, a Python utility which positions itself as:
"Docutils is an open-source text processing system for processing plaintext documentation into useful formats, such as HTML, LaTeX, man-pages, open-document or XML. It includes reStructuredText, the easy to read, easy to use, what-you-see-is-what-you-get plaintext markup language."
People seem to prefer, for obvious reasons I presume, the acronym ReST instead of the very long name ReStructuredText and I've visited the ReST Primer in order to know a little something about it and, well, OK, thank you. Anyway:
"This primer introduces the most common features of reStructuredText, but there are a lot more to explore. The Quick reStructuredText user reference is a good place to go next. For complete details, the reStructuredText Markup Specification is the place to go [1]."
To install it:

Get the latest tarball and, although too much of a huge canon for a small target, as a matter of convenience, consider using the Staged Building script to unpack it into the common ZFS structure used for other software that has been additionally manually built for Solaris 11:

 $ pwd
/stage/build

$ ./gnu-build-preparation ../source/.../docutils-0.14.tar.gz
...

$ cd docutils/docutils-0.14-32

NOTE
I've chosen the ZFS clone with -32 suffix for the sole reason I'm keeping on a personal project under a 32-bits Solaris 11 Express system where it turn out to be required. I'm not sure at this moment if there's any compiled part where the bitness would matter.
NOTE
As usual with Python stuff, it's necessary to explicitly become root as just a sudo on the root command won't do, mainly because of important shell environment settings not being carried over from one account to the other through the main Python interpreter process.
NOTE
In addition, as a non regular GNU build, this may make the establishment of a prototype for an IPS package creation somewhat harder.
# su
# source ../setenv-0.14 32

Configuration file [version 4]: /stage/build/docutils/ld.config32 
  Platform:     32-bit LSB 80386
  Default Library Path (ELF):   /opt/gnu/lib:/opt/usr/lib:/lib:/usr/lib
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure (... default)

Command line:
  crle -c /stage/build/docutils/ld.config32 \

       -l /opt/gnu/lib:/opt/usr/lib:/lib:/usr/lib

LD_CONFIG_32=/stage/build/docutils/ld.config32

CONFIG_SHELL=

CC=/usr/bin/gcc CFLAGS=-m32 -march=nocona -mtune=nocona -std=gnu89

CXX=/usr/bin/g++ CXXFLAGS=-m32 -march=nocona -mtune=nocona -std=gnu++98

LD=/usr/bin/ld LDFLAGS=-m32 -march=nocona -mtune=nocona

PATH=/opt/gnu/bin:/opt/usr/bin:/usr/gnu/bin:/usr/bin:/usr/sbin

PKG_CONFIG_PATH=/opt/usr/lib/pkgconfig

Suggested build sequence:

Fine-tune/fix config.h.in, Makefile.in and others...

$ ./configure \
    --build=i386-pc-solaris2.11 \
    --prefix=/opt/... \
    ...

$ gmake -j2

For IPS package:

# su

# source ../setenv-0.14 32
# gmake DESTDIR=/stage/prototype/docutils/0.14/32 install

For immediate use:

# su

# source ../setenv-0.14 32
# gmake install
# zfs snapshot .../opt/...@docutils-0.14


Make sure the right Python version is selected:

# python --version
Python 2.7.15


Take a deep breath:

# python setup.py install
...
running install_lib
creating /opt/usr/lib/python2.7/site-packages/docutils
...

byte-compiling /opt/usr/lib/.../nodes.py to nodes.pyc
...

running install_scripts
copying build/scripts-2.7/rstpep2html.py -> /opt/usr/bin
copying build/scripts-2.7/rst2html.py -> /opt/usr/bin
copying build/scripts-2.7/rst2man.py -> /opt/usr/bin
copying build/scripts-2.7/rst2pseudoxml.py -> /opt/usr/bin
copying build/scripts-2.7/rst2xetex.py -> /opt/usr/bin
copying build/scripts-2.7/rst2s5.py -> /opt/usr/bin
copying build/scripts-2.7/rst2odt.py -> /opt/usr/bin
copying build/scripts-2.7/rst2html4.py -> /opt/usr/bin
copying build/scripts-2.7/rst2html5.py -> /opt/usr/bin
copying build/scripts-2.7/rst2xml.py -> /opt/usr/bin
copying build/scripts-2.7/rst2odt_prepstyles.py -> /opt/usr/bin
copying build/scripts-2.7/rst2latex.py -> /opt/usr/bin
changing mode of /opt/usr/bin/rstpep2html.py to 755
changing mode of /opt/usr/bin/rst2html.py to 755
changing mode of /opt/usr/bin/rst2man.py to 755
changing mode of /opt/usr/bin/rst2pseudoxml.py to 755
changing mode of /opt/usr/bin/rst2xetex.py to 755
changing mode of /opt/usr/bin/rst2s5.py to 755
changing mode of /opt/us/bin/rst2odt.py to 755
changing mode of /opt/usr/bin/rst2html4.py to 755
changing mode of /opt/usr/bin/rst2html5.py to 755
changing mode of /opt/usr/bin/rst2xml.py to 755
changing mode of /opt/usr/bin/rst2odt_prepstyles.py to 755
changing mode of /opt/usr/bin/rst2latex.py to 755
running install_data
running install_egg_info
Writing /opt/usr/lib/.../docutils-0.14-py2.7.egg-info


# zfs snapshot -r .../opt/usr@docutils-0.14

The README.txt talks about "Converting the documentation" and "Running the Test Suite" but I'm not willing to do that, at least not at this moment as I expect to have met the necessary requirements to accomplish my original goal.