Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkgs/applications/virtualization/qemu/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, stdenv, fetchurl, fetchpatch, python, zlib, pkg-config, glib
, perl, pixman, vde2, alsa-lib, texinfo, flex
, bison, lzo, snappy, libaio, libtasn1, gnutls, nettle, curl, ninja, meson, sigtool
, makeWrapper, autoPatchelfHook
, makeWrapper
, attr, libcap, libcap_ng
, CoreServices, Cocoa, Hypervisor, rez, setfile
, numaSupport ? stdenv.isLinux && !stdenv.isAarch32, numactl
Expand Down Expand Up @@ -53,7 +53,6 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [ makeWrapper python python.pkgs.sphinx python.pkgs.sphinx_rtd_theme pkg-config flex bison meson ninja ]
++ lib.optionals gtkSupport [ wrapGAppsHook ]
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ]
++ lib.optionals stdenv.isDarwin [ sigtool ];

buildInputs = [ zlib glib perl pixman
Expand Down Expand Up @@ -84,6 +83,7 @@ stdenv.mkDerivation rec {
dontUseMesonConfigure = true; # meson's configurePhase isn't compatible with qemu build

outputs = [ "out" "ga" ];
separateDebugInfo = true;

patches = [
./fix-qemu-ga.patch
Expand Down Expand Up @@ -167,6 +167,7 @@ stdenv.mkDerivation rec {

configureFlags = [
"--audio-drv-list=${audio}"
"--disable-strip" # We'll strip ourselves after separating debug info.
"--enable-docs"
"--enable-tools"
"--enable-guest-agent"
Expand Down
14 changes: 10 additions & 4 deletions pkgs/build-support/setup-hooks/separate-debug-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ _separateDebugInfo() {
# Extract the debug info.
header "separating debug info from $i (build ID $id)"
mkdir -p "$dst/${id:0:2}"
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug"
$STRIP --strip-debug "$i"

# Also a create a symlink <original-name>.debug.
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
# This may fail, e.g. if the binary is for a different
# architecture than we're building for. (This happens with
# firmware blobs in QEMU.)
(
$OBJCOPY --only-keep-debug "$i" "$dst/${id:0:2}/${id:2}.debug"
$STRIP --strip-debug "$i"

# Also a create a symlink <original-name>.debug.
ln -sfn ".build-id/${id:0:2}/${id:2}.debug" "$dst/../$(basename "$i")"
) || rmdir -p "$dst/${id:0:2}"
done < <(find "$prefix" -type f -print0)
}