jetbrains: add support for plugins on darwin (#242562)

This commit is contained in:
Weijia Wang 2024-11-01 01:01:31 +01:00 committed by GitHub
commit 4765af7624
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 11 deletions

View File

@ -19,8 +19,10 @@ let
loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
inherit pname meta src version plugins;
inherit pname src version plugins;
passthru.buildNumber = buildNumber;
passthru.product = product;
meta = meta // { mainProgram = loname; };
desktopName = product;
dontFixup = true;
installPhase = ''

View File

@ -90,23 +90,33 @@ in {
passthru.plugins = plugins ++ (ide.plugins or [ ]);
newPlugins = plugins;
disallowedReferences = [ ide ];
nativeBuildInputs = [ autoPatchelfHook ] ++ (ide.nativeBuildInputs or [ ]);
nativeBuildInputs = (lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook) ++ (ide.nativeBuildInputs or [ ]);
buildInputs = lib.unique ((ide.buildInputs or [ ]) ++ [ glib ]);
inherit (ide) meta;
buildPhase = ''
buildPhase =
let
rootDir = if stdenv.hostPlatform.isDarwin then "Applications/${ide.product}.app/Contents" else meta.mainProgram;
in
''
cp -r ${ide} $out
chmod +w -R $out
rm -f $out/${meta.mainProgram}/plugins/plugin-classpath.txt
rm -f $out/${rootDir}/plugins/plugin-classpath.txt
IFS=' ' read -ra pluginArray <<< "$newPlugins"
for plugin in "''${pluginArray[@]}"
do
ln -s "$plugin" -t $out/${meta.mainProgram}/plugins/
ln -s "$plugin" -t "$out/${rootDir}/plugins/"
done
sed "s|${ide.outPath}|$out|" \
-i $(realpath $out/bin/${meta.mainProgram}) \
-i $(realpath $out/bin/${meta.mainProgram}-remote-dev-server)
-i $(realpath $out/bin/${meta.mainProgram})
if test -f "$out/bin/${meta.mainProgram}-remote-dev-server"; then
sed "s|${ide.outPath}|$out|" \
-i $(realpath $out/bin/${meta.mainProgram}-remote-dev-server)
fi
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
autoPatchelf $out
'';
};

View File

@ -4,17 +4,17 @@
{
"631" = {
# Python
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
};
"7322" = {
# Python community edition
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
};
"8182" = {
# Rust (deprecated)
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
buildPhase = ''
runHook preBuild
@ -65,7 +65,7 @@
};
"22407" = {
# Rust
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
buildInputs = [ stdenv.cc.cc.lib ];
buildPhase = ''
runHook preBuild