use inc::Module::Install; use Config; name 'IO-Pty-HalfDuplex'; all_from 'lib/IO/Pty/HalfDuplex.pm'; repository 'http://github.com/sorear/IO-Pty-HalfDuplex'; requires 'IO::Pty'; requires 'Time::HiRes'; my @chunks; # XXX it would be nice if we could usefully probe for what works, but # the source files need #ifdefs of their own # be careful here; arch names depend on OS # linux stupidly uses CPU model name. who wants to regex every x86 model? push @chunks, 'ptrace' if $^O eq 'freebsd' && $Config{archname} =~ /i386|amd64/; push @chunks, 'sysctl' if grep { $_ eq $^O } qw/freebsd netbsd openbsd/; my @object; my @c; my $xs = ''; for my $chunk (@chunks) { push @c, "$chunk.c"; push @object, "$chunk$Config{_o}"; local $/; open FRAGMENT, "$chunk.xsf" or die "Failed to open fragment $chunk.xsf: $!"; $xs .= "\n" . ; close FRAGMENT; } print "We are building ", (@chunks ? "with: " . join(", ", @chunks) : "without XS") . ".\n"; if ($xs) { open XS, ">HalfDuplex.xs" or die "Failed to open xs-file for output: $!"; print XS <
join(" ",@object), C => \@c); WriteAll;