Alien-DuckDB
view release on metacpan or search on metacpan
elsif ($basename =~ /\.(?:$binary_suffix|a|lib)$/i) {
path($file)->copy("$lib_dir/$basename");
$lib_count++;
}
}
log "Copied $header_count header files and $lib_count library files to standard locations";
# If we're on Windows, create a dummy pkg-config file to satisfy the PkgConfig plugin
if ($^O eq 'MSWin32') {
my $pkgconfig_dir = path("$prefix/lib/pkgconfig");
$pkgconfig_dir->mkpath;
my $pc_file = path("$pkgconfig_dir/libduckdb.pc");
my $pc_content = <<EOT;
prefix=$prefix
exec_prefix=\${prefix}
libdir=\${prefix}/lib
includedir=\${prefix}/include
Name: libduckdb
Description: DuckDB database library
Version: $duckdb_version
Cflags: -I\${includedir}
Libs: -L\${libdir} -lduckdb
EOT
$pc_file->spew($pc_content);
log "Created pkg-config file: $pc_file";
}
};
# Windows-specific hook to ensure properties are set correctly
if ($^O eq 'MSWin32') {
meta->around_hook(
gather_share => sub {
my ($orig, $build) = @_;
# Skip the original gather_share if it's likely to fail on Windows
eval { $orig->($build) };
if ($@) {
log "Original gather_share hook failed, using direct property setting";
}
# Get the installation directory
my $prefix = $build->install_prop->{prefix};
log "Setting runtime properties for installation in $prefix";
# Set properties directly without using pkg-config
$build->runtime_prop->{version} = $duckdb_version;
$build->runtime_prop->{cflags} = "-I$prefix/include";
$build->runtime_prop->{libs} = "-L$prefix/lib -lduckdb";
# Debug output
log "VERSION: " . $build->runtime_prop->{version};
log "CFLAGS: " . $build->runtime_prop->{cflags};
log "LIBS: " . $build->runtime_prop->{libs};
# Check if files exist where expected
log "Header exists: " . (-e "$prefix/include/duckdb.h" ? "YES" : "NO");
my @libs = glob("$prefix/lib/*duck*");
log "Libraries: " . join(", ", @libs);
},
);
}
else {
# Standard hook for other platforms
meta->around_hook(
gather_share => sub {
my ($orig, $build) = @_;
$orig->($build);
# Get the installation directory
my $prefix = $build->install_prop->{prefix};
log "Setting runtime properties for installation in $prefix";
# Set properties directly
$build->runtime_prop->{version} = $duckdb_version;
$build->runtime_prop->{cflags} = "-I$prefix/include";
$build->runtime_prop->{libs} = "-L$prefix/lib -lduckdb";
# Debug output
log "VERSION: " . $build->runtime_prop->{version};
log "CFLAGS: " . $build->runtime_prop->{cflags};
log "LIBS: " . $build->runtime_prop->{libs};
# Check if files exist where expected
log "Header exists: " . (-e "$prefix/include/duckdb.h" ? "YES" : "NO");
my @libs = glob("$prefix/lib/*duck*");
log "Libraries: " . join(", ", @libs);
},
);
}
};
( run in 0.737 second using v1.01-cache-2.11-cpan-1236ad508bc )