11{
22 lib ,
3- fetchzip ,
43 stdenv ,
4+ fetchzip ,
55 python3Packages ,
6+ withV8 ? false ,
67} :
7- let
8+
9+ stdenv . mkDerivation ( finalAttrs : {
10+ pname = "pdfium-binaries" ;
811 # also update rev of headers in python3Packages.pypdfium2
912 version = "7087" ;
13+
1014 src =
1115 let
12- inherit ( stdenv . hostPlatform ) system ;
13- selectSystem = attrs : attrs . ${ system } ;
14- suffix = selectSystem {
16+ selectSystem =
17+ attrs :
18+ attrs . ${ stdenv . hostPlatform . system } or ( throw "Unsupported system: ${ stdenv . hostPlatform . system } " ) ;
19+ system = selectSystem {
1520 x86_64-linux = "linux-x64" ;
1621 aarch64-linux = "linux-arm64" ;
1722 x86_64-darwin = "mac-x64" ;
1823 aarch64-darwin = "mac-arm64" ;
1924 } ;
20- hash = selectSystem {
21- x86_64-linux = "sha256-zn7QlTvChQa2mQCe5K+zEGVUtuD+l/jEtlKticrrSKg=" ;
22- aarch64-linux = "sha256-080X72NNfKaanHeVtmxE/4uNV6Ue4f/1Mri/p3nOT8c=" ;
23- x86_64-darwin = "sha256-XMStU0MN9ieCrLQnQL4/jKrNWxgQl9OtZHg9EmemPhU=" ;
24- aarch64-darwin = "sha256-Q8R/p1hX6+JeVTFc6w7MC9GPNGqxlu6m+iawRIMndic=" ;
25- } ;
2625 in
2726 fetchzip {
28- url = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${ version } /pdfium-${ suffix } .tgz" ;
29- inherit hash ;
27+ url = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${ finalAttrs . version } /pdfium${ lib . optionalString withV8 "-v8" } -${ system } .tgz" ;
28+ hash =
29+ if withV8 then
30+ selectSystem {
31+ x86_64-linux = "sha256-nKHXcBTEp165g18HLzaNGfKt8MtTYpKBGNgwIpSO0u4=" ;
32+ aarch64-linux = "sha256-wip/ry42aDbyGiwYSUX8koxDuf88BLGZAmMZE0s+fL0=" ;
33+ x86_64-darwin = "sha256-7pUMfNFgGqQ8Dnox57sHfrKKke+i8CGEma4tePJaTDA=" ;
34+ aarch64-darwin = "sha256-o59kmTNC4nSCFLfww3E+4iIYs2kQ30yyFaX9f2Za7os=" ;
35+ }
36+ else
37+ selectSystem {
38+ x86_64-linux = "sha256-zn7QlTvChQa2mQCe5K+zEGVUtuD+l/jEtlKticrrSKg=" ;
39+ aarch64-linux = "sha256-080X72NNfKaanHeVtmxE/4uNV6Ue4f/1Mri/p3nOT8c=" ;
40+ x86_64-darwin = "sha256-XMStU0MN9ieCrLQnQL4/jKrNWxgQl9OtZHg9EmemPhU=" ;
41+ aarch64-darwin = "sha256-Q8R/p1hX6+JeVTFc6w7MC9GPNGqxlu6m+iawRIMndic=" ;
42+ } ;
3043 stripRoot = false ;
3144 } ;
32- in
33- stdenv . mkDerivation {
34- pname = "pdfium-binaries" ;
35- inherit version src ;
3645
3746 installPhase = ''
3847 runHook preInstall
3948
40- mkdir $out
41- cp -r ./ $out/
49+ cp -r . $out
4250
4351 runHook postInstall
4452 '' ;
@@ -53,7 +61,10 @@ stdenv.mkDerivation {
5361 meta = {
5462 description = "Binary distribution of PDFium" ;
5563 homepage = "https://github.com/bblanchon/pdfium-binaries" ;
56- license = with lib . licenses ; [ asl20 ] ;
64+ license = with lib . licenses ; [
65+ asl20
66+ mit
67+ ] ;
5768 sourceProvenance = with lib . sourceTypes ; [ binaryBytecode ] ;
5869 maintainers = with lib . maintainers ; [ ] ;
5970 platforms = [
@@ -63,4 +74,4 @@ stdenv.mkDerivation {
6374 "x86_64-darwin"
6475 ] ;
6576 } ;
66- }
77+ } )
0 commit comments