开发者

Best practice for using slightly modifying module from CPAN?

I'm using DBI and DBD::SQLite, and now I'd like to use the R*Tree feature of SQLite. Since this feature is not compiled by DBD::SQLite by default, I have to add a -DSQLITE_ENABLE_RTREE=1 to the @CC_DEFINE variable in DBD::SQLite's Makefile.PL. If I do a 'perl Makefile.PL && make && make install', everything works fine locally on my machine, but this ultimately needs to be deployable/distributable to end users.

What should I do in a case like this? Should I copy the source, grep the source, and create a DBD::SQLite::WithRTree? Create a private version of DBD::SQLite 1.31.1 (Wher开发者_JS百科e 1.31 is the current version of DBD::SQLite)? Perhaps a better way altogether?

All other distributions in the project are deployed/distributed via a non-public CPAN::Mini mirror + CPAN::Mini::Inject.


I have to add a '-DSQLITE_ENABLE_RTREE=1' to the @CC_DEFINE variable in DBD::SQLite's Makefile.PL

You're doing this wrong, perl Makefile.PL DEFINE='-DSQLITE_ENABLE_RTREE=1' works. This is documented in ExtUtils::MakeMaker. Now that you know that, a simple solution involving Distroprefs will likely fall in place.


For similar problems, I have installed the modified distribution in a separate directory (without changing any module names), and using use lib qw(the/special/directory) or setting $PERL5LIB for scripts that need to use the enhanced module.

Tweaking the name of the module would also do the job, but that sound like a lot more work to make and test.


You can do this:

cpan
o conf makepl_arg "DEFINE='-DSQLITE_ENABLE_RTREE=1'"
o conf commit

CPAN will then permanently add that DEFINE to the front of all your Makefile.PL calls.

So, it should just be

cpan DBD::SQLite

And your makefile options should get stuffed onto your compile lines

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜