<commit_before>use v6;
use Panda::Common;
use Panda::Builder;
use Shell::Command;
use LibraryMake;

class Build is Panda::Builder {
    sub get_config_var(Str $name) {
        return chomp(qqx/python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('$name'));"/);
    }

    method build($dir) {
        my %vars = get-vars($dir);
        %vars<INCLUDEPY> = get_config_var('INCLUDEPY');
        my $library = get_config_var('LIBRARY');
        $library ~~ s/\.a$//;
        $library ~~ s/^lib//;
        %vars<LIBRARYPY> = $library;
        %vars<LIBPLPY> = get_config_var('LIBPL');
        %vars<pyhelper> = $*VM.platform-library-name('pyhelper'.IO);
        mkdir "$dir/resources" unless "$dir/resources".IO.e;
        mkdir "$dir/resources/libraries" unless "$dir/resources/libraries".IO.e;
        process-makefile('.', %vars);

        my $goback = $*CWD;
        chdir($dir);
        shell(%vars<MAKE>);
        chdir($goback);
    }
}

# vim: ft=perl6
<commit_msg>Try to make panda build match configure.pl6<commit_after>use v6;
use Panda::Common;
use Panda::Builder;
use Shell::Command;
use LibraryMake;

class Build is Panda::Builder {
    method build($dir) {
      my %vars = get-vars('.');

      %vars<pyhelper> = $*VM.platform-library-name('pyhelper'.IO);
      %vars<cflags> = chomp qx/python-config --cflags/;
      %vars<ldflags> = chomp qx/python-config --ldflags/;

      mkdir 'resources' unless 'resources'.IO.e;
      mkdir 'resources/libraries' unless 'resources/libraries'.IO.e;

      process-makefile('.', %vars);
      shell(%vars<MAKE>);
    }
}

# vim: ft=perl6

{'fraction_non_alphanumeric': 0.17089783281733747, 'fraction_numerical': 0.0030959752321981426, 'mean_word_length': 3.04, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1382129', 'n_tokens_mistral': 577, 'n_tokens_neox': 563, 'n_words': 109}