Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkgs/applications/blockchains/monero-cli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
trezorSupport ? true,
hidapi,
libusb1,
protobuf_21,
protobuf,
udev,
}:

Expand Down Expand Up @@ -96,7 +96,7 @@ stdenv.mkDerivation rec {
python3
hidapi
libusb1
protobuf_21
protobuf
]
++ lib.optionals (trezorSupport && stdenv.hostPlatform.isLinux) [ udev ];

Expand Down Expand Up @@ -138,5 +138,7 @@ stdenv.mkDerivation rec {
rnhmjoj
];
mainProgram = "monero-wallet-cli";
# internal build tool generate_translations_header is tricky to compile for the build platform
broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
};
}
4 changes: 2 additions & 2 deletions pkgs/applications/blockchains/monero-gui/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
trezorSupport ? true,
hidapi,
libusb1,
protobuf_21,
protobuf,
python3,
udev,
}:
Expand Down Expand Up @@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
++ lib.optionals trezorSupport [
hidapi
libusb1
protobuf_21
protobuf
python3
]
++ lib.optionals (trezorSupport && stdenv.hostPlatform.isLinux) [
Expand Down
5 changes: 2 additions & 3 deletions pkgs/development/libraries/opencv/4.x.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
, glib
, glog
, gflags
, protobuf_21
, protobuf_29
, config
, ocl-icd
, buildPackages
Expand Down Expand Up @@ -308,7 +308,7 @@ effectiveStdenv.mkDerivation {
glib
glog
pcre2
protobuf_21
protobuf_29
zlib
] ++ optionals enablePython [
pythonPackages.python
Expand Down Expand Up @@ -419,7 +419,6 @@ effectiveStdenv.mkDerivation {
(cmakeBool "OPENCV_GENERATE_PKGCONFIG" true)
(cmakeBool "WITH_OPENMP" true)
(cmakeBool "BUILD_PROTOBUF" false)
(cmakeOptionType "path" "Protobuf_PROTOC_EXECUTABLE" (getExe buildPackages.protobuf_21))
(cmakeBool "PROTOBUF_UPDATE_FILES" true)
(cmakeBool "OPENCV_ENABLE_NONFREE" enableUnfree)
(cmakeBool "BUILD_TESTS" runAccuracyTests)
Expand Down
23 changes: 13 additions & 10 deletions pkgs/development/libraries/protobuf/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
zlib,
version,
hash,
replaceVars,
versionCheckHook,

# downstream dependencies
Expand All @@ -36,9 +37,9 @@ stdenv.mkDerivation (finalAttrs: {
inherit hash;
};

postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
postPatch = lib.optionalString (stdenv.hostPlatform.isDarwin && lib.versionOlder version "29") ''
substituteInPlace src/google/protobuf/testing/googletest.cc \
--replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
--replace-fail 'tmpnam(b)' '"'$TMPDIR'/foo"'
'';

patches = lib.optionals (lib.versionOlder version "22") [
Expand All @@ -50,15 +51,17 @@ stdenv.mkDerivation (finalAttrs: {
})
];

nativeBuildInputs =
[
cmake
]
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# protoc of the same version must be available for build. For non-cross builds, it's able to
# re-use the executable generated as part of the build
# hook to provide the path to protoc executable, used at build time
build_protobuf =
if (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) then
buildPackages."protobuf_${lib.versions.major version}"
];
else
(placeholder "out");
setupHook = ./setup-hook.sh;

nativeBuildInputs = [
cmake
];

buildInputs = [
gtest
Expand Down
9 changes: 9 additions & 0 deletions pkgs/development/libraries/protobuf/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ProtobufCMakeFlags() {
cmakeFlagsArray+=(
-DPROTOC_EXE="@build_protobuf@/bin/protoc"
-DProtobuf_PROTOC_EXE="@build_protobuf@/bin/protoc"
-DProtobuf_PROTOC_EXECUTABLE="@build_protobuf@/bin/protoc"
)
}

preConfigureHooks+=(ProtobufCMakeFlags)