curl-impersonate-chrome: 0.8.0 -> 1.2.0

Mats 93a64793 20a32a94

Changed files
+80 -65
pkgs
by-name
+33 -32
pkgs/by-name/cu/curl-impersonate/chrome/default.nix
···
python3,
ninja,
perl,
+
pkg-config,
autoconf,
automake,
libtool,
···
}:
stdenv.mkDerivation rec {
pname = "curl-impersonate-chrome";
-
version = "0.8.0";
+
version = "1.2.0";
outputs = [
"out"
···
];
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`.
···
python3.pythonOnBuildForHost.pkgs.gyp
ninja
perl
+
pkg-config
autoconf
automake
libtool
···
"--with-ca-path=${cacert}/etc/ssl/certs"
];
-
buildFlags = [ "chrome-build" ];
-
checkTarget = "chrome-checkbuild";
-
installTargets = [ "chrome-install" ];
+
buildFlags = [ "build" ];
+
checkTarget = "checkbuild";
+
installTargets = [ "install" ];
doCheck = true;
···
popd
'';
+
postPatch = ''
+
substituteInPlace Makefile.in \
+
--replace-fail "-lc++" "-lstdc++"
+
'';
+
preConfigure = ''
export GOCACHE=$TMPDIR/go-cache
export GOPATH=$TMPDIR/go
···
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
···
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 =
···
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
'';
···
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 ];
···
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";
};
}
+16 -6
pkgs/by-name/cu/curl-impersonate/chrome/deps.nix
···
{ 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 {
···
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=";
};
}
-20
pkgs/by-name/cu/curl-impersonate/chrome/disable-building-docs.patch
···
-
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)"; \
+31 -7
pkgs/by-name/cu/curl-impersonate/chrome/update.sh
···
}
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")"
···
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
···
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