idea: unpin the common builder
This commit is contained in:
@@ -0,0 +1,71 @@
|
|||||||
|
{ stdenv, fetchurl, makeDesktopItem, makeWrapper, patchelf, p7zip
|
||||||
|
, coreutils, gnugrep, which, git, python, unzip, androidsdk }:
|
||||||
|
|
||||||
|
{ name, product, version, build, src, meta, jdk } @ attrs:
|
||||||
|
|
||||||
|
with stdenv.lib;
|
||||||
|
|
||||||
|
let loName = toLower product;
|
||||||
|
hiName = toUpper product;
|
||||||
|
execName = concatStringsSep "-" (init (splitString "-" name));
|
||||||
|
in
|
||||||
|
|
||||||
|
with stdenv; lib.makeOverridable mkDerivation rec {
|
||||||
|
inherit name build src meta;
|
||||||
|
desktopItem = makeDesktopItem {
|
||||||
|
name = execName;
|
||||||
|
exec = execName;
|
||||||
|
comment = lib.replaceChars ["\n"] [" "] meta.longDescription;
|
||||||
|
desktopName = product;
|
||||||
|
genericName = meta.description;
|
||||||
|
categories = "Application;Development;";
|
||||||
|
icon = execName;
|
||||||
|
};
|
||||||
|
|
||||||
|
buildInputs = [ makeWrapper patchelf p7zip unzip ];
|
||||||
|
|
||||||
|
patchPhase = ''
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
interpreter=$(echo ${stdenv.glibc}/lib/ld-linux*.so.2)
|
||||||
|
if [ "${stdenv.system}" == "x86_64-linux" ]; then
|
||||||
|
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 = ''
|
||||||
|
mkdir -p $out/{bin,$name,share/pixmaps,libexec/${name}}
|
||||||
|
cp -a . $out/$name
|
||||||
|
ln -s $out/$name/bin/${loName}.png $out/share/pixmaps/${execName}.png
|
||||||
|
mv bin/fsnotifier* $out/libexec/${name}/.
|
||||||
|
|
||||||
|
jdk=${jdk.home}
|
||||||
|
item=${desktopItem}
|
||||||
|
|
||||||
|
makeWrapper "$out/$name/bin/${loName}.sh" "$out/bin/${execName}" \
|
||||||
|
--prefix PATH : "$out/libexec/${name}:${jdk}/bin:${coreutils}/bin:${gnugrep}/bin:${which}/bin:${git}/bin" \
|
||||||
|
--set JDK_HOME "$jdk" \
|
||||||
|
--set ${hiName}_JDK "$jdk" \
|
||||||
|
--set ANDROID_JAVA_HOME "$jdk" \
|
||||||
|
--set JAVA_HOME "$jdk"
|
||||||
|
|
||||||
|
ln -s "$item/share/applications" $out/share
|
||||||
|
'';
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,82 +1,19 @@
|
|||||||
{ stdenv, fetchurl, makeDesktopItem, makeWrapper, patchelf, p7zip, oraclejdk8
|
{ stdenv, callPackage, fetchurl, makeDesktopItem, makeWrapper, patchelf
|
||||||
, coreutils, gnugrep, which, git, python, unzip, androidsdk
|
, coreutils, gnugrep, which, git, python, unzip, p7zip
|
||||||
|
, androidsdk, jdk, oraclejdk8
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert stdenv.isLinux;
|
assert stdenv.isLinux;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# After IDEA 15 we can no longer use OpenJDK.
|
bnumber = with stdenv.lib; build: last (splitString "-" build);
|
||||||
# https://youtrack.jetbrains.com/issue/IDEA-147272
|
mkIdeaProduct' = callPackage ./common.nix { };
|
||||||
jdk = oraclejdk8;
|
mkIdeaProduct = attrs: mkIdeaProduct' ({
|
||||||
|
# After IDEA 15 we can no longer use OpenJDK.
|
||||||
mkIdeaProduct = with stdenv.lib;
|
# https://youtrack.jetbrains.com/issue/IDEA-147272
|
||||||
{ name, product, version, build, src, meta }:
|
jdk = if (bnumber attrs.build) < "143" then jdk else oraclejdk8;
|
||||||
|
} // attrs);
|
||||||
let loName = toLower product;
|
|
||||||
hiName = toUpper product;
|
|
||||||
execName = concatStringsSep "-" (init (splitString "-" name));
|
|
||||||
in
|
|
||||||
|
|
||||||
with stdenv; lib.makeOverridable mkDerivation rec {
|
|
||||||
inherit name build src meta;
|
|
||||||
desktopItem = makeDesktopItem {
|
|
||||||
name = execName;
|
|
||||||
exec = execName;
|
|
||||||
comment = lib.replaceChars ["\n"] [" "] meta.longDescription;
|
|
||||||
desktopName = product;
|
|
||||||
genericName = meta.description;
|
|
||||||
categories = "Application;Development;";
|
|
||||||
icon = execName;
|
|
||||||
};
|
|
||||||
|
|
||||||
buildInputs = [ makeWrapper patchelf p7zip unzip ];
|
|
||||||
|
|
||||||
patchPhase = ''
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
interpreter=$(echo ${stdenv.glibc}/lib/ld-linux*.so.2)
|
|
||||||
if [ "${stdenv.system}" == "x86_64-linux" ]; then
|
|
||||||
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 = ''
|
|
||||||
mkdir -p $out/{bin,$name,share/pixmaps,libexec/${name}}
|
|
||||||
cp -a . $out/$name
|
|
||||||
ln -s $out/$name/bin/${loName}.png $out/share/pixmaps/${execName}.png
|
|
||||||
mv bin/fsnotifier* $out/libexec/${name}/.
|
|
||||||
|
|
||||||
jdk=${jdk.home}
|
|
||||||
item=${desktopItem}
|
|
||||||
|
|
||||||
makeWrapper "$out/$name/bin/${loName}.sh" "$out/bin/${execName}" \
|
|
||||||
--prefix PATH : "$out/libexec/${name}:${jdk}/bin:${coreutils}/bin:${gnugrep}/bin:${which}/bin:${git}/bin" \
|
|
||||||
--set JDK_HOME "$jdk" \
|
|
||||||
--set ${hiName}_JDK "$jdk" \
|
|
||||||
--set ANDROID_JAVA_HOME "$jdk" \
|
|
||||||
--set JAVA_HOME "$jdk"
|
|
||||||
|
|
||||||
ln -s "$item/share/applications" $out/share
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
buildAndroidStudio = { name, version, build, src, license, description }:
|
buildAndroidStudio = { name, version, build, src, license, description }:
|
||||||
let drv = (mkIdeaProduct rec {
|
let drv = (mkIdeaProduct rec {
|
||||||
|
|||||||
Reference in New Issue
Block a user