mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
75 lines
1.7 KiB
Nix
75 lines
1.7 KiB
Nix
{
|
|
stdenv,
|
|
gcc14Stdenv,
|
|
lib,
|
|
buildBazelPackage,
|
|
bazel_7,
|
|
fetchFromGitHub,
|
|
cctools,
|
|
}:
|
|
|
|
let
|
|
# fails to build with gcc15, see https://github.com/NixOS/nixpkgs/issues/475586
|
|
buildBazelPackage' =
|
|
if stdenv.cc.isGNU then
|
|
buildBazelPackage.override {
|
|
stdenv = gcc14Stdenv;
|
|
}
|
|
else
|
|
buildBazelPackage;
|
|
in
|
|
buildBazelPackage' rec {
|
|
pname = "protoc-gen-js";
|
|
version = "3.21.4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "protocolbuffers";
|
|
repo = "protobuf-javascript";
|
|
rev = "v${version}";
|
|
hash = "sha256-eIOtVRnHv2oz4xuVc4aL6JmhpvlODQjXHt1eJHsjnLg=";
|
|
};
|
|
|
|
bazel = bazel_7;
|
|
bazelTargets = [ "generator:protoc-gen-js" ];
|
|
bazelBuildFlags = lib.optionals stdenv.cc.isClang [
|
|
"--cxxopt=-x"
|
|
"--cxxopt=c++"
|
|
"--host_cxxopt=-x"
|
|
"--host_cxxopt=c++"
|
|
];
|
|
removeRulesCC = false;
|
|
removeLocalConfigCC = false;
|
|
|
|
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
|
LIBTOOL = "${cctools}/bin/libtool";
|
|
};
|
|
|
|
fetchAttrs = {
|
|
preInstall = ''
|
|
rm -rv "$bazelOut/external/host_platform"
|
|
'';
|
|
|
|
hash = "sha256-znkwUs984vbinz/BLo1uxQ+PvxkpXo719lJu4TD1Vmg=";
|
|
};
|
|
|
|
buildAttrs.installPhase = ''
|
|
mkdir -p $out/bin
|
|
install -Dm755 bazel-bin/generator/protoc-gen-js $out/bin/
|
|
'';
|
|
|
|
meta = {
|
|
# last successful hydra build on darwin was in 2024
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
description = "Protobuf plugin for generating JavaScript code";
|
|
mainProgram = "protoc-gen-js";
|
|
homepage = "https://github.com/protocolbuffers/protobuf-javascript";
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
|
license = with lib.licenses; [
|
|
asl20
|
|
bsd3
|
|
];
|
|
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
|
maintainers = [ ];
|
|
};
|
|
}
|