diff --git a/dev-python/curl-cffi/Manifest b/dev-python/curl-cffi/Manifest new file mode 100644 index 00000000..8c64a0dc --- /dev/null +++ b/dev-python/curl-cffi/Manifest @@ -0,0 +1,4 @@ +AUX curl-cffi-0001-system-libs.patch 3086 BLAKE2B 5615c04e37e0163ce7a81cd1db7e128d6237c2163268a95859beec93a79c44146b489147791f7913bd30fe93f1db6ae87dfeed1c6e3eb0bf07db4a8f11f009ee SHA512 d632ffbedb25f08ba24a9e35843d338973eb27837eab3b6d1a762bd577577354e5fd6c672e2cad7030047a4272bbe3bac5af55f9af1dfbcc57b19698254c87c3 +DIST curl_cffi-0.7.1.tar.gz 133179 BLAKE2B 5481d2c812583c34ac8eae8d4931281e01de2b2b4c5ac51d23ac3b3548e0b00b36224e53cd3b720c61d52c9bc4cd094c081c0a4729212134bed702168061daae SHA512 74905b54454f9eb23a8b73caa8177fd584bffdf3b5a041040ba726aace28efc1bdbcf9e6a2d122652a7849c306d49a8b68bed23c6e805ff3a4dee5070d7ef156 +EBUILD curl-cffi-0.7.1.ebuild 573 BLAKE2B 4356329030de6e29657ecc3dcf3bd494f815c898267e3c3ff25b7f4317045e555cf7b109749f782d61966f56f9e3309602022dca369e9b91ee29aa8854891497 SHA512 221c5eff8f09a7f0ff6c2d2039b627b80a3ca0e7fc5a7b80efa9997fe6fb2e45376d48508d2eaaf24d5b5619717d8475d6b72494a9e2fd8e3c2e151e7f2eef2d +MISC metadata.xml 318 BLAKE2B 0cc4e95cc21865e313ce3f88744cc8bab1e68d315aa130ed8e6897be4e22a5761e60114bf2e83acec9d2f41b929eb41e5edbf8116833b2104216c10851192414 SHA512 4c9ba6ab4b1312a957af5e75240ab3976f21d84c2ce2d175a1e3700768408bfb83d9103714194f09a8939f7cd1c89369ffdb83e3b14524d2de09f20e22ec1d58 diff --git a/dev-python/curl-cffi/curl-cffi-0.7.1.ebuild b/dev-python/curl-cffi/curl-cffi-0.7.1.ebuild new file mode 100644 index 00000000..68e3ab4b --- /dev/null +++ b/dev-python/curl-cffi/curl-cffi-0.7.1.ebuild @@ -0,0 +1,24 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_1{0,1,2,3} ) +DISTUTILS_EXT=1 +inherit distutils-r1 pypi + +DESCRIPTION="Python binding for curl-impersonate fork via cffi." +HOMEPAGE="https://pypi.org/project/curl-cffi/" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND="dev-python/cffi[${PYTHON_USEDEP}] + dev-python/certifi[${PYTHON_USEDEP}] + net-misc/curl-impersonate" + +PATCHES=( "${FILESDIR}/${PN}-0001-system-libs.patch" ) + +distutils_enable_tests pytest diff --git a/dev-python/curl-cffi/files/curl-cffi-0001-system-libs.patch b/dev-python/curl-cffi/files/curl-cffi-0001-system-libs.patch new file mode 100644 index 00000000..c961a871 --- /dev/null +++ b/dev-python/curl-cffi/files/curl-cffi-0001-system-libs.patch @@ -0,0 +1,99 @@ +diff --git a/ffi/cdef.c b/ffi/cdef.c +index 9c22ce7..e8c8a1f 100644 +--- a/ffi/cdef.c ++++ b/ffi/cdef.c +@@ -56,8 +56,8 @@ struct curl_ws_frame { + ...; + }; + +-int curl_ws_recv(void *curl, void *buffer, int buflen, int *recv, struct curl_ws_frame **meta); +-int curl_ws_send(void *curl, void *buffer, int buflen, int *sent, int fragsize, unsigned int sendflags); ++int curl_ws_recv(void *curl, void *buffer, int buflen, size_t *recv, const struct curl_ws_frame **meta); ++int curl_ws_send(void *curl, void *buffer, int buflen, size_t *sent, int fragsize, unsigned int sendflags); + + // mime + void *curl_mime_init(void* curl); // -> form +diff --git a/libs.json b/libs.json +index 3825dfe..0e1b619 100644 +--- a/libs.json ++++ b/libs.json +@@ -41,7 +41,7 @@ + "pointer_size": 64, + "libdir": "", + "sysname": "linux", +- "link_type": "static", ++ "link_type": "dynamic", + "libc": "gnu", + "so_name": "libcurl-impersonate-chrome.so", + "so_arch": "x86_64" +@@ -52,7 +52,7 @@ + "pointer_size": 64, + "libdir": "", + "sysname": "linux", +- "link_type": "static", ++ "link_type": "dynamic", + "libc": "musl", + "so_name": "libcurl-impersonate-chrome.so", + "so_arch": "x86_64" +@@ -63,7 +63,7 @@ + "pointer_size": 32, + "libdir": "", + "sysname": "linux", +- "link_type": "static", ++ "link_type": "dynamic", + "libc": "gnu", + "so_name": "libcurl-impersonate-chrome.so", + "so_arch": "i386" +@@ -74,7 +74,7 @@ + "pointer_size": 64, + "libdir": "", + "sysname": "linux", +- "link_type": "static", ++ "link_type": "dynamic", + "libc": "gnu", + "so_name": "libcurl-impersonate-chrome.so", + "so_arch": "aarch64" +@@ -96,7 +96,7 @@ + "pointer_size": 32, + "libdir": "", + "sysname": "linux", +- "link_type": "static", ++ "link_type": "dynamic", + "libc": "gnueabihf", + "so_name": "libcurl-impersonate-chrome.so", + "so_arch": "arm" +@@ -107,7 +107,7 @@ + "pointer_size": 32, + "libdir": "", + "sysname": "linux", +- "link_type": "static", ++ "link_type": "dynamic", + "libc": "gnueabihf", + "so_name": "libcurl-impersonate-chrome.so", + "so_arch": "arm" +diff --git a/scripts/build.py b/scripts/build.py +index 4891867..926f2c1 100644 +--- a/scripts/build.py ++++ b/scripts/build.py +@@ -103,7 +103,6 @@ def get_curl_libraries(): + ffibuilder = FFI() + system = platform.system() + root_dir = Path(__file__).parent.parent +-download_libcurl() + + + ffibuilder.set_source( +@@ -113,7 +112,6 @@ ffibuilder.set_source( + """, + # FIXME from `curl-impersonate` + libraries=get_curl_libraries(), +- extra_objects=get_curl_archives(), + library_dirs=[arch["libdir"]], + source_extension=".c", + include_dirs=[ +@@ -132,4 +130,4 @@ with open(root_dir / "ffi/cdef.c") as f: + + + if __name__ == "__main__": +- ffibuilder.compile(verbose=False) ++ ffibuilder.compile(verbose=True) diff --git a/dev-python/curl-cffi/metadata.xml b/dev-python/curl-cffi/metadata.xml new file mode 100644 index 00000000..ef99f25b --- /dev/null +++ b/dev-python/curl-cffi/metadata.xml @@ -0,0 +1,11 @@ + + + + + audvare@gmail.com + Andrew Udvare + + + curl-cffi + + diff --git a/net-misc/curl-impersonate/Manifest b/net-misc/curl-impersonate/Manifest new file mode 100644 index 00000000..05a26d5b --- /dev/null +++ b/net-misc/curl-impersonate/Manifest @@ -0,0 +1,5 @@ +DIST boringssl-cd95210465496ac2337b313cf49f607762abe286.tar.gz 45424925 BLAKE2B b20cfe533ee2aede704b9475e37bd11f55e04c89818e3ea2cd0f937ba2571a125469c65547909e5781d1aee859951667e7da3f51d5f95b9194cf2dd5c9958863 SHA512 ac6b4cb0e08b429bc9d3be90c076d2e654fb6ffd21450b78d9313bd60e8d5ede7198f6e0d3e71dc7e069788129662809dd16d287bb75d6007fe173023314f079 +DIST curl-8.7.1.tar.gz 3324062 BLAKE2B 59d1a484f68d0d5de622e6a1c4200766e6e095eacca8716df70aa6fc97145f241aa9a1181932ea8c5502809e8593198f27e9cba26bf848623fcf0ee92bef7117 SHA512 38a1f7d7f5c83922cd4e0a858ac803d230d691c8f4df7e5086062c6991da740e626aa86675683282bc8555fc4cb962a08ba1a7ce817d78961d749d6d580fb9fa +DIST curl-impersonate-0.8.2.tar.gz 148340 BLAKE2B e6f90acac75558490dc1438694abf5cad21bcd5dc31609e88af83c98d7842b6fbd55a8e7e51fd78d1512b07ee42a9ebcceb86ea8b1da81f008e40cdf1272d766 SHA512 852f6ca48164bdb370a8d832f6dea9d6825c882e5b02761ddf871b77a0cb20144576b8ec863069f3da6d91eaf18d666fe6e9041f96a414696bf4a8d904dbf8af +EBUILD curl-impersonate-0.8.2.ebuild 3012 BLAKE2B 1b91cea115451a3a8ab91a48226bcf613a7dab12745339d7aba2b88d02fe3a33085ca1f83bc0e4141f87eb81530dc0ccd4f511c16c59682e093b41e0dac68581 SHA512 e0cf92cfe4adb5fa39ec062feb7dfbf70d1b420d123f68976146b764b37b0631ee2eb7e19e06e565614fa53f0dcf341caa3d991d99190a400fd752ada70744bd +MISC metadata.xml 416 BLAKE2B 1d7b6295f889c5438130c25cabfc6ff021c59bc75cf02f5b9829c05b330c3662754be11016d475bf9fd013d696af8ef2fa1168baededea37da4aa746ec3332a6 SHA512 8362e4f37612d47285ffc83c04e4299efaad5f9ba9a9ee1d50ebc9867c2b63d4df3df85aee31db9f94a9e9305add1abb42d133bdd69d5c753439936d6f3c5d33 diff --git a/net-misc/curl-impersonate/curl-impersonate-0.8.2.ebuild b/net-misc/curl-impersonate/curl-impersonate-0.8.2.ebuild new file mode 100644 index 00000000..cd69a16e --- /dev/null +++ b/net-misc/curl-impersonate/curl-impersonate-0.8.2.ebuild @@ -0,0 +1,100 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools cmake flag-o-matic multiprocessing + +DESCRIPTION="An active fork of curl-impersonate with more versions and build targets." +HOMEPAGE="https://github.com/lexiforest/curl-impersonate" +BORINGSSL_SHA="cd95210465496ac2337b313cf49f607762abe286" +CURL_VERSION="curl-8_7_1" +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:=" +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}" || die + eapply ../chrome/patches/boringssl.patch + touch .patched || die + cmake_src_prepare + popd || die + mv "${WORKDIR}/curl-${CURL_VERSION}" "${S}/${CURL_VERSION}" || die + pushd "${CURL_VERSION}" || die + eapply ../chrome/patches/curl-impersonate.patch + eautoreconf + touch .patched-chrome || die + popd || die + default +} + +src_configure() { + pushd "boringssl-${BORINGSSL_SHA}" || die + append-cxxflags -Wno-error=maybe-uninitialized -Wno-unknown-warning-option + filter-lto + 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=libc++ + append-ldflags -lc++ + 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 -lc++" \ + USE_CURL_SSLKEYLOGFILE=true + emake + popd || die +} + +src_install() { + pushd "${CURL_VERSION}" || die + emake DESTDIR="${D}" install + rm -fR "${D}/usr/share/man" "${D}/usr/share/aclocal" "${D}/usr/include" || die + popd || die + if use clients; then + local bn i + for i in chrome/curl_*; do + bn=$(basename "$i") + newbin "$i" "${bn//_/-}" + done + fi + einstalldocs +} diff --git a/net-misc/curl-impersonate/metadata.xml b/net-misc/curl-impersonate/metadata.xml new file mode 100644 index 00000000..903315b1 --- /dev/null +++ b/net-misc/curl-impersonate/metadata.xml @@ -0,0 +1,14 @@ + + + + + audvare@gmail.com + Andrew Udvare + + + lexiforest/curl-impersonate + + + Install the curl wrapper scripts + +