nanopb: 0.4.1 -> 0.4.3
Upstream changes allow us to remove most of the hacks from the package.
This commit is contained in:
parent
e6a40af16c
commit
e379149887
@ -7,20 +7,20 @@
|
|||||||
, stdenv
|
, stdenv
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation rec {
|
||||||
pythonRuntime = python3.withPackages(ps: [ ps.protobuf ]);
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
pname = "nanopb";
|
pname = "nanopb";
|
||||||
version = "0.4.1";
|
version = "0.4.3";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = pname;
|
owner = pname;
|
||||||
repo = pname;
|
repo = pname;
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "16zxk42wzn519bpxf4578qn97k0h1cnbkvqqkqvka9sl0n3lz2dp";
|
sha256 = "sha256-32YU6LfPojvEVA2Z3DRZdGzDkSpAUgo1BueC/pl9qlY=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python3 ];
|
nativeBuildInputs = [ cmake python3 python3.pkgs.wrapPython ];
|
||||||
|
|
||||||
|
pythonPath = with python3.pkgs; [ python3.pkgs.protobuf six ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DBUILD_SHARED_LIBS=ON" # generate $out/lib/libprotobuf-nanopb.so{.0,}
|
"-DBUILD_SHARED_LIBS=ON" # generate $out/lib/libprotobuf-nanopb.so{.0,}
|
||||||
@ -28,32 +28,16 @@ in stdenv.mkDerivation rec {
|
|||||||
"-Dnanopb_PROTOC_PATH=${protobuf}/bin/protoc"
|
"-Dnanopb_PROTOC_PATH=${protobuf}/bin/protoc"
|
||||||
];
|
];
|
||||||
|
|
||||||
# On a case-insensitive filesystem (such as on Darwin), CMake fails to create
|
|
||||||
# the build directory because of the existence of the BUILD file.
|
|
||||||
# TODO: This can be removed once https://github.com/nanopb/nanopb/pull/537 is merged.
|
|
||||||
preConfigure = "rm BUILD";
|
|
||||||
|
|
||||||
# install the generator which requires Python3 with the protobuf package. It
|
|
||||||
# also requires the nanopb module that's generated by CMake to be in a
|
|
||||||
# relative location to the generator itself so we move it out of the
|
|
||||||
# python.sitePackages into the shared generator folder.
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/share/nanopb/generator/proto
|
mkdir -p $out/share/nanopb/generator/proto
|
||||||
cp ../generator/nanopb_generator.py $out/share/nanopb/generator/nanopb_generator.py
|
|
||||||
cp ../generator/proto/_utils.py $out/share/nanopb/generator/proto/_utils.py
|
|
||||||
cp ../generator/proto/nanopb.proto $out/share/nanopb/generator/proto/nanopb.proto
|
cp ../generator/proto/nanopb.proto $out/share/nanopb/generator/proto/nanopb.proto
|
||||||
mv $out/${python3.sitePackages}/nanopb_pb2.py $out/share/nanopb/generator/proto
|
|
||||||
rm -rf $out/${python3.sitePackages}
|
|
||||||
|
|
||||||
mkdir $out/bin
|
|
||||||
substitute ${./protoc-gen-nanopb} $out/bin/protoc-gen-nanopb \
|
|
||||||
--subst-var-by python ${pythonRuntime}/bin/python \
|
|
||||||
--subst-var-by out $out
|
|
||||||
chmod +x $out/bin/protoc-gen-nanopb
|
|
||||||
|
|
||||||
cp ../pb_common.c ../pb_decode.c ../pb_encode.c $out/include/
|
cp ../pb_common.c ../pb_decode.c ../pb_encode.c $out/include/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
wrapPythonPrograms
|
||||||
|
'';
|
||||||
|
|
||||||
passthru.tests = {
|
passthru.tests = {
|
||||||
simple-proto2 = callPackage ./test-simple-proto2 {};
|
simple-proto2 = callPackage ./test-simple-proto2 {};
|
||||||
simple-proto3 = callPackage ./test-simple-proto3 {};
|
simple-proto3 = callPackage ./test-simple-proto3 {};
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
exec @python@ @out@/share/nanopb/generator/nanopb_generator.py --protoc-plugin
|
|
Loading…
x
Reference in New Issue
Block a user