qrcodegen: refactor
- Use rec-less, overlay-style overridable recursive attributes (in effect since https://github.com/NixOS/nixpkgs/pull/119942) - Add checkPhase
This commit is contained in:
parent
6d634ba315
commit
0164461684
1 changed files with 22 additions and 12 deletions
|
@ -3,18 +3,20 @@
|
|||
, 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
|
||||
|
@ -22,23 +24,31 @@ stdenv.mkDerivation rec {
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue