Alien-curlimpersonate

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    Alien::curlimpersonate - build and find libcurl-impersonate

SYNOPSIS
    In your Makefile.PL:

        use ExtUtils::MakeMaker;
        use Alien::Base::Wrapper ();
        use Alien::curlimpersonate ();

        my %args = Alien::Base::Wrapper->new('Alien::curlimpersonate')->mm_args2;

        # See "LINKING AGAINST IT" below: the wrapper emits no rpath, so add one.
        my ($libdir) = Alien::curlimpersonate->dynamic_libs;
        $libdir =~ s{/[^/]+$}{} if defined $libdir;
        $args{LDDLFLAGS} = join ' ', grep { defined && length }
            $args{LDDLFLAGS}, ($libdir ? "-Wl,-rpath,$libdir" : ());

        WriteMakefile(NAME => 'My::Module', %args);

    Or just to see what was built:

        use Alien::curlimpersonate;
        say Alien::curlimpersonate->cflags;        # -I/.../include
        say Alien::curlimpersonate->libs;          # -L/.../lib -lcurl-impersonate
        say for Alien::curlimpersonate->dynamic_libs;

DESCRIPTION
    Builds curl-impersonate (a patched libcurl with a bundled BoringSSL)
    from source and exposes its cflags/libs, so an XS module can link a
    libcurl that reproduces a real browser's TLS and HTTP/2 fingerprint --
    JA3/JA4 and the HTTP/2 SETTINGS "Akamai" fingerprint -- rather than the
    one libcurl would otherwise present. See Curl::Impersonate for a Perl
    client built on it.

    This is a source-only Alien: there is no system package of
    libcurl-impersonate to find, so the probe always selects a "share"
    install and the library is compiled at install time. See "SYSTEM
    REQUIREMENTS", because that build is neither short nor dependency-free.

    The pinned version is v2.2.2, built from
    <https://github.com/lexiforest/curl-impersonate> itself. It is an exact
    tag rather than the newest one: upstream 2.0.0 replaced autotools with a
    CMake superbuild, and the target names this library is asked for are
    load-bearing in whatever links it, so neither is left to float.

SYSTEM REQUIREMENTS
    curl-impersonate statically builds BoringSSL, zlib, zstd, brotli,
    nghttp2 and ngtcp2 alongside curl itself. That needs, on top of a C and
    C++ compiler:

    *   "git" -- the source is fetched by cloning the upstream repository

    *   "cmake" 3.20 or newer -- the build is a CMake superbuild.
        Alien::cmake3 supplies one where the system has none, but it
        promises only 3.x, so the version is checked before the build
        starts.

    *   "ninja" (or "ninja-build") -- the curl subproject forces the Ninja
        generator

    *   "go" -- BoringSSL's build generates sources with it

    *   "patch" -- upstream patches curl and its dependencies

    *   "curl" and "make" -- libidn2 is fetched and built by a shell script,
        separately from CMake, because CMake requires it prebuilt and will
        not build it

    The build checks for these before it starts and names anything missing,
    rather than failing deep inside a compile. On Debian or Ubuntu:

        apt-get install git cmake ninja-build golang-go patch curl build-essential

    Expect the install to take several minutes -- around five or six on a
    current machine, and longer on a slow or loaded one. It is a full
    BoringSSL and curl build, which is why installing this dist takes far
    longer than the Perl code in it would suggest.

METHODS
    This is an Alien::Base subclass and adds nothing of its own; the useful
    methods are inherited. The ones that matter here:

    "Alien::curlimpersonate->cflags"
        The include flags, as "-I$prefix/include".

    "Alien::curlimpersonate->libs"
        The link flags, as "-L$prefix/lib -lcurl-impersonate". No rpath --
        see below.

    "Alien::curlimpersonate->dynamic_libs"
        The shared library file paths -- not directories, and including the
        versioned names. The order is not defined, but they all live in the
        same directory, so taking that of any one of them is what you want
        for an rpath.

LINKING AGAINST IT



( run in 0.813 second using v1.01-cache-2.11-cpan-e623d60df62 )