a66bca1520
GitOrigin-RevId: 40f79f003b6377bd2f4ed4027dde1f8f922995dd
62 lines
2.2 KiB
Nix
62 lines
2.2 KiB
Nix
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgsi686Linux, postInstall ? ""}:
|
|
|
|
deployAndroidPackage {
|
|
name = "androidsdk";
|
|
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
|
|
buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXdamage pkgs.xorg.libxcb pkgs.xorg.libXfixes pkgs.xorg.libXrender pkgs.fontconfig.lib pkgs.freetype pkgs.libGL pkgs.zlib pkgs.ncurses5 pkgs.libpulseaudio pkgsi686Linux.glibc pkgsi686Linux.xorg.libX11 pkgsi686Linux.xorg.libXrender pkgsi686Linux.fontconfig pkgsi686Linux.freetype pkgsi686Linux.zlib ];
|
|
inherit package os;
|
|
|
|
patchInstructions = ''
|
|
${lib.optionalString (os == "linux") ''
|
|
# Auto patch all binaries
|
|
addAutoPatchelfSearchPath $PWD/lib64
|
|
addAutoPatchelfSearchPath $PWD/lib64/libstdc++
|
|
addAutoPatchelfSearchPath $PWD/lib64/qt/lib
|
|
addAutoPatchelfSearchPath $PWD/lib
|
|
addAutoPatchelfSearchPath $PWD/lib/libstdc++
|
|
autoPatchelf .
|
|
''}
|
|
|
|
# Wrap all scripts that require JAVA_HOME
|
|
for i in bin
|
|
do
|
|
find $i -maxdepth 1 -type f -executable | while read program
|
|
do
|
|
if grep -q "JAVA_HOME" $program
|
|
then
|
|
wrapProgram $PWD/$program --prefix PATH : ${pkgs.jdk8}/bin
|
|
fi
|
|
done
|
|
done
|
|
|
|
# Wrap programs that require java
|
|
for i in draw9patch jobb lint screenshot2
|
|
do
|
|
wrapProgram $PWD/$i \
|
|
--prefix PATH : ${pkgs.jdk8}/bin
|
|
done
|
|
|
|
# Wrap programs that require java and SWT
|
|
for i in android ddms hierarchyviewer monitor monkeyrunner traceview uiautomatorviewer
|
|
do
|
|
wrapProgram $PWD/$i \
|
|
--prefix PATH : ${pkgs.jdk8}/bin \
|
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pkgs.xorg.libX11 pkgs.xorg.libXtst ]}
|
|
done
|
|
|
|
${lib.optionalString (os == "linux") ''
|
|
wrapProgram $PWD/emulator \
|
|
--prefix PATH : ${pkgs.file}/bin:${pkgs.glxinfo}/bin:${pkgs.pciutils}/bin \
|
|
--set QT_XKB_CONFIG_ROOT ${pkgs.xkeyboard_config}/share/X11/xkb \
|
|
--set QTCOMPOSE ${pkgs.xorg.libX11.out}/share/X11/locale
|
|
''}
|
|
|
|
# Patch all script shebangs
|
|
patchShebangs .
|
|
|
|
cd ..
|
|
${postInstall}
|
|
'';
|
|
|
|
meta.license = lib.licenses.unfree;
|
|
}
|