我已经定制了自己的postgresql客户端和postgresql client-devel包,我希望它可供Ruby程序员使用。所以安装ruby pg gem的命令如下:
gem install pg -- --with-pg-config=/usr/local/mypostgres-1.0/bin/pg_config --with-ldflags="-Wl,-rpath,/usr/local/mypostgres-1.0/lib"
如果只安装了我自己的postgresql,那么该命令效果很好。
我的pg_config输出看起来不错:
BINDIR = /usr/local/mypostgres-1.0/bin
DOCDIR = /usr/local/mypostgres-1.0/doc
HTMLDIR = /usr/local/mypostgres-1.0/doc
INCLUDEDIR = /usr/local/mypostgres-1.0/include
PKGINCLUDEDIR = /usr/local/mypostgres-1.0/include
INCLUDEDIR-SERVER = /usr/local/mypostgres-1.0/include/server
LIBDIR = /usr/local/mypostgres-1.0/lib
PKGLIBDIR = /usr/local/mypostgres-1.0/lib
LOCALEDIR = /usr/local/mypostgres-1.0/share/locale
MANDIR = /usr/local/mypostgres-1.0/man
SHAREDIR = /usr/local/mypostgres-1.0/share
SYSCONFDIR = /usr/local/mypostgres-1.0/etc
PGXS = /usr/local/mypostgres-1.0/lib/pgxs/src/makefiles/pgxs.mk
VERSION = PostgreSQL 9.0.0
但是,如果安装了官方和我自定义的postgresql。安装的驱动程序将链接到官方libpq.so而不是我自己的libpq.so。 有没有办法强迫ruby-pg链接到我自己的libpq.so?任何线索或提示都将受到赞赏。
如果我不能以这种方式做到这一点,我如何自定义gem链接到我的库?