Skip to content

Commit

Permalink
qemu-user-static: Fix merge-conflicts with nixpkgs-unstable
Browse files Browse the repository at this point in the history
Built on top of #160802, this commit
addresses necessary updates to bring it up to parity with `nixpkgs-unstable`:

- Introduce `pipewireSupport: false` as a new override option
- Remove 8.1.1 patch as qemu is 8.2.2 in nixpkgs-unstable
- Introduce new patch to expose libaio static due to upstream meson.build changes

In order to compile, the `perl` dependency must also be fixed
(#299623) on the `pkgsStatic` environment.
With this additional changeset, `nix-shell -p qemu-user-static` compiles.

**Tested on**:
- `x86_64-linux`
- `aarch64-linux`

**Depends on:**
- [ ] #299623
  • Loading branch information
bltavares committed Apr 1, 2024
1 parent af44ef1 commit d01bb6a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
diff --git a/meson.build b/meson.build
index 96de1a6ef9..908d841f6a 100644
index c9c3217ba4..1a8de03f4e 100644
--- a/meson.build
+++ b/meson.build
@@ -420,8 +420,7 @@ zlib = dependency('zlib', required: true, kwargs: static_kwargs)
@@ -986,7 +986,8 @@ zlib = dependency('zlib', required: true)
libaio = not_found
if not get_option('linux_aio').auto() or have_block
libaio = cc.find_library('aio', has_headers: ['libaio.h'],
- required: get_option('linux_aio'),
- kwargs: static_kwargs)
+ required: get_option('linux_aio'))
- required: get_option('linux_aio'))
+ required: get_option('linux_aio'),
+ dirs: [get_option('linux_aio_path')])
endif
linux_io_uring = not_found
if not get_option('linux_io_uring').auto() or have_block

linux_io_uring_test = '''
diff --git a/meson_options.txt b/meson_options.txt
index 0a99a059ec..84d2449de9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -186,6 +186,7 @@ option('libusb', type : 'feature', value : 'auto',
description: 'libusb support for USB passthrough')
option('linux_aio', type : 'feature', value : 'auto',
description: 'Linux AIO support')
+option('linux_aio_path', type: 'string', value: '', description: 'Path for libaio.a')
option('linux_io_uring', type : 'feature', value : 'auto',
description: 'Linux io_uring support')
option('lzfse', type : 'feature', value : 'auto',
14 changes: 10 additions & 4 deletions pkgs/applications/virtualization/qemu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optional nixosTestRunner ./force-uid0-on-9p.patch

# Remove for QEMU 8.1
## FIXME: libaio does not provide a pkg-info file;
# and meson does not support static libraries lookup path using -L, relying on LIBRARY_PATH (https://github.com/mesonbuild/meson/issues/10172);
# and musl-gcc does not support LIBRARY_PATH overrides (https://www.openwall.com/lists/musl/2017/02/22/7);
# so we have to patch the meson.build to add the libaio path to the search path manually.
++ lib.optional stdenv.hostPlatform.isStatic ./aio-find-static-library.patch;

postPatch = ''
Expand Down Expand Up @@ -195,9 +198,12 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional capstoneSupport "--enable-capstone"
++ lib.optional (!pluginsSupport) "--disable-plugins"
++ lib.optional (!enableBlobs) "--disable-install-blobs"

# FIXME: "multiple definition of `strtoll'" with libnbcompat
++ lib.optional stdenv.hostPlatform.isStatic "--static --extra-ldflags=-Wl,--allow-multiple-definition";
++ lib.optionals stdenv.hostPlatform.isStatic [
"--static"
# FIXME: "multiple definition of `strtoll'" with libnbcompat
"--extra-ldflags=-Wl,--allow-multiple-definition"
"-Dlinux_aio_path=${libaio}/lib"
];

dontWrapGApps = true;

Expand Down
1 change: 1 addition & 0 deletions pkgs/applications/virtualization/qemu/user-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let
pulseSupport = false;
sdlSupport = false;
jackSupport = false;
pipewireSupport = false;
gtkSupport = false;
vncSupport = false;
smartcardSupport = false;
Expand Down

0 comments on commit d01bb6a

Please sign in to comment.