{install} PHP 5.3.10 (with Apache httpd 2.4.1) on QNAP TS-210
環境変数を引数にわたせない configure はひさしぶりだ。Autoconf 2.13 製らしい。
$ CFLAGS='-pipe -Os' \
LDFLAGS='-Wl,--enable-new-dtags -Wl,-rpath=/opt/apache/lib -Wl,-rpath=/opt/lib' \
./configure --prefix=/opt/apache \
--mandir=/opt/apache/share/man \
--with-apxs2=/opt/apache/bin/apxs \
--disable-static \
--enable-mbstring \
--enable-soap \
--with-libxml-dir=/opt \
--with-pcre-regex=/opt \
--with-openssl=/opt \
--with-pdo-pgsql=/opt \
--with-pgsql=/opt \
--with-zlib=/opt
$ make
$ make test
# make install
configure に指定しなかったけど迷ったもの:--with-bz2 --enable-calendar --enable-dba=shared --with-gdbm --with-dbm --enable-exif --enable-sqlite-utf8。--enable-sqlite-utf8 はたぶん同梱の SQLite ではもともと効いている。
使うライブラリを非標準の場所(/opt)に入れているばあい,いちいち明示せねばならないのがダサい。
--mandir は未テスト。つけずに make install したら PREFIX/man に入れられた。そうかあ,古い Autoconf だもんな。再ビルドもめんどうなので mv した。
PostgreSQL の pg_config は $HOME/bin につくったこないだのラッパを使いたいが,--with-pgsql=$HOME としてもダメだった。PostgreSQL を入れた場所を指定せねばならないらしい。でも生の pg_config は使わせたくない。ということで,/opt/bin/pg_config をラッパに置き換えた。
configure で yes の前に割り込んだこのエラーはいいのかな:
checking for Apache 2.0 handler-module support via DSO through APXS... apxs:Error: Invalid query string `MPM_NAME'.
yes
make でエラーが 2 つ:
ext/pcre/.libs/php_pcre.o: In function `pcre_get_compiled_regex_cache':
php_pcre.c:(.text+0x1a3c): undefined reference to `pcre_info'
ext/pdo_sqlite/.libs/sqlite_statement.o: In function `pdo_sqlite_stmt_col_meta':
sqlite_statement.c:(.text+0x17c): undefined reference to `sqlite3_column_table_name'
前者(上 2 行)は PCRE 8.30 で pcre_info() が廃止されたため。ext/pcre/php_pcre.c の pcre_info() を pcre_fullinfo() に書き換えた。ここでは pcre_info() を呼ぶことで何か情報が欲しいわけではなく PCRE のキャッシュが壊れているかどうか確かめたいだけのようだ。でも pcre_fullinfo() は何か情報を受け取らねばならないみたい。pcre_info() の戻り値は pcre_fullinfo() の PCRE_INFO_CAPTURECOUNT とおなじもののようなので,これを受け取ることにした:
- if (pcre_info(pce->re, NULL, NULL) == PCRE_ERROR_BADMAGIC) {
+ int cc;
+ if (pcre_fullinfo(pce->re, NULL, PCRE_INFO_CAPTURECOUNT, &cc) == PCRE_ERROR_BADMAGIC) {
後者(下 2 行)は SQLite のコンパイルのときに SQLITE_ENABLE_COLUMN_METADATA マクロが定義されている必要がある。そんなの SQLite の configure のオプションにもないのに気づくはずがない。SQLite は PHP に同梱されているものを使うことにする(同梱のものは最初から定義されている)。
make install すると httpd.conf を httpd.conf.bak に退避して書き換えるが,httpd.conf.bak もタイムスタンプは保持されない。死ね。
update : 2012/03/01 (Thu) 19:17:40