Skip to content

Commit 4980a0f

Browse files
committed
Merge pull request #122
Fix building on AppVeyor
2 parents 6a267a1 + 3cd436a commit 4980a0f

File tree

10 files changed

+137
-79
lines changed

10 files changed

+137
-79
lines changed

.gitignore

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
Makefile
2-
blib
3-
dbdimp.o
4-
MariaDB.bs
5-
MariaDB.c
6-
MariaDB.o
7-
MariaDB.xsi
8-
socket.o
9-
pm_to_blib
10-
t/MariaDB.mtest
11-
MYMETA.*
12-
*.tmp
13-
*.bak
14-
*.old
15-
INSTALL.html
16-
/DBD-MariaDB-*
1+
/*.exe
2+
/*.o
3+
/DBD-MariaDB-*.tar.gz
4+
/MYMETA.json
5+
/MYMETA.yml
6+
/Makefile
7+
/Makefile.old
8+
/MariaDB.bs
9+
/MariaDB.c
10+
/MariaDB.def
11+
/MariaDB.xsi
12+
/blib/
13+
/dll.base
14+
/dll.exp
15+
/pm_to_blib
16+
/t/MariaDB.mtest

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ before_script:
474474
export DBD_MARIADB_CONFIG="skip" ;
475475
fi ;
476476
elif [ -n "$DB" ]; then
477-
export DBD_MARIADB_CONFIG="$SANDBOX_HOME/msb/my sql_config" ;
477+
printf '#!/bin/sh\nexec %s/msb/my sql_config "$@"\n' $SANDBOX_HOME > "$HOME/mysql_config" ;
478+
chmod +x $HOME/mysql_config ;
479+
export DBD_MARIADB_CONFIG="$HOME/mysql_config" ;
478480
elif [ "$MYSQL_CONFIG" = "PIC" ]; then
479481
sed 's/-L\$pkglibdir *-lmysqld/-L\/usr\/lib\/mysql -lmysqld_pic /' `which mysql_config_pic` > "$HOME/mysql_config_pic" ;
480482
chmod +x $HOME/mysql_config_pic ;

MANIFEST.SKIP

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
\B\.git\b
2-
^blib\/
3-
pm_to_blib
4-
\~$
5-
^Makefile(\.old)?$
6-
.gitignore
7-
^DBD-MariaDB-\d
8-
\.bak$
9-
\.tmp$
10-
\.o$
11-
t/MariaDB.mtest
12-
^MYMETA
13-
MariaDB.c
14-
MariaDB.xsi
15-
MariaDB.bs
16-
appveyor.yml
17-
.mailmap
18-
.travis.yml
1+
^.*\.exe$
2+
^.*\.o$
3+
^DBD-MariaDB-.*\.tar\.gz$
4+
^MYMETA\.json$
5+
^MYMETA\.yml$
6+
^Makefile$
7+
^Makefile\.old$
8+
^MariaDB\.bs$
9+
^MariaDB\.c$
10+
^MariaDB\.def$
11+
^MariaDB\.xsi$
12+
^\.git/.*$
13+
^\.gitignore$
14+
^\.mailmap$
15+
^\.travis\.yml$
16+
^appveyor\.yml$
17+
^blib/.*$
18+
^dll\.base$
19+
^dll\.exp$
20+
^pm_to_blib$
21+
^t/MariaDB\.mtest$

Makefile.PL

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ require DBI::DBD;
1616

1717
my $TESTDB = "test";
1818

19+
# On WIN32 windows.h and winsock.h need to be included before mysql.h
20+
# Otherwise SOCKET type which is needed for mysql.h is not defined
21+
my @mysql_headers;
22+
push @mysql_headers, 'windows.h', 'winsock.h' if $^O eq 'MSWin32';
23+
push @mysql_headers, 'mysql.h';
24+
1925
our $opt = { "help" => \&Usage, };
2026

2127
my ($test_host, $test_port, $test_socket);
@@ -68,7 +74,7 @@ my $source = {};
6874
if ($opt->{'mysql_config'} ne 'skip') {
6975
$opt->{'mysql_config'} = Win32::GetShortPathName($opt->{'mysql_config'})
7076
if $^O eq 'MSWin32';
71-
if (! defined `$opt->{'mysql_config'} 2>&1`)
77+
if (!CanExecute($opt->{'mysql_config'}))
7278
{
7379
die <<"MSG";
7480
@@ -80,11 +86,11 @@ MSG
8086
}
8187
else
8288
{
83-
if (defined `mariadb_config 2>&1`)
89+
if (CanExecute("mariadb_config"))
8490
{
8591
$opt->{'mysql_config'} = "mariadb_config";
8692
}
87-
elsif (defined `mysql_config 2>&1`)
93+
elsif (CanExecute("mysql_config"))
8894
{
8995
$opt->{'mysql_config'} = "mysql_config";
9096
}
@@ -223,7 +229,7 @@ assert_lib(
223229
LIBS => (join ' ', @libdirs, $main_lib, @libs),
224230
ccflags => (join ' ', $opt->{cflags}, ($Config{usedl} ? $Config{cccdlflags} : ())),
225231
ldflags => (join ' ', @libdirs, @ldflags, ($Config{usedl} ? $Config{lddlflags} : ())),
226-
header => 'mysql.h',
232+
header => \@mysql_headers,
227233
not_execute => 1,
228234
);
229235

@@ -233,7 +239,7 @@ check_lib(
233239
LIBS => (join ' ', @libdirs, $main_lib),
234240
ccflags => $opt->{cflags},
235241
ldflags => (join ' ', @libdirs, @libs, @ldflags),
236-
header => 'mysql.h',
242+
header => \@mysql_headers,
237243
function => "\n#ifndef MYSQL_VERSION_ID\n#include <mysql_version.h>\n#endif\nreturn (MYSQL_VERSION_ID >= 40108) ? 0 : 1;\n",
238244
) or die <<"MSG";
239245
@@ -248,7 +254,7 @@ my $have_embedded = check_lib(
248254
LIBS => (join ' ', @libdirs, $main_lib),
249255
ccflags => $opt->{cflags},
250256
ldflags => (join ' ', @libdirs, @libs, @ldflags),
251-
header => 'mysql.h',
257+
header => \@mysql_headers,
252258
function => 'return mysql_embedded() ? 0 : 1;',
253259
);
254260

@@ -258,23 +264,23 @@ my $have_get_charset_number = check_lib(
258264
LIBS => (join ' ', @libdirs, $main_lib),
259265
ccflags => $opt->{cflags},
260266
ldflags => (join ' ', @libdirs, @libs, @ldflags),
261-
header => 'mysql.h',
267+
header => \@mysql_headers,
262268
function => 'unsigned int get_charset_number(const char *cs_name, unsigned int cs_flags); mysql_server_init(-1, 0, 0); get_charset_number("utf8", 32); return 0;',
263269
);
264270

265271
my $have_get_option = check_lib(
266272
LIBS => (join ' ', @libdirs, $main_lib),
267273
ccflags => $opt->{cflags},
268274
ldflags => (join ' ', @libdirs, @libs, @ldflags),
269-
header => 'mysql.h',
275+
header => \@mysql_headers,
270276
function => 'MYSQL mysql; char buf[1024]; mysql_server_init(-1, 0, 0); mysql_init(&mysql); mysql_get_option(&mysql, 0, &buf); return 0;',
271277
);
272278

273279
my $have_deinitialize_ssl = check_lib(
274280
LIBS => (join ' ', @libdirs, $main_lib),
275281
ccflags => $opt->{cflags},
276282
ldflags => (join ' ', @libdirs, @libs, @ldflags),
277-
header => 'mysql.h',
283+
header => \@mysql_headers,
278284
function => 'mariadb_deinitialize_ssl = 0; return 0;',
279285
);
280286

@@ -416,7 +422,7 @@ if (eval { ExtUtils::MakeMaker->VERSION(5.43) }) {
416422
prereqs => {
417423
test => {
418424
recommends => {
419-
'Net::SSLeay' => 0,
425+
'Net::SSLeay' => '1.43',
420426
'Proc::ProcessTable' => 0,
421427
'TAP::Harness' => '3.31',
422428
'CPAN::Meta::YAML' => 0,
@@ -525,13 +531,23 @@ USAGE
525531
}
526532

527533

534+
sub CanExecute {
535+
my ($command) = @_;
536+
return MM->maybe_command($command) if File::Spec->file_name_is_absolute($command);
537+
foreach my $dir (File::Spec->path) {
538+
return 1 if MM->maybe_command(File::Spec->catfile($dir, $command));
539+
}
540+
return 0;
541+
}
542+
543+
528544
my %ParsedCache;
529545
sub ParseMySQLConfig {
530546
my ($opt, $param) = @_;
531547
return $ParsedCache{$param} if exists $ParsedCache{$param};
532548
return undef unless $opt->{'mysql_config'} and $opt->{'mysql_config'} ne 'skip';
533549
my $output = `$opt->{'mysql_config'} --$param 2>&1`;
534-
if (defined $output and $output !~ /Options:|Usage:|unrecognized option/) {
550+
if ($? == 0 and defined $output and $output !~ /Options:|Usage:|unrecognized option/) {
535551
$output =~ s/\s+$//s;
536552
$output =~ s/^\s+//s;
537553
$ParsedCache{$param} = $output;
@@ -611,7 +627,7 @@ sub Configure {
611627
LIBS => (join ' ', @libdirs, $main_lib),
612628
ldflags => (join ' ', @libdirs, $ldflags, $Config{lddlflags}),
613629
ccflags => (join ' ', $opt->{cflags}, $Config{cccdlflags}),
614-
header => 'mysql.h',
630+
header => \@mysql_headers,
615631
function => $function,
616632
not_execute => 1,
617633
) or next;
@@ -621,7 +637,7 @@ sub Configure {
621637
LIBS => (join ' ', @libdirs, $main_lib),
622638
ldflags => (join ' ', @libdirs, $ldflags),
623639
ccflags => $opt->{cflags},
624-
header => 'mysql.h',
640+
header => \@mysql_headers,
625641
function => $function,
626642
) or next;
627643
$str .= ' ' . $add_ldflags if defined $add_ldflags;

MariaDB.xs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ BOOT:
6868
* See: https://github.com/gooddata/DBD-MariaDB/issues/119 */
6969
mariadb_deinitialize_ssl = 0;
7070
#endif
71+
#ifndef _WIN32
72+
/* Calling mysql_thread_init() on WIN32 cause crash */
7173
mysql_thread_init();
74+
#endif
7275
}
7376

7477
MODULE = DBD::MariaDB PACKAGE = DBD::MariaDB::db

README.pod

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
=head1 DBD::MariaDB - database driver for Perl
22

3-
=for html <a href="https://travis-ci.org/gooddata/DBD-MariaDB"><img src="https://travis-ci.org/gooddata/DBD-MariaDB.svg?branch=master"></a>
3+
=begin html
4+
5+
<p>
6+
<a href="https://travis-ci.org/gooddata/DBD-MariaDB/branches">
7+
<img src="https://travis-ci.org/gooddata/DBD-MariaDB.svg?branch=master"
8+
alt="Travis CI Build Status"></a>
9+
<a href="https://ci.appveyor.com/project/gooddata/dbd-mariadb/branch/master">
10+
<img src="https://ci.appveyor.com/api/projects/status/github/gooddata/dbd-mariadb?branch=master&amp;svg=true"
11+
alt="AppVeyor Build Status"></a>
12+
</p>
13+
14+
=end html
415

516
This is the Perl L<DBI> driver for access to MariaDB and MySQL databases.
617

appveyor.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,55 @@ cache:
66

77
environment:
88
matrix:
9+
- perl: "5.8.9.5"
10+
- perl: "5.10.1.5"
11+
- perl: "5.12.3.20180709"
912
- perl: "5.14.4.1"
1013
- perl: "5.16.3.20170202"
1114
- perl: "5.18.4.1"
1215
- perl: "5.20.3.3"
1316
- perl: "5.22.3.1"
14-
- perl: "5.24.1.1"
15-
- perl: "5.26.0.1"
17+
- perl: "5.24.4.1"
18+
- perl: "5.26.2.1"
19+
- perl: "5.28.0.1"
1620

1721
platform:
1822
- x86
1923
- x64
2024

25+
matrix:
26+
exclude:
27+
- platform: x64
28+
perl: "5.8.9.5"
29+
- platform: x64
30+
perl: "5.10.1.5"
31+
2132
services:
2233
- mysql
2334

2435
install:
36+
- ren C:\MinGW MinGW_do_not_use
37+
- ren C:\Perl Perl_do_not_use
38+
- ren "C:\\Program Files\\Git\\usr\\bin\\perl.exe" perl.exe_do_not_use
2539
- if /I %PLATFORM% == x86 (set x86=--forcex86) else (set "x86= ")
2640
- choco config set cacheLocation C:\ProgramData\chocolatey\cache
2741
- cinst StrawberryPerl --version %perl% %x86% --allow-empty-checksums
28-
- path C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\strawberry\c\bin;%PATH%
42+
- refreshenv
2943
- perl -V
3044
- cpan -T App::cpanminus
31-
- cpanm --quiet --notest --skip-satisfied Devel::CheckLib
45+
- perl -MExtUtils::MakeMaker=6.58 -e "" || cpanm --quiet --notest ExtUtils::[email protected]
46+
- cpanm --quiet --notest --skip-satisfied DBI~1.608 Devel::CheckLib~1.12
3247
- cpanm --quiet --notest --skip-satisfied --installdeps --with-configure --with-develop --with-recommends --with-suggests .
3348

3449
build_script:
35-
- perl Makefile.PL --mysql_config=c:\strawberry\c\bin\mysql_config.bat --testuser=root --testpassword=Password12!
50+
- set DBD_MARIADB_TESTUSER=root
51+
- set DBD_MARIADB_TESTPASSWORD=Password12!
52+
- perl -MConfig -e "system({$Config{make}} $Config{make}, @ARGV); exit((($? >> 8) | ($? & 127)) & 255)" realclean || (exit 0)
53+
- perl Makefile.PL
3654
- perl -MConfig -e "system({$Config{make}} $Config{make}, @ARGV); exit((($? >> 8) | ($? & 127)) & 255)"
3755

3856
test_script:
57+
- set HARNESS_OPTIONS=j4
58+
- set RELEASE_TESTING=1
3959
- set CONNECTION_TESTING=1
4060
- perl -MConfig -e "system({$Config{make}} $Config{make}, @ARGV); exit((($? >> 8) | ($? & 127)) & 255)" test

dbdimp.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,27 @@
1717
/*
1818
* Header files we use
1919
*/
20-
#include <DBIXS.h> /* installed by the DBI module */
20+
21+
/*
22+
* On WIN32 windows.h and winsock.h need to be included before mysql.h
23+
* Otherwise SOCKET type which is needed for mysql.h is not defined
24+
*/
25+
#ifdef _WIN32
26+
#include <windows.h>
27+
#include <winsock.h>
28+
#endif
29+
2130
#include <mysql.h> /* Comes with MySQL-devel */
2231
#include <mysqld_error.h> /* Comes MySQL */
23-
2432
#include <errmsg.h> /* Comes with MySQL-devel */
25-
#include <stdint.h> /* For uint32_t */
2633

2734
#ifndef MYSQL_VERSION_ID
2835
#include <mysql_version.h> /* Comes with MySQL-devel */
2936
#endif
3037

38+
#include <DBIXS.h> /* installed by the DBI module */
39+
#include <stdint.h> /* For uint32_t */
40+
3141
#if !defined(MARIADB_BASE_VERSION) && defined(MARIADB_PACKAGE_VERSION)
3242
#define MARIADB_BASE_VERSION
3343
#endif

0 commit comments

Comments
 (0)