homebrewでgtk-docを入れる

install ruby-vips(Ruby画像処理ライブラリいろいろ入れてみる その1) - 別館 子子子子子子(ねこのここねこ)
の続き。
(注意:ruby-vipsをインストールする際にlibvipsは不要です。homebrewのvipsで機能します。)
gtkdocizeはgtk-docに含まれるのでgtk-docを入れる。

libvipsの依存性

libvips has to have gettext, glib-2.x and libxml-2.0. The build system needs sh, pkg-config, swig, gtk-doc-tools, automake, gobject-introspection and gnu make.

ということなので、足らなさそうな物を入れてみる。
やはりgtk-doc。

mini:~/git/libvips admin$ brew install gtk-doc
Error: gtk-doc dependency libxml2 not installed with:
  --with-python

…後まわし。
swigインストール。

mini:~/git/libvips admin$ brew search swig
swig
mini:~/git/libvips admin$ brew install swig
==> Installing swig dependency: pcre
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.
######################################################################## 100.0%
######################################################################## 100.0%==> ./configure --prefix=/usr/local/Cellar/pcre/8.32 --enable-utf8 --enable-unic
==> make test
==> make install
🍺  /usr/local/Cellar/pcre/8.32: 135 files, 3.5M, built in 51 seconds
==> Installing swig
==> Downloading http://sourceforge.net/projects/swig/files/swig/swig-2.0.9/swig-
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/swig/2.0.9
==> make
==> make install
🍺  /usr/local/Cellar/swig/2.0.9: 599 files, 6.2M, built in 58 seconds

gobject-introspectionインストール。

mini:~/git/libvips admin$ brew search gobject
gobject-introspection	   pygobject
mini:~/git/libvips admin$ brew install gobject-introspection
==> Downloading http://ftp.gnome.org/pub/gnome/sources/gobject-introspection/1.3
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gobject-introspection/1.34.1 --disabl
==> make install
🍺  /usr/local/Cellar/gobject-introspection/1.34.1: 214 files, 9.6M, built in 42 seconds

一旦libxml2を消してみる。

mini:~/git/libvips admin$ brew uninstall libxml2
Uninstalling /usr/local/Cellar/libxml2/2.9.1...

次いでgtk-docインストール。

mini:~/git/libvips admin$ brew install gtk-doc
==> Installing gtk-doc dependency: intltool
==> Downloading http://launchpad.net/intltool/trunk/0.50.2/+download/intltool-0.
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/intltool/0.50.2
==> make install
🍺  /usr/local/Cellar/intltool/0.50.2: 19 files, 388K, built in 8 seconds
==> Installing gtk-doc dependency: docbook
==> Downloading http://www.docbook.org/xml/5.0/docbook-5.0.zip
######################################################################## 100.0%
==> xmlcatalog --noout --create /usr/local/etc/xml/catalog
==> Downloading http://www.docbook.org/xml/4.2/docbook-xml-4.2.zip
######################################################################## 100.0%
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/d
==> Downloading http://www.docbook.org/xml/4.1.2/docbkx412.zip
######################################################################## 100.0%
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/d
==> Downloading http://www.docbook.org/xml/4.3/docbook-xml-4.3.zip
######################################################################## 100.0%
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/d
==> Downloading http://www.docbook.org/xml/4.4/docbook-xml-4.4.zip
######################################################################## 100.0%
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/d
==> Downloading http://www.docbook.org/xml/4.5/docbook-xml-4.5.zip
######################################################################## 100.0%
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/d
==> Downloading http://www.docbook.org/xml/5.0/docbook-5.0.zip
Already downloaded: /Library/Caches/Homebrew/docbook-5.0.zip
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/5.
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/d
==> Caveats
To use the DocBook package in your XML toolchain,
you need to add the following to your ~/.bashrc:

export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
==> Summary
🍺  /usr/local/Cellar/docbook/5.0: 181 files, 5.0M, built in 13 seconds
==> Installing gtk-doc dependency: libxml2
==> Downloading ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/libxml2-2.9.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/libxml2/2.9.1 --without-python
==> make
==> make install
==> python setup.py install_lib --install-dir=/usr/local/Cellar/libxml2/2.9.1/li
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libxml2/lib
    CPPFLAGS: -I/usr/local/opt/libxml2/include

==> Summary
🍺  /usr/local/Cellar/libxml2/2.9.1: 279 files, 12M, built in 46 seconds
==> Installing gtk-doc dependency: gnome-doc-utils
==> Downloading http://ftp.gnome.org/pub/gnome/sources/gnome-doc-utils/0.20/gnom
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gnome-doc-utils/0.20.10 --disable-scr
==> make
==> make install
🍺  /usr/local/Cellar/gnome-doc-utils/0.20.10: 277 files, 4.0M, built in 18 seconds
==> Installing gtk-doc dependency: docbook-xsl
==> Downloading http://downloads.sourceforge.net/project/docbook/docbook-xsl/1.7
######################################################################## 100.0%
==> Downloading http://downloads.sourceforge.net/project/docbook/docbook-xsl-ns/
######################################################################## 100.0%
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook-xsl/1.78.0/docbook
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook-xsl/1
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook-xsl/1.78.0/docbook
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook-xsl/1
🍺  /usr/local/Cellar/docbook-xsl/1.78.0: 3676 files, 52M, built in 12 seconds
==> Installing gtk-doc
==> Downloading http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/1.18/gtk-doc-1.18
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gtk-doc/1.18 --disable-scrollkeeper -
==> make
    from xml2po import Main
ImportError: No module named xml2po
make[2]: *** [en_GB/gtk-doc-manual.xml] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

libxml2を一旦消したことで少し上手くいったのだが、うーむ…

To use the DocBook package in your XML toolchain,
you need to add the following to your ~/.bashrc:

export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"

とあるので~/.bashrcに書いたのだけど同じエラー。
やはりhomebrewに報告した方がいいのかしら。

助けて貰って解決

githubのhomebrewのところへ書き込んだ
gtk-doc failed to build on 10.7 (Lion) · Issue #20150 · Homebrew/legacy-homebrew · GitHub
ところ、ヒントが来た。

The issue with not being able to build gtk-doc has sort-of already been discovered and "fixed" in #12372.
Try the below to install gtk-doc:
1) Install python; brew install python
2) install gnome-doc-util, then edit /usr/local/bin/xml2po, and change the installed bangpath at the top of the file (something like #!/usr/bin/python) to #!/usr/bin/env python
3) Install libxml2 with the --with-python switch; brew install --with-python libxml2
4) Install gtk-doc
Note that steps 2 and 3 can be performed in either order, but need to be done before you try to install gtk-doc. I've run through the combinations a few times, and the above steps are working for me reliably.
Mac OS X 10.7.5 on both a Macbook Air and a Mac Pro.
gtk-doc failed to build on 10.7 (Lion) · Issue #20150 · Homebrew/legacy-homebrew · GitHub

結局ポイントになったのは/usr/local/bin/xml2poのshebang

#!/usr/local/opt/python/bin/python2

から、pythonのあるpathである

#!/usr/local/bin/python

に書き換えることでインストールできました。

ですが、「書き換えない方がいいぜ」と指摘を受けて、brew updateした後に再度libxml2, python, gnome-doc-utils, gtk-docを削除して全てを入れ直したところ、ちゃんとインストールできました。なんでダメだったのかしらね。