zbar: Split to multiple outputs

Also fix D-Bus config dir path: The configure script is appending `/dbus-1/system.d`
so when we added passed in `$out/etc/dbus-1/system.d`, it ended up with extra nesting.
This commit is contained in:
Jan Tojnar 2019-06-23 13:39:01 +02:00
parent 41fbd55689
commit e1cb839d17
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
3 changed files with 18 additions and 10 deletions

View File

@ -88,7 +88,7 @@ python3Packages.buildPythonApplication {
--replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary} --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
'' + (if enableQt then '' '' + (if enableQt then ''
substituteInPlace ./electrum/qrscanner.py \ substituteInPlace ./electrum/qrscanner.py \
--replace ${libzbar_name} ${zbar}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary} --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
'' else '' '' else ''
sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
''); '');

View File

@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
pname = "zbar"; pname = "zbar";
version = "0.23"; version = "0.23";
outputs = [ "out" "py" "lib" "dev" "doc" "man" ];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mchehab"; owner = "mchehab";
repo = "zbar"; repo = "zbar";
@ -54,7 +56,7 @@ stdenv.mkDerivation rec {
]; ];
configureFlags = (if enableDbus then [ configureFlags = (if enableDbus then [
"--with-dbusconfdir=${placeholder "out"}/etc/dbus-1/system.d" "--with-dbusconfdir=${placeholder "out"}/etc"
] else [ ] else [
"--without-dbus" "--without-dbus"
]) ++ lib.optionals (!enableVideo) [ ]) ++ lib.optionals (!enableVideo) [
@ -63,9 +65,10 @@ stdenv.mkDerivation rec {
"--without-qt" "--without-qt"
]; ];
postInstall = optionalString enableDbus '' makeFlags = [
install -Dm644 dbus/org.linuxtv.Zbar.conf $out/etc/dbus-1/system.d/org.linuxtv.Zbar.conf "pyexecdir=${placeholder "py"}/${python.sitePackages}"
''; "pythondir=${placeholder "py"}/${python.sitePackages}"
];
meta = with lib; { meta = with lib; {
description = "Bar code reader"; description = "Bar code reader";

View File

@ -15,15 +15,20 @@ stdenv.mkDerivation {
sha256 = "0yrc302a2fhbzryb10718ky4fymfcps3lk67ivis1qab5kbp6z8r"; sha256 = "0yrc302a2fhbzryb10718ky4fymfcps3lk67ivis1qab5kbp6z8r";
}; };
buildInputs = [ imagemagick qrencode ] ++ stdenv.lib.optional testQR zbar;
dontBuild = true; dontBuild = true;
dontStrip = true; dontStrip = true;
dontPatchELF = true; dontPatchELF = true;
preInstall = '' preInstall = let
substituteInPlace asc-to-gif.sh \ substitutions = [
--replace "convert" "${imagemagick}/bin/convert" \ ''--replace "convert" "${imagemagick}/bin/convert"''
--replace "qrencode" "${qrencode.bin}/bin/qrencode" ''--replace "qrencode" "${qrencode.bin}/bin/qrencode"''
] ++ stdenv.lib.optional testQR [
''--replace "hash zbarimg" "true"'' # hash does not work on NixOS
''--replace "$(zbarimg --raw" "$(${zbar.out}/bin/zbarimg --raw"''
];
in ''
substituteInPlace asc-to-gif.sh ${stdenv.lib.concatStringsSep " " substitutions}
''; '';
installPhase = '' installPhase = ''