use alienfile;

#our $VERSION = 0.022_000;
 
plugin 'PkgConfig' => (
    # NEED ANSWER: which should we be using below?
    pkg_name =>'libpcre2-8',
#    pkg_name =>'libpcre2-16',
#    pkg_name =>'libpcre2-32',
    # NOTE Setting minimum_version to 10.34 due to
    # <https://nvd.nist.gov/vuln/detail/CVE-2019-20454>.
    minimum_version =>
        exists $ENV{ALIEN_PCRE2_MIN_VERSION}
        ? $ENV{ALIEN_PCRE2_MIN_VERSION}
        : '10.34',
);
 
share {
    plugin 'Download::GitHub' => (
        github_user => 'PhilipHazel',
        github_repo => 'pcre2',

        asset        => 1,
        asset_name   => qr/^pcre2-.*\.tar\.gz$/,
        asset_format => 'tar.gz',

#        version => qr/([0-9\.]+)/,  # error, prefers 10.21 over 10.23
        version => qr/^pcre2-([0-9\.]+)/,
    );
    plugin 'Build::Autoconf' => ();
    build [
#        '%{configure} --enable-pcre2-16 --enable-pcre2-32 --disable-shared',
        '%{configure} --enable-pcre2-16 --enable-pcre2-32 --disable-shared --enable-jit',  # NEED ANSWER: what hardware is not supported for JIT???
#        '%{make}',
#        '%{make} install',
#        '%{dmake}',
#        '%{dmake} install',
        '%{gmake} noinst_PROGRAMS=',
        '%{gmake} install noinst_PROGRAMS=',
    ];
};
