Merge pull request #189045 from leungbk/edea2

ocamlPackages.plotkicadsch: init at 0.9
This commit is contained in:
superherointj 2022-08-31 18:44:39 -03:00 committed by GitHub
commit 2c5484ca94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 106 additions and 1 deletions

View file

@ -26,7 +26,7 @@ buildDunePackage {
astring cohttp-lwt-unix decompress
domain-name ipaddr mtime mirage-flow
cstruct ptime mimic ca-certs-nss
tls tls-mirage
tls tls-mirage git
];
checkInputs = [
alcotest alcotest-lwt base64 ke

View file

@ -0,0 +1,23 @@
{ lib
, buildDunePackage
, fetchurl
}:
buildDunePackage rec {
pname = "kicadsch";
version = "0.9.0";
minimalOCamlVersion = "4.07";
src = fetchurl {
url = "https://github.com/jnavila/plotkicadsch/releases/download/v${version}/plotkicadsch-${version}.tbz";
sha256 = "sha256-B+vnEPyd3SUzviTdNoyvYk0p7Hrg/XTJm8KxsY8A4jQ=";
};
meta = with lib; {
description = "OCaml library for exporting Kicad Sch files to SVG pictures";
homepage = "https://github.com/jnavila/plotkicadsch";
license = licenses.isc;
maintainers = with maintainers; [ leungbk ];
};
}

View file

@ -0,0 +1,50 @@
{ lib
, buildDunePackage
, fetchFromGitHub
, substituteAll
, base64
, cmdliner
, digestif
, git-unix
, kicadsch
, lwt
, lwt_ppx
, sha
, tyxml
, coreutils
, imagemagick
}:
buildDunePackage rec {
pname = "plotkicadsch";
inherit (kicadsch) src version;
minimalOCamlVersion = "4.09";
patches = [
(substituteAll {
src = ./fix-paths.patch;
inherit coreutils imagemagick;
})
];
buildInputs = [
base64
cmdliner
digestif
git-unix
kicadsch
lwt
lwt_ppx
sha
tyxml
];
meta = with lib; {
description = "A tool to export Kicad Sch files to SVG pictures";
homepage = "https://github.com/jnavila/plotkicadsch";
license = licenses.isc;
maintainers = with maintainers; [ leungbk ];
};
}

View file

@ -0,0 +1,26 @@
diff --git a/plotkicadsch/src/git-imgdiff b/plotkicadsch/src/git-imgdiff
index cbddecb..8d21a8a 100755
--- a/plotkicadsch/src/git-imgdiff
+++ b/plotkicadsch/src/git-imgdiff
@@ -1,4 +1,4 @@
#!/bin/bash
PIPE=$(mktemp -u)
-(! compare -metric RMSE $2 $1 png:${PIPE} 2> /dev/null) && (montage -geometry +4+4 $2 $PIPE $1 png:- | display -title "$1" -)
+(! @imagemagick@/bin/compare -metric RMSE $2 $1 png:${PIPE} 2> /dev/null) && (@imagemagick@/bin/montage -geometry +4+4 $2 $PIPE $1 png:- | @imagemagick@/bin/display -title "$1" -)
rm $PIPE
diff --git a/plotkicadsch/src/sysAbst.ml b/plotkicadsch/src/sysAbst.ml
index c3c7b52..15db6d4 100644
--- a/plotkicadsch/src/sysAbst.ml
+++ b/plotkicadsch/src/sysAbst.ml
@@ -30,7 +30,7 @@ let detect_os () : os =
if Sys.win32 then Windows
else if Sys.cygwin then Cygwin
else
- let ((in_ch, _, _) as uname) = UnixLabels.open_process_full "uname" ~env:[| |] in
+ let ((in_ch, _, _) as uname) = UnixLabels.open_process_full "@coreutils@/bin/uname" ~env:[| |] in
let os = input_line in_ch in
ignore (UnixLabels.close_process_full uname) ;
match os with
--
2.37.1

View file

@ -664,6 +664,8 @@ let
ke = callPackage ../development/ocaml-modules/ke { };
kicadsch = callPackage ../development/ocaml-modules/kicadsch { };
lablgl = callPackage ../development/ocaml-modules/lablgl { };
lablgtk3 = callPackage ../development/ocaml-modules/lablgtk3 { };
@ -1145,6 +1147,10 @@ let
piqi-ocaml = callPackage ../development/ocaml-modules/piqi-ocaml { };
plotkicadsch = callPackage ../development/ocaml-modules/plotkicadsch {
inherit (pkgs) coreutils imagemagick;
};
posix-base = callPackage ../development/ocaml-modules/posix/base.nix { };
posix-socket = callPackage ../development/ocaml-modules/posix/socket.nix { };