libretro-genode/upstream.nix

61 lines
1.5 KiB
Nix

{ nixpkgs ? import <nixpkgs> {} }:
let
inherit (nixpkgs) stdenv fetchgit git tup pkg-config;
toolchain = import ./toolchain.nix { inherit nixpkgs; };
version = "19.07-322-gfe24051cd";
in
stdenv.mkDerivation {
name = "genode";
outputs = [ "out" "dev" ];
inherit version;
src = fetchgit {
url = "git://depot.h4ck.me/srv/git/genode";
rev = "fe24051cd811d5e769104ffd7228d35a72a3d93c";
sha256 = "09wl7q1xc7fvnj8zcb4ix1ipqzxrgp6sbdsqp92r2gxqkadyrpxc";
};
nativeBuildInputs =
[ toolchain
stdenv.glibc.dev
git tup pkg-config
];
configurePhase =
''
# Populate the SDK headers
mkdir -p $out $dev/include $dev/pkg-config $dev/lib
cp -r repos/base/src/ld $dev/ld
cp -r repos/base/include $dev/include/base
cp -r repos/os/include $dev/include/os
# Use specialized build configuration
substitute configs/nix-x86_64.config tup.config \
--replace @NIX_DEV_OUTPUT@ $dev \
--replace @NIX_DEPOT_VERSION@ ${version} \
# Scan repository and generate script
mkdir lib
tup init
tup generate buildPhase.sh
# Redirect SDK artifacts
rm -r depot lib
ln -s $out depot
ln -s $dev/pkg-config pkg-config
ln -s $dev/lib lib
'';
buildPhase =
''
local HOST_LIBC=${stdenv.glibc.dev}
set -v
source buildPhase.sh
'';
# Use "genode-base.pc" when not building internals
installPhase = "rm $dev/pkg-config/base.pc";
}