1## ----------- 2## Makefile.PL 3## ----------- 4## Perl Makefile generation for Cego DBD driver 5## 6## ( derived from the SQLite package ) 7## 8## by Bjoern Lemke, 2007-2021 9## 10 11eval { 12 require DBI; 13 require DBI::DBD; 14}; 15 16use ExtUtils::MakeMaker; 17use Config; 18 19# $CC = 'c++'; 20 21use strict; 22use Getopt::Long(); 23 24use vars qw($opt); 25$opt = { "help" => \&Usage, }; 26 27 28Getopt::Long::GetOptions( 29 $opt, 30 "help", 31 "prefix=s", 32 "verbose", 33 ) || die Usage(); 34 35if (! exists $opt->{'prefix'}) 36{ 37 print "Missing prefix, use option --prefix\n"; 38 die Usage(); 39} 40 41use vars qw($loadlibs); 42$loadlibs= "-L" . $opt->{'prefix'} . " -llfc"; 43my $so = $Config{so}; 44 45WriteMakefile( 46 'NAME' => 'DBD::Cego', 47 'VERSION_FROM' => 'Cego.pm', 48 'PREREQ_PM' => {DBI => 1.03}, 49 'OBJECT' => '$(O_FILES)', 50 'INC' => '-I$(DBI_INSTARCH_DIR) -I' . $opt->{'prefix'} . '/include -I' . $opt->{'prefix'} . '/include', 51 'MYEXTLIB' => $opt->{'prefix'} . "/lib/libcego.$so* " 52 . $opt->{'prefix'} . "/lib/liblfcxml.$so* " 53 . $opt->{'prefix'} . "/lib/liblfcbase.$so", 54 "CC" => "c++", 55 "LD" => "c++", 56 "XSPROTOARG" => "-noprototypes", 57 'OPTIMIZE' => '-O3 -DNDEBUG=1', 58 'XSOPT' => '-C++', 59 'TYPEMAPS' => ['perlobject.map' ], 60 'LICENSE' => 'gpl3', 61 'clean' => { FILES => 'config.h' }, 62); 63 64sub Usage { 65 print STDERR <<"USAGE"; 66Usage: perl $0 [options] 67 68Possible options are: 69 70 --prefix=<prefix path> Use <prefix> for setting up the appropriate prefix path 71 to find cego libs and includes 72 73USAGE 74 exit 1; 75} 76 77package MY; 78sub top_targets { 79 my $class = shift; 80 my $default = $class->SUPER::top_targets; 81 $default =~ s/config :: Makefile/config :: Makefile config.h/; 82 83 return $default . <<'EOT'; 84EOT 85} 86 87sub postamble { 88 DBI::DBD::dbd_postamble(@_); 89} 90sub libscan { 91 my ($self, $path) = @_; 92 ($path =~ m/\~$/) ? undef : $path; 93} 94 95