2022-05-10 21:52:26 +00:00
|
|
|
{ stdenv, lib, makeDesktopItem, makeWrapper, patchelf, writeText
|
2021-08-21 12:32:23 +00:00
|
|
|
, coreutils, gnugrep, which, git, unzip, libsecret, libnotify, e2fsprogs
|
2020-12-19 22:14:02 +00:00
|
|
|
, vmopts ? null
|
2018-03-03 13:34:44 +00:00
|
|
|
}:
|
2016-01-15 17:18:54 +00:00
|
|
|
|
2022-03-22 16:57:23 +00:00
|
|
|
{ pname, product, productShort ? product, version, src, wmClass, jdk, meta, extraLdPath ? [], extraWrapperArgs ? [] }@args:
|
2016-01-15 17:18:54 +00:00
|
|
|
|
2023-01-21 22:06:40 +00:00
|
|
|
let loName = lib.toLower productShort;
|
|
|
|
hiName = lib.toUpper productShort;
|
2020-12-19 22:14:02 +00:00
|
|
|
vmoptsName = loName
|
2022-02-01 02:40:45 +00:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.is64bit "64"
|
2020-12-19 22:14:02 +00:00
|
|
|
+ ".vmoptions";
|
2016-01-15 17:18:54 +00:00
|
|
|
in
|
|
|
|
|
2021-10-30 06:19:46 +00:00
|
|
|
with stdenv; lib.makeOverridable mkDerivation (rec {
|
2022-03-22 16:57:23 +00:00
|
|
|
inherit pname version src;
|
|
|
|
meta = args.meta // { mainProgram = pname; };
|
2021-06-03 12:24:13 +00:00
|
|
|
|
2016-01-15 17:18:54 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
2022-03-22 16:57:23 +00:00
|
|
|
name = pname;
|
|
|
|
exec = pname;
|
2022-12-12 01:36:03 +00:00
|
|
|
comment = lib.replaceStrings ["\n"] [" "] meta.longDescription;
|
2016-01-15 17:18:54 +00:00
|
|
|
desktopName = product;
|
|
|
|
genericName = meta.description;
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Development" ];
|
2022-03-22 16:57:23 +00:00
|
|
|
icon = pname;
|
2022-02-22 14:56:15 +00:00
|
|
|
startupWMClass = wmClass;
|
2016-01-15 17:18:54 +00:00
|
|
|
};
|
|
|
|
|
2023-01-21 22:06:40 +00:00
|
|
|
vmoptsFile = lib.optionalString (vmopts != null) (writeText vmoptsName vmopts);
|
2020-12-19 22:14:02 +00:00
|
|
|
|
2020-05-01 20:03:30 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper patchelf unzip ];
|
2016-01-15 17:18:54 +00:00
|
|
|
|
2022-02-01 02:40:45 +00:00
|
|
|
postPatch = ''
|
2016-01-15 17:18:54 +00:00
|
|
|
get_file_size() {
|
|
|
|
local fname="$1"
|
|
|
|
echo $(ls -l $fname | cut -d ' ' -f5)
|
|
|
|
}
|
|
|
|
|
|
|
|
munge_size_hack() {
|
|
|
|
local fname="$1"
|
|
|
|
local size="$2"
|
|
|
|
strip $fname
|
|
|
|
truncate --size=$size $fname
|
|
|
|
}
|
|
|
|
|
2022-10-18 22:17:38 +00:00
|
|
|
rm -rf jbr
|
|
|
|
|
2022-05-10 21:52:26 +00:00
|
|
|
interpreter=$(echo ${stdenv.cc.libc}/lib/ld-linux*.so.2)
|
jetbrains: Check for 64 bit specific fsnotifier
In April, 2021, Jetbrains announced the end of support for 32-bit OS
IntelliJ-based IDEs[1]:
> The final major version that will be guaranteed to run on a 32-bit OS will be
> v2021.1 for all IntelliJ-based IDEs, including AppCode, Clion, DataGrip, GoLand,
> IntelliJ IDEA, PhpStorm, PyCharm, Rider, RubyMine, and WebStorm.
[1]: https://blog.jetbrains.com/idea/2021/04/end-of-support-for-32-bit-operating-systems-in-intellij-based-ides/
2021-07-30 11:52:35 +00:00
|
|
|
if [[ "${stdenv.hostPlatform.system}" == "x86_64-linux" && -e bin/fsnotifier64 ]]; then
|
2016-01-15 17:18:54 +00:00
|
|
|
target_size=$(get_file_size bin/fsnotifier64)
|
|
|
|
patchelf --set-interpreter "$interpreter" bin/fsnotifier64
|
|
|
|
munge_size_hack bin/fsnotifier64 $target_size
|
|
|
|
else
|
|
|
|
target_size=$(get_file_size bin/fsnotifier)
|
|
|
|
patchelf --set-interpreter "$interpreter" bin/fsnotifier
|
|
|
|
munge_size_hack bin/fsnotifier $target_size
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-07-03 07:20:31 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2022-03-22 16:57:23 +00:00
|
|
|
mkdir -p $out/{bin,$pname,share/pixmaps,libexec/${pname}}
|
|
|
|
cp -a . $out/$pname
|
2022-11-04 20:45:20 +00:00
|
|
|
[[ -f $out/$pname/bin/${loName}.png ]] && ln -s $out/$pname/bin/${loName}.png $out/share/pixmaps/${pname}.png
|
|
|
|
[[ -f $out/$pname/bin/${loName}.svg ]] && ln -s $out/$pname/bin/${loName}.svg $out/share/pixmaps/${pname}.svg
|
2022-03-22 16:57:23 +00:00
|
|
|
mv bin/fsnotifier* $out/libexec/${pname}/.
|
2016-01-15 17:18:54 +00:00
|
|
|
|
|
|
|
jdk=${jdk.home}
|
|
|
|
item=${desktopItem}
|
|
|
|
|
2022-03-22 16:57:23 +00:00
|
|
|
makeWrapper "$out/$pname/bin/${loName}.sh" "$out/bin/${pname}" \
|
|
|
|
--prefix PATH : "$out/libexec/${pname}:${lib.makeBinPath [ jdk coreutils gnugrep which git ]}" \
|
2021-02-15 23:03:41 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath ([
|
2017-04-01 08:48:52 +00:00
|
|
|
# Some internals want libstdc++.so.6
|
2021-08-21 12:32:23 +00:00
|
|
|
stdenv.cc.cc.lib libsecret e2fsprogs
|
2018-10-02 09:38:30 +00:00
|
|
|
libnotify
|
2021-02-15 23:03:41 +00:00
|
|
|
] ++ extraLdPath)}" \
|
2021-10-09 21:20:30 +00:00
|
|
|
${lib.concatStringsSep " " extraWrapperArgs} \
|
2022-02-08 14:32:29 +00:00
|
|
|
--set-default JDK_HOME "$jdk" \
|
|
|
|
--set-default ANDROID_JAVA_HOME "$jdk" \
|
|
|
|
--set-default JAVA_HOME "$jdk" \
|
2022-10-08 18:27:38 +00:00
|
|
|
--set-default JETBRAINSCLIENT_JDK "$jdk" \
|
2016-01-15 17:18:54 +00:00
|
|
|
--set ${hiName}_JDK "$jdk" \
|
2020-12-19 22:14:02 +00:00
|
|
|
--set ${hiName}_VM_OPTIONS ${vmoptsFile}
|
2016-01-15 17:18:54 +00:00
|
|
|
|
|
|
|
ln -s "$item/share/applications" $out/share
|
2021-07-03 07:20:31 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2016-01-15 17:18:54 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
} // lib.optionalAttrs (!(meta.license.free or true)) {
|
2019-09-12 20:22:31 +00:00
|
|
|
preferLocalBuild = true;
|
2021-10-30 06:19:46 +00:00
|
|
|
})
|