s/Build/Makefile/
[gitmo/Moose.git] / Makefile.PL
index efc9f62..b338413 100644 (file)
@@ -1,79 +1,76 @@
 use strict;
 use warnings;
-use inc::Module::Install;
-use 5.008001;
-
-check_conflicts();
-
-name 'Moose';
-perl_version '5.008001';
-all_from 'lib/Moose.pm';
-license 'perl';
-
-requires 'Carp';
-requires 'Class::MOP'       => '0.92_01';
-requires 'Data::OptList'    => '0';
-requires 'List::MoreUtils'  => '0.12';
-requires 'Scalar::Util'     => '1.19';
-requires 'Sub::Exporter'    => '0.980';
-requires 'Sub::Name'        => '0';
-requires 'Task::Weaken'     => '0';
-requires 'Try::Tiny'        => '0.02';
-
-test_requires 'Test::More'      => '0.88';
-test_requires 'Test::Exception' => '0.27';
-
-if ( -d '.svn' || -d '.git' || $ENV{IS_MAINTAINER} ) {
-    system( $^X, 'author/extract-inline-tests' );
-}
-
-extra_tests();
-tests_recursive();
-
-WriteAll();
-
-# Use the cpan-smolder-stable script in the Moose svn root to figure
-# out what on CPAN will break with the latest Moose, then update this
-# before a release.
-sub check_conflicts {
-    my %conflicts = (
-        'MooseX::ClassAttribute'    => '0.09',
-        'MooseX::Singleton'         => '0.19',
-        'MooseX::StrictConstructor' => '0.07',
-        'MooseX::Params::Validate'  => '0.05',
-        'Fey::ORM'                  => '0.23',
-        'MooseX::Types'             => '0.10',
-    );
 
-    my $found = 0;
-    for my $mod ( sort keys %conflicts ) {
-        eval "require $mod";
-        next if $@;
+use Config;
+use ExtUtils::MakeMaker;
 
-        my $installed = $mod->VERSION();
-        if ( $installed le $conflicts{$mod} ) {
+warn <<'EOF';
 
-            print <<"EOF";
+  ********************************* WARNING **********************************
 
-***
-    This version of Moose conflicts with the version of
-    $mod ($installed) you have installed.
+  This module uses Dist::Zilla for development. This Makefile.PL will let you
+  run the tests, but you are encouraged to install Dist::Zilla and the needed
+  plugins if you intend on doing any serious hacking.
 
-    You will need to upgrade $mod after installing
-    this version of Moose.
-***
+  ****************************************************************************
 
 EOF
 
-            $found = 1;
-        }
+my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
+$ccflags .= ' -Wall -Wdeclaration-after-statement';
+
+my %mm = ( CCFLAGS => $ccflags );
+
+{
+    my (@OBJECT, %XS);
+
+    for my $xs (<xs/*.xs>) {
+        (my $c = $xs) =~ s/\.xs$/.c/i;
+        (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
+
+        $XS{$xs} = $c;
+        push @OBJECT, $o;
     }
 
-    return unless $found;
+    for my $c (<*.c>) {
+        (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
+        push @OBJECT, $o;
+    }
+
+    %mm = (
+        %mm,
+        clean => { FILES => join( q{ }, @OBJECT ) },
+        OBJECT => join( q{ }, @OBJECT ),
+        XS     => \%XS,
+    );
+}
+
+WriteMakefile(
+    NAME => 'Moose',
+    %mm,
+);
+
+package MY;
+
+use Config;
+
+sub const_cccmd {
+    my $ret = shift->SUPER::const_cccmd(@_);
+    return q{} unless $ret;
 
-    # More or less copied from Module::Build
-    return if  $ENV{PERL_MM_USE_DEFAULT};
-    return unless -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
+    if ($Config{cc} =~ /^cl\b/i) {
+        warn 'you are using MSVC... my condolences.';
+        $ret .= ' /Fo$@';
+    }
+    else {
+        $ret .= ' -o $@';
+    }
 
-    sleep 4;
+    return $ret;
+}
+
+sub postamble {
+    return <<'EOF';
+$(OBJECT) : mop.h
+EOF
 }