net-misc/curl-impersonate - 2.2.2 (tatsh-overlay)

Search

Install

Install this version:

emerge -a =net-misc/curl-impersonate-2.2.2

If this version is masked, you can unmask it using the autounmask tool or standard emerge options:

autounmask =net-misc/curl-impersonate-2.2.2

Or alternatively:

emerge --autounmask-write -a =net-misc/curl-impersonate-2.2.2

Package Information

Description:
An active fork of curl-impersonate with more versions and build targets.
Homepage:
https://github.com/lexiforest/curl-impersonate
License:
MIT

Ebuild Details

Version EAPI Keywords Slot
2.2.2 8 ~amd64 0
View Raw Ebuild
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit autotools cmake flag-o-matic

DESCRIPTION="An active fork of curl-impersonate with more versions and build targets."
HOMEPAGE="https://github.com/lexiforest/curl-impersonate"
BORINGSSL_SHA="156c7b75ae9b8c3b3f847acf264f17594c3859fb"
CURL_VERSION="curl-8_21_0"
SRC_URI="https://github.com/lexiforest/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://github.com/google/boringssl/archive/${BORINGSSL_SHA}.tar.gz -> boringssl-${BORINGSSL_SHA}.tar.gz
	https://github.com/curl/curl/archive/${CURL_VERSION}.tar.gz -> ${CURL_VERSION//_/.}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="clients"

DEPEND="app-arch/brotli:=
	dev-libs/nss:=
	llvm-runtimes/libcxx:=
	net-libs/nghttp2:=
	app-arch/zstd:=
	net-libs/libpsl
	virtual/zlib"
RDEPEND="${DEPEND}"
BDEPEND="dev-build/ninja
	dev-build/cmake"

DOCS=( README.md )

# This package is cURL built with boringssl with a few patches (both in cURL and boringssl). This
# ebuild skips over curl-impersonate's not so great autotools use and just builds boringssl then
# cURL with the patches.

src_prepare() {
	mv "${WORKDIR}/boringssl-${BORINGSSL_SHA}" "${S}/" || die
	pushd "boringssl-${BORINGSSL_SHA}" &>/dev/null || die
	eapply ../patches/boringssl.patch
	touch .patched || die
	cmake_src_prepare
	popd &>/dev/null || die
	mv "${WORKDIR}/curl-${CURL_VERSION}" "${S}/${CURL_VERSION}" || die
	pushd "${CURL_VERSION}" &>/dev/null || die
	eapply ../patches/curl.patch
	eautoreconf
	touch .patched-chrome || die
	popd &>/dev/null || die
	default
}

src_configure() {
	pushd "boringssl-${BORINGSSL_SHA}" || die
	sed -re 's|-Werror||g' -i CMakeLists.txt || die
	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=OFF
		-DCMAKE_POSITION_INDEPENDENT_CODE=ON
	)
	cmake_src_configure
	popd || die
}

src_compile() {
	pushd "boringssl-${BORINGSSL_SHA}" || die
	cmake_src_compile
	popd || die
	mkdir "boringssl-${BORINGSSL_SHA}/lib" || die
	cp "boringssl-${BORINGSSL_SHA}_build"/*.a "boringssl-${BORINGSSL_SHA}/lib" || die
	pushd "${CURL_VERSION}" || die
	# This configure has to be here to see the libraries just built
	append-cxxflags -stdlib=libstdc++
	append-ldflags -lstdc++
	econf \
		"--with-brotli=${EPREFIX}/usr/$(get_libdir)" \
		"--with-ca-bundle=${EPREFIX}/etc/ssl/certs/ca-certificates.crt" \
		"--with-nghttp2=${EPREFIX}/usr/$(get_libdir)" \
		"--with-openssl=${S}/boringssl-${BORINGSSL_SHA}" \
		"--with-zlib=${EPREFIX}/usr/$(get_libdir)" \
		"--with-zstd=${EPREFIX}/usr/$(get_libdir)" \
		--enable-ech \
		--enable-ipv6 \
		--disable-static \
		--enable-websockets \
		LIBS="-pthread -lbrotlidec -lstdc++" \
		USE_CURL_SSLKEYLOGFILE=true
	emake
	popd || die
}

src_install() {
	pushd "${CURL_VERSION}" || die
	emake DESTDIR="${D}" install
	if [ -f "${D}/usr/bin/wcurl" ]; then
		mv "${D}/usr/bin/wcurl" "${D}/usr/bin/w${PN}" || die
	fi
	rm -fR "${D}/usr/share/man" "${D}/usr/share/aclocal" "${D}/usr/include" \
		"${D}/usr/$(get_libdir)/lib${PN}.la" || die
	popd || die
	if use clients; then
		local bn i
		for i in bin/curl_*; do
			bn=$(basename "$i")
			newbin "$i" "${bn//_/-}"
		done
	fi
	einstalldocs
}

USE Flags

Manage flags for this package: euse -i <flag> -p net-misc/curl-impersonate | euse -E <flag> -p net-misc/curl-impersonate | euse -D <flag> -p net-misc/curl-impersonate

Global/Standard Flags

Inherited Eclasses

Dependencies

DEPEND

app-arch/brotli:=
	dev-libs/nss:=
	llvm-runtimes/libcxx:=
	net-libs/nghttp2:=
	app-arch/zstd:=
	net-libs/libpsl
	virtual/zlib

RDEPEND

app-arch/brotli:=
	dev-libs/nss:=
	llvm-runtimes/libcxx:=
	net-libs/nghttp2:=
	app-arch/zstd:=
	net-libs/libpsl
	virtual/zlib

BDEPEND

dev-build/ninja
	dev-build/cmake

Manifest for 2.2.2

Type File Size Source URLs
DIST boringssl-156c7b75ae9b8c3b3f847acf264f17594c3859fb.tar.gz 74515087 bytes https://github.com/google/boringssl/archive/156c7b75ae9b8c3b3f847acf264f17594c3859fb.tar.gz
DIST curl-8.21.0.tar.gz 3592963 bytes https://github.com/curl/curl/archive/curl-8_21_0.tar.gz
DIST curl-impersonate-2.2.2.tar.gz 216975 bytes https://github.com/lexiforest/curl-impersonate/archive/refs/tags/v2.2.2.tar.gz