Fil-C on Nix

Filnix wiki

mbrock/filnix

ports/perl-modules.nix

Fixes for CPAN modules in the Fil-C Perl package set (an overrideScope overlay, see perl5 in ../ports.nix).

λself super
4InlineC=
super.InlineC.overrideAttrs
λold

This test's own typemap stores a pointer in an IV with a C cast and recovers it with INT2PTR, which Fil-C rightly refuses to dereference.

7postPatch=
old.postPatch or ""
+
"\n"
+
rm t/07typemap_multi.t
15JSON=
super.JSON.overrideAttrs

Nixpkgs pins the JSON::PP backend when cross compiling, assuming the other backends cannot be loaded; t/00_load_backport_pp.t then fails. The Fil-C perl loads modules as usual, so keep upstream's choice.

19preConfigure=
""
22FileShareDir=
super.FileShareDir.overrideAttrs

Nixpkgs strips File::ShareDir::Install from Makefile.PL when cross compiling, assuming the build perl cannot load it. Here the Fil-C perl runs on the build machine, and without the share install its tests find no auto/File/ShareDir/test_file.txt.

27postPatch=
""
30CompressBzip2=
super.CompressBzip2.overrideAttrs
λold

Objects are made with sv_setref_iv(PTR2IV(...)) but read back through T_PTROBJ, which decodes Fil-C's XS pointer table. Use the table both ways.

34postPatch=
old.postPatch or ""
+
"\n"
+
sed -i Bzip2.xs \
-e 's/sv_setref_iv( *\([^,]*\), *\([^,]*\), *PTR2IV(obj) *)/sv_setref_pv(\1, \2, (void *) obj)/' \
-e 's/INT2PTR(bzFile\*, *tmp)/(bzFile *) zptrtable_decode(Perl_xsub_ptrtable, tmp)/'
! grep -n 'PTR2IV(obj)\|INT2PTR(bzFile' Bzip2.xs
45AlienBuild=
super.AlienBuild.overrideAttrs
λold

The Fil-C runtime refuses handlers for SIGSEGV (and SIGBUS, SIGILL, SIGFPE, SIGTRAP), so this subtest's self-inflicted SEGV kills perl.

48postPatch=
old.postPatch or ""
+
"\n"
+
sed -i "/subtest 'with_subtest SEGV' => sub {/a\\ skip_all 'Fil-C reserves SIGSEGV';" t/test_alien.t
grep -q "Fil-C reserves SIGSEGV" t/test_alien.t
57DataUUID=
super.DataUUID.overrideAttrs
λold

sv_setref_pv stores the context through Fil-C's XS pointer table; the typemap read it back with INT2PTR.

60postPatch=
old.postPatch or ""
+
"\n"
+
substituteInPlace typemap --replace-fail \
'$var = INT2PTR($type,tmp);' \
'$var = ($type) zptrtable_decode(Perl_xsub_ptrtable, tmp);'
70Test2Harness=
super.Test2Harness.overrideAttrs
λold

The preload integration test kills its forked, preloaded runners with SIGTERM, which then report failure.

73postPatch=
old.postPatch or ""
+
"\n"
+
rm t/integration/preload.t
81XMLLibXML=
super.XMLLibXML.overrideAttrsold: patches = old.patches or [ ] ++ ../patches/perl-xml-libxml-ptrtable.patch;
87XMLParser=
super.XMLParser.overrideAttrs
λold
91postPatch=
old.postPatch or ""
+
"\n"
+
99Moo=
super.Moo.overrideAttrs
λold

Exercise Perl's MRO registry independently of Moo as well as retaining the upstream non-moo-extends-c3.t regression.

102postPatch=
old.postPatch or ""
+
"\n"
+
cp ${../patches/perl-mro-capabilities.t} t/ptrtable-mro.t