| | 97 | unlink (my $build_config = 'current.build.yml'); |
| | 98 | |
| | 99 | my $find_ver = sub { |
| | 100 | `$_[0] $_ 2>&1` =~ /(.* (?:version|build) .*)/i && return $1 |
| | 101 | for qw{--version -v -V -? /?}; |
| | 102 | return "unknown"; |
| | 103 | }; |
| | 104 | my $config = get_pugs_config( |
| | 105 | uname => join (" ", (uname)[0,2,4] ), |
| | 106 | regex_engine => ( $ENV{PUGS_REGEX_ENGINE} ? $ENV{PUGS_REGEX_ENGINE} : 'default' ), |
| | 107 | embed_flags => 'noparrot nohaskell', |
| | 108 | # embedded => join (" ", ( $embed_flags =~ /HAVE_PERL5/ ? $Config{perlpath} : 'noperl' ), |
| | 109 | # ( $embed_flags =~ /HAVE_PARROT/ |
| | 110 | # ? abs_path( File::Spec->catfile( "$ENV{PARROT_PATH}", "parrot" ) ) |
| | 111 | # : 'noparrot' ), |
| | 112 | # ( $ENV{PUGS_EMBED} =~ /\bhaskell\b/ ? $ghc : 'nohaskell' ) |
| | 113 | # ), |
| | 114 | # ghc => join (" ", [ assert_ghc() ]->[0], $ghc_version, |
| | 115 | # ( $ghc_flags =~ /HAVE_READLINE/ ? 'readline' : 'noreadline' ), |
| | 116 | # ( $ghc_flags =~ /HAVE_HSPLUGINS/ ? 'hsplugins' : 'nohsplugins' ), |
| | 117 | # ( $threaded ? "threads" : "nothreads" ), |
| | 118 | # ), |
| | 119 | ghc => 'noreadline nohsplugins nothreads', |
| | 120 | cc => $find_ver->( $Config{cc} ), |
| | 121 | ); |
| | 122 | |
| | 123 | { |
| | 124 | # maybe move this to inc/PugsBuild/MiniYAML.pm ? |
| | 125 | open my $fh, '>', $build_config or die "Cannot open $build_config for writing"; |
| | 126 | print $fh "# *** NOTE ***\n"; |
| | 127 | print $fh "# This file is generated during Makefile.PL.\n"; |
| | 128 | print $fh "# Changes will not persist after running Makefile.PL\n"; |
| | 129 | for ( sort keys %$config ) { |
| | 130 | print $fh "$_: $config->{$_}\n"; |
| | 131 | } |
| | 132 | close $fh; |
| | 133 | } |
| | 134 | |