php+libtidy
php5.5.28でlibtidyを使いたい。configureのヘルプをみると
# ./configure --help | grep tidy --with-tidy=DIR Include TIDY support
とあるので、さっそくやってみる。
エラーになりました。内容はこんな。
# ./configure --with-tidy (前略) checking whether to enable System V IPC support... no checking whether to enable System V semaphore support... no checking whether to enable System V shared memory support... no checking for TIDY support... yes configure: error: Cannot find libtidy
libtidyがないと。yumでいれよう。
# yum install libtidy Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.riken.jp * epel: ftp.cuhk.edu.hk * extras: ftp.riken.jp * remi: rpms.remirepo.net * remi-safe: rpms.remirepo.net * updates: ftp.riken.jp No package libtidy available. Error: Nothing to do
ないって。えー?
似たようなのはあるかな。
# yum list| grep tidy libtidyp.x86_64 1.02-5.el6 @epel libtidyp-devel.x86_64 1.02-5.el6 @epel jtidy.noarch 2:1.0-0.16.20100930svn1125.el7 jtidy-javadoc.noarch 2:1.0-0.16.20100930svn1125.el7 libtidyp.i686 1.02-5.el6 epel libtidyp-devel.i686 1.02-5.el6 epel perltidy.noarch 20121207-3.el7 base php-horde-Horde-Text-Filter-Csstidy.noarch 2.0.1-1.el6.remi remi php-tidy.x86_64 5.4.44-1.el6.remi remi php54-php-tidy.x86_64 5.4.44-1.el6.remi remi php55-php-tidy.x86_64 5.5.28-1.el6.remi remi php56-php-tidy.x86_64 5.6.12-1.el6.remi remi tidyp.x86_64 1.02-5.el6 epel
tidypってのがあるな。どう違うのかなとしらべてみると、まぁよくわからないが似たようなものというか、tidyの後継的なものらしい。
じゃぁってんでこれをいれる。
# yum -y install libtidy libtidy-devel
でconfigure。
# ./configure --with-tidy (前略) checking whether to enable System V IPC support... no checking whether to enable System V semaphore support... no checking whether to enable System V shared memory support... no checking for TIDY support... yes configure: error: Cannot find libtidy
同じ結果じゃないですが。configureの該当部分を参照すると、/usr/include/tidy/tidy.hがないとこんなエラーにしてるみたい。さっきいれたtidypのdevelは/usr/include/tidyp/tidyp.hってのを作ってくれている。じゃあってんでこうやってみる。ディレクトリの中をみてみると、tidypenum.hってのもあるのでついでに処理しとく。
# ln -s /usr/include/tidyp/tidyp.h /usr/include/tidyp/tidy.h # ln -s /usr/include/tidyp/tidypenum.h /usr/include/tidyp/tidyenum.h # ln -s /usr/include/tidyp /usr/include/tidy
tidyp.hをtidy.hへリンクしてconfigureが期待しているところへリンク。
で再度configure。おお、終了した。次にmake。エラーになった。
# make (中略) /usr/bin/ld: cannot find -ltidy collect2: error: ld returned 1 exit status make: *** [sapi/cgi/php-cgi] Error 1 make: *** Waiting for unfinished jobs.... /usr/bin/ld: cannot find -ltidy collect2: error: ld returned 1 exit status make: *** [sapi/cli/php] Error 1
あぁライブラリか。じゃあそれも別名でリンクしてあげよう。
# ln -s /usr/lib64/libtidyp-1.02.so.0.0.0 /usr/lib/libtidy.so
再度make。またエラーが。シンボルが見えないとか。
/tmp/php-5.5.28.tar.bz2/php-5.5.28/ext/tidy/tidy.c:1105: undefined reference to `tidyReleaseDate' ext/tidy/.libs/tidy.o: In function `zif_tidy_get_release': /tmp/php-5.5.28.tar.bz2/php-5.5.28/ext/t idy/tidy.c:1360: undefined reference to `tidyReleaseDate' collect2: error: ld returned 1 exit status make: *** [sapi/cli/php] Error 1
うーん、まぁそりゃそうか。
なになに、tidyReleaseDateがないっていってるのか。ここ
の情報によると、tidyReleaseDate()ってのはtidyVersion()に変更されたみたい。なので、ソースの該当箇所を修正しちゃう。ext/tidy/tidy.cの1105行目と1360行目ですね。tidyReleaseDateをtidyVersionへ置き換え。いい子はdefineを追加するとか、パッチを書くとかしましょう。
これでようやくmakeできました。