curl-impersonate-chrome: 0.8.0 -> 1.2.0
This commit is contained in:
parent
20a32a9433
commit
93a64793df
@ -13,6 +13,7 @@
|
||||
python3,
|
||||
ninja,
|
||||
perl,
|
||||
pkg-config,
|
||||
autoconf,
|
||||
automake,
|
||||
libtool,
|
||||
@ -24,7 +25,7 @@
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "curl-impersonate-chrome";
|
||||
version = "0.8.0";
|
||||
version = "1.2.0";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
@ -32,14 +33,12 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "yifeikong";
|
||||
owner = "lexiforest";
|
||||
repo = "curl-impersonate";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-m6zeQUL+yBh3ixS+crbJWHX5TLa61A/3oqMz5UVELso=";
|
||||
hash = "sha256-tAQdTRGAOD2rpLZvoLQ2YL0wrohXEcmChMZBvYjsMhE=";
|
||||
};
|
||||
|
||||
patches = [ ./disable-building-docs.patch ];
|
||||
|
||||
# Disable blanket -Werror to fix build on `gcc-13` related to minor
|
||||
# warnings on `boringssl`.
|
||||
env.NIX_CFLAGS_COMPILE = "-Wno-error";
|
||||
@ -62,6 +61,7 @@ stdenv.mkDerivation rec {
|
||||
python3.pythonOnBuildForHost.pkgs.gyp
|
||||
ninja
|
||||
perl
|
||||
pkg-config
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
@ -82,9 +82,9 @@ stdenv.mkDerivation rec {
|
||||
"--with-ca-path=${cacert}/etc/ssl/certs"
|
||||
];
|
||||
|
||||
buildFlags = [ "chrome-build" ];
|
||||
checkTarget = "chrome-checkbuild";
|
||||
installTargets = [ "chrome-install" ];
|
||||
buildFlags = [ "build" ];
|
||||
checkTarget = "checkbuild";
|
||||
installTargets = [ "install" ];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
@ -117,6 +117,11 @@ stdenv.mkDerivation rec {
|
||||
popd
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile.in \
|
||||
--replace-fail "-lc++" "-lstdc++"
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
export GOPATH=$TMPDIR/go
|
||||
@ -129,7 +134,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
postInstall = ''
|
||||
# Remove vestigial *-config script
|
||||
rm $out/bin/curl-impersonate-chrome-config
|
||||
rm $out/bin/curl-impersonate-config
|
||||
|
||||
# Patch all shebangs of installed scripts
|
||||
patchShebangs $out/bin
|
||||
@ -138,23 +143,13 @@ stdenv.mkDerivation rec {
|
||||
make -C curl-*/include install
|
||||
''
|
||||
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
# Build and install completions for each curl binary
|
||||
# Patch completion names
|
||||
substituteInPlace curl-*/scripts/Makefile \
|
||||
--replace-fail "_curl" "_curl-impersonate" \
|
||||
--replace-fail "curl.fish" "curl-impersonate.fish"
|
||||
|
||||
# Patch in correct binary name and alias it to all scripts
|
||||
perl curl-*/scripts/completion.pl --curl $out/bin/curl-impersonate-chrome --shell zsh >$TMPDIR/curl-impersonate-chrome.zsh
|
||||
substituteInPlace $TMPDIR/curl-impersonate-chrome.zsh \
|
||||
--replace-fail \
|
||||
'#compdef curl' \
|
||||
"#compdef curl-impersonate-chrome$(find $out/bin -name 'curl_*' -printf ' %f=curl-impersonate-chrome')"
|
||||
|
||||
perl curl-*/scripts/completion.pl --curl $out/bin/curl-impersonate-chrome --shell fish >$TMPDIR/curl-impersonate-chrome.fish
|
||||
substituteInPlace $TMPDIR/curl-impersonate-chrome.fish \
|
||||
--replace-fail \
|
||||
'--command curl' \
|
||||
"--command curl-impersonate-chrome$(find $out/bin -name 'curl_*' -printf ' --command %f')"
|
||||
|
||||
# Install zsh and fish completions
|
||||
installShellCompletion $TMPDIR/curl-impersonate-chrome.{zsh,fish}
|
||||
# Install completions
|
||||
make -C curl-*/scripts install
|
||||
'';
|
||||
|
||||
preFixup =
|
||||
@ -163,10 +158,10 @@ stdenv.mkDerivation rec {
|
||||
in
|
||||
''
|
||||
# If libnssckbi.so is needed, link libnssckbi.so without needing nss in closure
|
||||
if grep -F nssckbi $out/lib/libcurl-impersonate-*${libext} &>/dev/null; then
|
||||
if grep -F nssckbi $out/lib/libcurl-impersonate${libext} &>/dev/null; then
|
||||
ln -s ${p11-kit}/lib/pkcs11/p11-kit-trust${libext} $out/lib/libnssckbi${libext}
|
||||
${lib.optionalString stdenv.hostPlatform.isElf ''
|
||||
patchelf --add-needed libnssckbi${libext} $out/lib/libcurl-impersonate-*${libext}
|
||||
patchelf --add-needed libnssckbi${libext} $out/lib/libcurl-impersonate${libext}
|
||||
''}
|
||||
fi
|
||||
'';
|
||||
@ -178,12 +173,18 @@ stdenv.mkDerivation rec {
|
||||
|
||||
updateScript = ./update.sh;
|
||||
|
||||
# Find the correct boringssl source file
|
||||
boringssl-source = builtins.head (
|
||||
lib.mapAttrsToList (_: file: file) (
|
||||
lib.filterAttrs (name: _: lib.strings.hasPrefix "boringssl-" name) passthru.deps
|
||||
)
|
||||
);
|
||||
boringssl-go-modules =
|
||||
(buildGoModule {
|
||||
inherit (passthru.deps."boringssl.zip") name;
|
||||
inherit (passthru.boringssl-source) name;
|
||||
|
||||
src = passthru.deps."boringssl.zip";
|
||||
vendorHash = "sha256-oKlwh+Oup3lVgqgq42vY3iLg62VboF9N565yK2W0XxI=";
|
||||
src = passthru.boringssl-source;
|
||||
vendorHash = "sha256-HepiJhj7OsV7iQHlM2yi5BITyAM04QqWRX28Rj7sRKk=";
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
@ -193,13 +194,13 @@ stdenv.mkDerivation rec {
|
||||
|
||||
meta = {
|
||||
description = "Special build of curl that can impersonate Chrome & Firefox";
|
||||
homepage = "https://github.com/yifeikong/curl-impersonate";
|
||||
homepage = "https://github.com/lexiforest/curl-impersonate";
|
||||
license = with lib.licenses; [
|
||||
curl
|
||||
mit
|
||||
];
|
||||
maintainers = with lib.maintainers; [ ggg ];
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "curl-impersonate-chrome";
|
||||
mainProgram = "curl-impersonate";
|
||||
};
|
||||
}
|
||||
|
||||
22
pkgs/by-name/cu/curl-impersonate/chrome/deps.nix
generated
22
pkgs/by-name/cu/curl-impersonate/chrome/deps.nix
generated
@ -2,9 +2,9 @@
|
||||
{ fetchurl }:
|
||||
|
||||
{
|
||||
"curl-8_7_1.tar.gz" = fetchurl {
|
||||
url = "https://github.com/curl/curl/archive/curl-8_7_1.tar.gz";
|
||||
hash = "sha256-DkbIVvUXYCw0e7X+W3MXT47nmLyH8alyNclXYfdfzCg=";
|
||||
"curl-8_15_0.tar.gz" = fetchurl {
|
||||
url = "https://github.com/curl/curl/archive/curl-8_15_0.tar.gz";
|
||||
hash = "sha256-KTfK3eAHqjpSoXwhrJFT6gVHAPN5JtHZZgK/B+iIyEc=";
|
||||
};
|
||||
|
||||
"brotli-1.1.0.tar.gz" = fetchurl {
|
||||
@ -12,13 +12,23 @@
|
||||
hash = "sha256-5yCmyilCi4A/StFlNxdx9TmPq6OX7fZ3iDehhZnqE/8=";
|
||||
};
|
||||
|
||||
"boringssl.zip" = fetchurl {
|
||||
url = "https://github.com/google/boringssl/archive/d24a38200fef19150eef00cad35b138936c08767.zip";
|
||||
hash = "sha256-tzAAwL70VAyUEOZZ86ql+RgXsw4DZhkvW5l0d1eVVHU=";
|
||||
"boringssl-673e61fc215b178a90c0e67858bbf162c8158993.zip" = fetchurl {
|
||||
url = "https://github.com/google/boringssl/archive/673e61fc215b178a90c0e67858bbf162c8158993.zip";
|
||||
hash = "sha256-7bfWHo3j95EHAXJyPuQfvFUPtVCAzbGHu0oF5g4FmiI=";
|
||||
};
|
||||
|
||||
"nghttp2-1.63.0.tar.bz2" = fetchurl {
|
||||
url = "https://github.com/nghttp2/nghttp2/releases/download/v1.63.0/nghttp2-1.63.0.tar.bz2";
|
||||
hash = "sha256-YHsXRVTSKoKLxTLR1zT+D3KbXV7SB/LxLpamLoPynFU=";
|
||||
};
|
||||
|
||||
"ngtcp2-1.11.0.tar.bz2" = fetchurl {
|
||||
url = "https://github.com/ngtcp2/ngtcp2/releases/download/v1.11.0/ngtcp2-1.11.0.tar.bz2";
|
||||
hash = "sha256-122s6G/Docj84codTLsf3pu6k81fKGEdVbypukPjF7w=";
|
||||
};
|
||||
|
||||
"nghttp3-1.9.0.tar.bz2" = fetchurl {
|
||||
url = "https://github.com/ngtcp2/nghttp3/releases/download/v1.9.0/nghttp3-1.9.0.tar.bz2";
|
||||
hash = "sha256-TTCmjxfnKhOStghdr6qfxzLaHX0m7sVUuyFnCDMvzxo=";
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
From 5366ca35b3d20ef962ccf54399cc44f523d803be Mon Sep 17 00:00:00 2001
|
||||
From: GGG <gggkiller2@gmail.com>
|
||||
Date: Mon, 5 Aug 2024 04:19:29 -0300
|
||||
Subject: [PATCH] Disable building docs
|
||||
---
|
||||
Makefile.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 41d7324..b1f5ec6 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -249,6 +249,7 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.gz $(CURL_VERSION)/.
|
||||
# (for cross compilation), then pass it on to curl.
|
||||
{ \
|
||||
config_flags="--prefix=@prefix@"; \
|
||||
+ config_flags="$$config_flags --disable-manual"; \
|
||||
config_flags="$$config_flags --with-nghttp2=$(nghttp2_install_dir)"; \
|
||||
config_flags="$$config_flags --with-brotli=$(brotli_install_dir)"; \
|
||||
config_flags="$$config_flags --with-openssl=$(boringssl_install_dir)"; \
|
||||
@ -33,11 +33,25 @@ findpath() {
|
||||
}
|
||||
|
||||
getvar() {
|
||||
echo "$2" | grep -F "$1" | sed -e 's/:=/:/g' | cut -d: -f2- | stripwhitespace
|
||||
echo "$2" | grep -F "$1 " | sed -e 's/:=/:/g' | cut -d: -f2- | stripwhitespace
|
||||
}
|
||||
|
||||
evalvar() {
|
||||
local out="$(getvar "$1" "$2")"
|
||||
|
||||
# Replace $(VAR) within variables with other variables
|
||||
while [[ "$out" =~ (\$\(([A-Za-z_][A-Za-z0-9_]*)\)) ]]; do
|
||||
local match="${BASH_REMATCH[1]}"
|
||||
local var="${BASH_REMATCH[2]}"
|
||||
local value="$(getvar "$var" "$2")"
|
||||
out="${out//$match/$value}"
|
||||
done
|
||||
|
||||
echo $out
|
||||
}
|
||||
|
||||
attr="${UPDATE_NIX_ATTR_PATH:-curl-impersonate-chrome}"
|
||||
version="$(curl -sSL "https://api.github.com/repos/yifeikong/curl-impersonate/releases/latest" | jq -r .tag_name | sed -e 's/^v//')"
|
||||
version="$(curl -sSL "https://api.github.com/repos/lexiforest/curl-impersonate/releases/latest" | jq -r .tag_name | sed -e 's/^v//')"
|
||||
|
||||
pkgpath="$(findpath "$attr")"
|
||||
|
||||
@ -48,7 +62,7 @@ if [ "$updated" -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vars="$(curl -sSL "https://github.com/yifeikong/curl-impersonate/raw/v$version/Makefile.in" | grep '^ *[^ ]*_\(VERSION\|URL\|COMMIT\) *:=')"
|
||||
vars="$(curl -sSL "https://github.com/lexiforest/curl-impersonate/raw/v$version/Makefile.in" | grep '^ *[^ ]*_\(VERSION\|URL\|COMMIT\) *:=')"
|
||||
|
||||
# TODO: Fix hash for curl.
|
||||
cat >"$(dirname "$pkgpath")"/deps.nix <<EOF
|
||||
@ -66,14 +80,24 @@ cat >"$(dirname "$pkgpath")"/deps.nix <<EOF
|
||||
hash = "$(narhash "https://github.com/google/brotli/archive/refs/tags/v$(getvar BROTLI_VERSION "$vars").tar.gz")";
|
||||
};
|
||||
|
||||
"boringssl.zip" = fetchurl {
|
||||
"boringssl-$(getvar BORING_SSL_COMMIT "$vars").zip" = fetchurl {
|
||||
url = "https://github.com/google/boringssl/archive/$(getvar BORING_SSL_COMMIT "$vars").zip";
|
||||
hash = "$(narhash "https://github.com/google/boringssl/archive/$(getvar BORING_SSL_COMMIT "$vars").zip")";
|
||||
};
|
||||
|
||||
"$(getvar NGHTTP2_VERSION "$vars").tar.bz2" = fetchurl {
|
||||
url = "$(getvar NGHTTP2_URL "$vars")";
|
||||
hash = "$(narhash "$(getvar NGHTTP2_URL "$vars")")";
|
||||
"nghttp2-$(getvar NGHTTP2_VERSION "$vars").tar.bz2" = fetchurl {
|
||||
url = "$(evalvar NGHTTP2_URL "$vars")";
|
||||
hash = "$(narhash "$(evalvar NGHTTP2_URL "$vars")")";
|
||||
};
|
||||
|
||||
"ngtcp2-$(getvar NGTCP2_VERSION "$vars").tar.bz2" = fetchurl {
|
||||
url = "$(evalvar NGTCP2_URL "$vars")";
|
||||
hash = "$(narhash "$(evalvar NGTCP2_URL "$vars")")";
|
||||
};
|
||||
|
||||
"nghttp3-$(getvar NGHTTP3_VERSION "$vars").tar.bz2" = fetchurl {
|
||||
url = "$(evalvar NGHTTP3_URL "$vars")";
|
||||
hash = "$(narhash "$(evalvar NGHTTP3_URL "$vars")")";
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user