Permalink
Browse files

Move to Module::Build to get windows working.

This means we don't need to run ./configure in monotonic_clock's
directory any more.

We kind of hack Module::Build by passing in direct C files in c_source,
even though the docs state that it's for directories. But the way they
are finding files seems to work, at the cost of them passing in the
source files to the compiler as include directories :-). Luckily those
are just warnings.
  • Loading branch information...
caldwell committed Mar 3, 2015
1 parent ef6e513 commit e83419ac0fb46ac7d019ac66fa426abf2b54e36b
Showing with 51 additions and 61 deletions.
  1. +51 −0 Build.PL
  2. +0 −61 Makefile.PL
  3. 0 { → lib/Time}/Monotonic.xs
  4. 0 { → lib/Time}/ppport.h
View
@@ -0,0 +1,51 @@
use 5.008;
use strict;
use warnings FATAL => 'all';
use Module::Build;
use Config;
if (-d ".git") { # Are we in our development tree? If so, create MANIFEST.
my ($dir, $manifest);
open $manifest, ">", "MANIFEST" or die "MANIFEST: $!";
print $manifest "MANIFEST\n";
open $dir, 'git ls-files|' or die "Couldn't run git: $!";
while (<$dir>) { print $manifest $_ unless /^\.|^monotonic_clock/ }
open $dir, '-|', 'cd monotonic_clock && git ls-files' or die "Couldn't run git in monotonic_clock: $!";
while (<$dir>) { print $manifest "monotonic_clock/$_" unless /^\./ }
}
my $builder = Module::Build->new(
module_name => 'Time::Monotonic',
license => 'perl',
dist_author => 'David Caldwell <david@porkrind.org>',
dist_version_from => 'lib/Time/Monotonic.pm',
release_status => 'stable',
configure_requires => {
'Module::Build' => 0.3604,
},
build_requires => {
'Test::More' => 0,
},
meta_merge => {
resources => {
repository => 'https://github.com/caldwell/Time-Monotonic',
},
},
extra_compiler_flags => '-DHAVE_GETTIMEOFDAY', # We're going to assume everyone is at least that modern
include_dirs => 'monotonic_clock/include',
c_source => ['monotonic_clock/src/monotonic_common.c'],
);
# Add the appropriate platform-specific backend.
#
# This isn't as good as the configure script that comes with
# monotonic_clock, since it actually tests for the feature instead of
# assuming that non-darwin unixes support POSIX clock_gettime. On the other
# hand, this handles windows.
push(@{$builder->c_source},
$^O eq 'darwin' ? 'monotonic_clock/src/monotonic_mach.c' :
$builder->os_type() eq 'Windows' ? 'monotonic_clock/src/monotonic_win32.c' :
$builder->os_type() eq 'Unix' ? 'monotonic_clock/src/monotonic_clock.c' :
'monotonic_clock/src/monotonic_generic.c');
$builder->create_build_script();
View

This file was deleted.

Oops, something went wrong.
File renamed without changes.
File renamed without changes.

0 comments on commit e83419a

Please sign in to comment.