3 # This is a Module::Build script for bioperl-db installation.
4 # See http://search.cpan.org/~kwilliams/Module-Build/lib/Module/Build.pm
6 # Uses a custom subclass of Module::Build called Bio::Root::Build
12 # Set up the Bio::Root::Build object
13 my $build = Module
::Build
->new(
15 dist_name
=> 'BioPerl-db',
16 dist_version
=> '1.006009',
17 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
18 dist_abstract
=> 'BioPerl-db - package for biological databases',
22 'Bio::Root::Version' => '1.006000', # checked above
26 create_makefile_pl
=> 'passthrough'
28 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
29 #script_files => [] # scripts in scripts directory are installed on-demand
36 #$build->choose_scripts;
38 # Create the build script and exit
39 $build->create_build_script;
43 # setup t/DBHarness.biosql.conf
45 $build->y_n("Have you already installed BioSQL? y/n", 'n') || die "\nBioSQL must be installed prior to installation of bioperl-db; see the INSTALL file\n";
47 my $config_file = File
::Spec
->catfile('t', 'DBHarness.biosql.conf');
48 if (-e
$config_file) {
49 $build->y_n("Do you want to use the existing '$config_file' config file? y/n", 'y') && return;
53 open(my $out, ">", $config_file) or die "Error: could not write to config file '$config_file'\n";
55 my %config = (driver
=> 'mysql',
62 schema_sql
=> '../biosql-schema/sql/biosqldb-mysql.sql');
64 $config{driver
} = $build->prompt("DBD driver to use (mandatory)?", $config{driver
});
65 $config{host
} = $build->prompt("Machine to connect to (mandatory)?", $config{host
});
66 $config{user
} = $build->prompt("User to connect to server as (mandatory)?", $config{user
});
68 $config{port
} = $build->prompt("Port the server is running on (optional, '' for undef/none)?", $config{port
});
69 $config{port
} = undef if $config{port
} eq "''";
71 $config{password
} = $build->prompt("Password (optional)?", $config{password
} || 'undef');
72 $config{password
} = '' if $config{password
} eq 'undef';
75 # The next answer will be used to identify the database name in
76 # the connect string, e.g., using database=, dbname=, or sid=,
77 # depending on the driver.
78 # If this is not set the test scripts will build a temporary
79 # database from scratch at the beginning and destroy it at the
80 # end. Conversely, if you do set it then the database must exist,
81 # or else the tests will fail.
82 # Generally, it is preferred to pre-build the database, simply for
83 # efficiency reasons, and it will also enable debugging your
84 # schema content if some test acts up.
86 $config{dbname
} = $build->prompt("Name of your existing Biosql database, as it is known to your RDBMS (optional, '' for none)?", $config{dbname
});
87 $config{dbname
} = '' if $config{dbname
} eq "''";
89 unless ($config{dbname
}) {
90 $config{schema_sql
} = $build->prompt("Set schema_sql to use the version appropriate for your RDBMS (mandatory)", $config{schema_sql
});
92 $config{schema_sql
} = "['$config{schema_sql}']"; # don't know why it is stored as an array ref, is this correct?
95 # The next answer does not refer to the schema or RDBMS; it only
96 # identifies which of the databases supported in bioperl-db you
97 # want to be using. Since at present bioperl-db only supports biosql,
98 # this must be biosql.
100 $config{database
} = $build->prompt("The name of the database within bioperl-db?", $config{database
});
103 while (my ($key, $val) = each %config) {
104 # no empty strings, undefined conf setting should be undef (w/o quotes)
105 $val = "'$val'" unless $key eq 'schema_sql' || !defined($val);
106 if (!defined($val)) {
109 print $out "\t'$key' => $val,\n";
114 # we deliberately don't add the config file to cleanup, but it shouldn't
115 # cause problems because it is in MANIFEST.SKIP