Skip to content

Commit

Permalink
qrcodegen: refactor
Browse files Browse the repository at this point in the history
- Use rec-less, overlay-style overridable recursive attributes (in effect since
#119942)
- Add checkPhase
  • Loading branch information
AndersonTorres committed Aug 1, 2023
1 parent 6d634ba commit 0164461
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions pkgs/development/libraries/qrcodegen/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,52 @@
, fetchFromGitHub
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "qrcodegen";
version = "1.8.0";

src = fetchFromGitHub {
owner = "nayuki";
repo = "QR-Code-generator";
rev = "v${version}";
sha256 = "sha256-aci5SFBRNRrSub4XVJ2luHNZ2pAUegjgQ6pD9kpkaTY=";
rev = "v${finalAttrs.version}";
hash = "sha256-aci5SFBRNRrSub4XVJ2luHNZ2pAUegjgQ6pD9kpkaTY=";
};

sourceRoot = "source/c";
preBuild = ''
cd c
'';

nativeBuildInputs = lib.optionals stdenv.cc.isClang [
stdenv.cc.cc.libllvm.out
];

makeFlags = lib.optionals stdenv.cc.isClang [ "AR=llvm-ar" ];

doCheck = true;
checkPhase = ''
runHook preCheck
./qrcodegen-test
runHook postCheck
'';

installPhase = ''
runHook preInstall
mkdir -p $out/lib $out/include/qrcodegen
cp libqrcodegen.a $out/lib
cp qrcodegen.h $out/include/qrcodegen/
install -Dt $out/lib/ libqrcodegen.a
install -Dt $out/include/qrcodegen/ qrcodegen.h
runHook postInstall
'';

meta = with lib; {
meta = {
homepage = "https://www.nayuki.io/page/qr-code-generator-library";
description = "High-quality QR Code generator library in many languages";
license = licenses.mit;
maintainers = with maintainers; [ mcbeth AndersonTorres ];
platforms = platforms.unix;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.unix;
};
}
})
# TODO: build the other languages
# TODO: multiple outputs

0 comments on commit 0164461

Please sign in to comment.