mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
parent
c58af3b25d
commit
79bd24f57e
59
pkgs/by-name/pd/pdfium-binaries/package.nix
Normal file
59
pkgs/by-name/pd/pdfium-binaries/package.nix
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchzip,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
version = "6721";
|
||||||
|
src =
|
||||||
|
let
|
||||||
|
inherit (stdenv.hostPlatform) system;
|
||||||
|
selectSystem = attrs: attrs.${system};
|
||||||
|
suffix = selectSystem {
|
||||||
|
x86_64-linux = "linux-x64";
|
||||||
|
aarch64-linux = "linux-arm64";
|
||||||
|
x86_64-darwin = "mac-x64";
|
||||||
|
aarch64-darwin = "mac-arm64";
|
||||||
|
};
|
||||||
|
hash = selectSystem {
|
||||||
|
x86_64-linux = "sha256-SHCYdw3X8Uy9CgT8SN90FKdPKIk6VZFjIb6NYfOgoCo=";
|
||||||
|
aarch64-linux = "sha256-RqyzxQ2RnBuoFBAxJVC8x/XDpJJWdJ45dJXV/Yzh7pM=";
|
||||||
|
x86_64-darwin = "sha256-7XuBlG2pUtSN5kdcTTLbijEHHX5IU5kTj1aW8ZHHS2M=";
|
||||||
|
aarch64-darwin = "sha256-ZNsQkay8ZF2RQ6dKJ24GawIthjFgB5TUa08LNKpZv1A=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
fetchzip {
|
||||||
|
url = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${version}/pdfium-${suffix}.tgz";
|
||||||
|
inherit hash;
|
||||||
|
stripRoot = false;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "pdfium-binaries";
|
||||||
|
inherit version src;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir $out
|
||||||
|
cp -r ./ $out/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Binary distribution of PDFium";
|
||||||
|
homepage = "https://github.com/bblanchon/pdfium-binaries";
|
||||||
|
license = with lib.licenses; [ asl20 ];
|
||||||
|
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
||||||
|
maintainers = with lib.maintainers; [ aucub ];
|
||||||
|
platforms = [
|
||||||
|
"aarch64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
23
pkgs/by-name/pd/pdfium-binaries/update.sh
Executable file
23
pkgs/by-name/pd/pdfium-binaries/update.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p bash nixVersions.latest curl coreutils jq common-updater-scripts
|
||||||
|
|
||||||
|
latestVersion=$(curl -s ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/bblanchon/pdfium-binaries/releases/latest | jq -r '.tag_name | ltrimstr("chromium/")')
|
||||||
|
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; pdfium-binaries.version" | tr -d '"')
|
||||||
|
|
||||||
|
echo "latest version: $latestVersion"
|
||||||
|
echo "current version: $currentVersion"
|
||||||
|
|
||||||
|
if [[ "$latestVersion" == "$currentVersion" ]]; then
|
||||||
|
echo "package is up-to-date"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
for i in \
|
||||||
|
"x86_64-linux linux-x64" \
|
||||||
|
"aarch64-linux linux-arm64" \
|
||||||
|
"x86_64-darwin mac-x64" \
|
||||||
|
"aarch64-darwin mac-arm64"; do
|
||||||
|
set -- $i
|
||||||
|
prefetch=$(nix-prefetch-url --unpack "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F$latestVersion/pdfium-$2.tgz")
|
||||||
|
hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch)
|
||||||
|
update-source-version pdfium-binaries $latestVersion $hash --system=$1 --ignore-same-version
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user