10

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 (Where 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.

DVK
  • 126,886
  • 32
  • 213
  • 327
cespinoza
  • 1,437
  • 1
  • 12
  • 18

3 Answers3

11

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.

daxim
  • 39,270
  • 4
  • 65
  • 132
3

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.

mob
  • 117,087
  • 18
  • 149
  • 283
0

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

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Erik Aronesty
  • 11,620
  • 5
  • 64
  • 44