androidenv: include autoPatchelfHook only on Linux

This is supposed to fix an issue caused by this PR:
https://github.com/NixOS/nixpkgs/pull/163924

Which made `autoPatchelfHook` available only on Linux, resulting in
builds of Android packages failing with:
```
error: Package ‘auto-patchelf-hook’ in /nix/store/...-nixpkgs-source/pkgs/build-support/trivial-builders.nix:73
    is not supported on ‘x86_64-darwin’, refusing to evaluate.
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-05-10 20:38:21 +02:00
parent cceca5842f
commit b0663a3dc3
No known key found for this signature in database
GPG key ID: 09AA5403E54D9931
5 changed files with 42 additions and 35 deletions

View file

@ -1,8 +1,8 @@
{deployAndroidPackage, lib, package, os, autoPatchelfHook, pkgs}:
{deployAndroidPackage, lib, package, os, autoPatchelfHook, pkgs, stdenv}:
deployAndroidPackage {
inherit package os;
nativeBuildInputs = [ autoPatchelfHook ];
nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
buildInputs = lib.optional (os == "linux") [ pkgs.stdenv.cc.libc pkgs.stdenv.cc.cc pkgs.ncurses5 ];
patchInstructions = lib.optionalString (os == "linux") ''
autoPatchelf $packageBaseDir/bin

View file

@ -171,7 +171,7 @@ rec {
cmake = map (version:
import ./cmake.nix {
inherit deployAndroidPackage os autoPatchelfHook pkgs lib;
inherit deployAndroidPackage os autoPatchelfHook pkgs lib stdenv;
package = packages.cmake.${version};
}
) cmakeVersions;
@ -179,7 +179,7 @@ rec {
# Creates a NDK bundle.
makeNdkBundle = ndkVersion:
import ./ndk-bundle {
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgsHostHost lib platform-tools;
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgsHostHost lib platform-tools stdenv;
package = packages.ndk-bundle.${ndkVersion};
};

View file

@ -2,33 +2,35 @@
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook makeWrapper ]
++ lib.optionals (os == "linux") [
pkgs.glibc
pkgs.xorg.libX11
pkgs.xorg.libXext
pkgs.xorg.libXdamage
pkgs.xorg.libXfixes
pkgs.xorg.libxcb
pkgs.xorg.libXcomposite
pkgs.xorg.libXcursor
pkgs.xorg.libXi
pkgs.xorg.libXrender
pkgs.xorg.libXtst
pkgs.libcxx
pkgs.libGL
pkgs.libpulseaudio
pkgs.libuuid
pkgs.zlib
pkgs.ncurses5
pkgs.stdenv.cc.cc
pkgs_i686.glibc
pkgs.expat
pkgs.freetype
pkgs.nss
pkgs.nspr
pkgs.alsa-lib
];
buildInputs = [ makeWrapper ]
++ lib.optionals (os == "linux") (with pkgs; [
autoPatchelfHook
glibc
libcxx
libGL
libpulseaudio
libuuid
zlib
ncurses5
stdenv.cc.cc
i686.glibc
expat
freetype
nss
nspr
alsa-lib
]) ++ (with pkgs.xorg; [
libX11
libXext
libXdamage
libXfixes
libxcb
libXcomposite
libXcursor
libXi
libXrender
libXtst
]);
patchInstructions = lib.optionalString (os == "linux") ''
addAutoPatchelfSearchPath $packageBaseDir/lib
addAutoPatchelfSearchPath $packageBaseDir/lib64

View file

@ -1,4 +1,4 @@
{ lib, pkgs, pkgsHostHost, makeWrapper, autoPatchelfHook
{ stdenv, lib, pkgs, pkgsHostHost, makeWrapper, autoPatchelfHook
, deployAndroidPackage, package, os, platform-tools
}:
@ -9,7 +9,8 @@ let
in
deployAndroidPackage {
inherit package os;
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
nativeBuildInputs = [ makeWrapper ]
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
autoPatchelfIgnoreMissingDeps = true;
buildInputs = lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.python2 pkgs.ncurses5 pkgs.zlib pkgs.libcxx.out pkgs.libxml2 ];
patchInstructions = lib.optionalString (os == "linux") (''

View file

@ -3,8 +3,12 @@
deployAndroidPackage {
name = "androidsdk";
inherit os package;
buildInputs = [ autoPatchelfHook makeWrapper ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.xorg.libX11 pkgs.xorg.libXrender pkgs.xorg.libXext pkgs.fontconfig pkgs.freetype pkgs_i686.glibc pkgs_i686.xorg.libX11 pkgs_i686.xorg.libXrender pkgs_i686.xorg.libXext pkgs_i686.fontconfig.lib pkgs_i686.freetype pkgs_i686.zlib pkgs.fontconfig.lib ];
buildInputs = [ makeWrapper ]
++ lib.optional (os == "linux") (
(with pkgs; [ autoPatchelfHook glibc freetype fontconfig fontconfig.lib])
++ (with pkgs.xorg; [ libX11 libXrender libXext ])
++ (with pkgs_i686; [ glibc xorg.libX11 xorg.libXrender xorg.libXext fontconfig.lib freetype zlib ])
);
patchInstructions = ''
${lib.optionalString (os == "linux") ''