perlPackages.DBI: Stub out dbd_postamble for cross-compilation.

This commit is contained in:
Shea Levy 2018-02-28 12:09:14 -05:00
parent 306d5cdf03
commit dd6c926362
No known key found for this signature in database
GPG Key ID: 5C0BD6957D86FE27
2 changed files with 42 additions and 2 deletions

View File

@ -186,7 +186,8 @@ for a module may (indirectly) import a native module. In that case,
you will need to make a stub for that module that will satisfy the
Makefile.PL and install it into
<filename>lib/perl5/site_perl/cross_perl/${perl.version}</filename>.
</para>
See the <varname>postInstall</varname> for <varname>DBI</varname> for
an example.</para>
</section>

View File

@ -3835,11 +3835,50 @@ let self = _self // overrides; _self = with self; {
};
DBI = buildPerlPackage rec {
name = "DBI-1.636";
name = "DBI-${version}";
version = "1.6.36";
src = fetchurl {
url = "mirror://cpan/authors/id/T/TI/TIMB/${name}.tar.gz";
sha256 = "8f7ddce97c04b4b7a000e65e5d05f679c964d62c8b02c94c1a7d815bb2dd676c";
};
postInstall = stdenv.lib.optionalString (perl ? crossVersion) ''
mkdir -p $out/lib/perl5/site_perl/cross_perl/${perl.version}/DBI
cat > $out/lib/perl5/site_perl/cross_perl/${perl.version}/DBI.pm <<EOF
package DBI;
BEGIN {
our \$VERSION = "$version";
}
1;
EOF
autodir=$(echo $out/lib/perl5/site_perl/${perl.version}/*/auto/DBI)
cat > $out/lib/perl5/site_perl/cross_perl/${perl.version}/DBI/DBD.pm <<EOF
package DBI::DBD;
use Exporter ();
use vars qw (@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(dbd_postamble);
sub dbd_postamble {
return '
# --- This section was generated by DBI::DBD::dbd_postamble()
DBI_INSTARCH_DIR=$autodir
DBI_DRIVER_XST=$autodir/Driver.xst
# The main dependency (technically correct but probably not used)
\$(BASEEXT).c: \$(BASEEXT).xsi
# This dependency is needed since MakeMaker uses the .xs.o rule
\$(BASEEXT)\$(OBJ_EXT): \$(BASEEXT).xsi
\$(BASEEXT).xsi: \$(DBI_DRIVER_XST) $autodir/Driver_xst.h
\$(PERL) -p -e "s/~DRIVER~/\$(BASEEXT)/g" \$(DBI_DRIVER_XST) > \$(BASEEXT).xsi
# ---
';
}
1;
EOF
'';
meta = {
homepage = http://dbi.perl.org/;
description = "Database independent interface for Perl";