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
10 eval "use Bio::Root::Build $v";
12 # using die so wrappers can catch the error message
13 die "BioPerl minimal core version $v is required for BioPerl-db\n";
16 # Set up the Bio::Root::Build object
17 my $build = Bio
::Root
::Build
->new(
19 dist_name
=> 'BioPerl-db',
21 dist_author
=> 'BioPerl Team <bioperl-l@bioperl.org>',
22 dist_abstract
=> 'BioPerl-db - package for biological databases',
26 #'Bio::Root::Version' => '1.007000', # checked above
30 create_makefile_pl
=> 'passthrough'
32 #pm_files => {} # modules in Bio are treated as if they were in lib and auto-installed
33 #script_files => [] # scripts in scripts directory are installed on-demand
38 $build->choose_scripts;
40 # Add extra things to MANIFEST.SKIP
41 $build->add_to_manifest_skip('t/DBHarness.biosql.conf');
43 # Create the build script and exit
44 $build->create_build_script;
49 # setup t/DBHarness.biosql.conf
51 $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";
53 my $config_file = File
::Spec
->catfile('t', 'DBHarness.biosql.conf');
54 if (-e
$config_file) {
55 $build->y_n("Do you want to use the existing '$config_file' config file? y/n", 'y') && return;
59 open(my $out, ">", $config_file) or die "Error: could not write to config file '$config_file'\n";
61 my %config = (driver
=> 'mysql',
68 schema_sql
=> '../biosql-schema/sql/biosqldb-mysql.sql');
70 $config{driver
} = $build->prompt("DBD driver to use (mandatory)?", $config{driver
});
71 $config{host
} = $build->prompt("Machine to connect to (mandatory)?", $config{host
});
72 $config{user
} = $build->prompt("User to connect to server as (mandatory)?", $config{user
});
74 $config{port
} = $build->prompt("Port the server is running on (optional, '' for undef/none)?", $config{port
});
75 $config{port
} = undef if $config{port
} eq "''";
77 $config{password
} = $build->prompt("Password (optional)?", $config{password
} || 'undef');
78 $config{password
} = '' if $config{password
} eq 'undef';
81 # The next answer will be used to identify the database name in
82 # the connect string, e.g., using database=, dbname=, or sid=,
83 # depending on the driver.
84 # If this is not set the test scripts will build a temporary
85 # database from scratch at the beginning and destroy it at the
86 # end. Conversely, if you do set it then the database must exist,
87 # or else the tests will fail.
88 # Generally, it is preferred to pre-build the database, simply for
89 # efficiency reasons, and it will also enable debugging your
90 # schema content if some test acts up.
92 $config{dbname
} = $build->prompt("Name of your existing Biosql database, as it is known to your RDBMS (optional, '' for none)?", $config{dbname
});
93 $config{dbname
} = '' if $config{dbname
} eq "''";
95 unless ($config{dbname
}) {
96 $config{schema_sql
} = $build->prompt("Set schema_sql to use the version appropriate for your RDBMS (mandatory)", $config{schema_sql
});
98 $config{schema_sql
} = "['$config{schema_sql}']"; # don't know why it is stored as an array ref, is this correct?
101 # The next answer does not refer to the schema or RDBMS; it only
102 # identifies which of the databases supported in bioperl-db you
103 # want to be using. Since at present bioperl-db only supports biosql,
104 # this must be biosql.
106 $config{database
} = $build->prompt("The name of the database within bioperl-db?", $config{database
});
109 while (my ($key, $val) = each %config) {
110 # no empty strings, undefined conf setting should be undef (w/o quotes)
111 $val = "'$val'" unless $key eq 'schema_sql' || !defined($val);
112 if (!defined($val)) {
115 print $out "\t'$key' => $val,\n";
120 # we deliberately don't add the config file to cleanup, but it shouldn't
121 # cause problems because it is in MANIFEST.SKIP