42 lines
1.2 KiB
Nix
42 lines
1.2 KiB
Nix
|
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
||
|
#
|
||
|
# SPDX-License-Identifier: MIT
|
||
|
|
||
|
{ stdenv, version, fetch, cmake, fetchpatch
|
||
|
, enableShared ? true
|
||
|
, isBaremetal ? false }:
|
||
|
|
||
|
let
|
||
|
enableShared' = if stdenv.targetPlatform ? isGenode then
|
||
|
!stdenv.targetPlatform.isGenode
|
||
|
else
|
||
|
false;
|
||
|
in
|
||
|
stdenv.mkDerivation {
|
||
|
pname = "libunwind";
|
||
|
inherit version;
|
||
|
|
||
|
src = fetch "libunwind" "0vhgcgzsb33l83qaikrkj87ypqb48mi607rccczccwiiv8ficw0q";
|
||
|
|
||
|
nativeBuildInputs = [ cmake ];
|
||
|
|
||
|
patches = [
|
||
|
(fetchpatch {
|
||
|
url = "https://github.com/llvm-mirror/libunwind/commit/34a45c630d4c79af403661d267db42fbe7de1178.patch";
|
||
|
sha256 = "0n0pv6jvcky8pn3srhrf9x5kbnd0d2kia9xlx2g590f5q0bgwfhv";
|
||
|
})
|
||
|
(fetchpatch {
|
||
|
url = "https://github.com/llvm-mirror/libunwind/commit/e050272d2eb57eb4e56a37b429a61df2ebb8aa3e.patch";
|
||
|
sha256 = "1sxyx5xnax8k713jjcxgq3jq3cpnxygs2rcdf5vfja0f2k9jzldl";
|
||
|
})
|
||
|
] ++ stdenv.lib.optionals stdenv.hostPlatform.isGenode [
|
||
|
./libunwind-genode.patch
|
||
|
];
|
||
|
|
||
|
enableParallelBuilding = true;
|
||
|
|
||
|
cmakeFlags = [ ]
|
||
|
++ stdenv.lib.optional (!enableShared') "-DLIBUNWIND_ENABLE_SHARED=OFF"
|
||
|
++ stdenv.lib.optional isBaremetal "-DLIBUNWIND_IS_BAREMETAL=ON";
|
||
|
}
|