diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/rutabaga_gfx')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/rutabaga_gfx/darwin-install.patch | 31 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/rutabaga_gfx/default.nix | 73 |
2 files changed, 104 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/rutabaga_gfx/darwin-install.patch b/nixpkgs/pkgs/development/libraries/rutabaga_gfx/darwin-install.patch new file mode 100644 index 000000000000..0b68ec2beb85 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/rutabaga_gfx/darwin-install.patch @@ -0,0 +1,31 @@ +diff --git a/rutabaga_gfx/ffi/Makefile b/rutabaga_gfx/ffi/Makefile +index f8c7820bf..e88a6c308 100644 +--- a/rutabaga_gfx/ffi/Makefile ++++ b/rutabaga_gfx/ffi/Makefile +@@ -47,24 +47,16 @@ build: + cargo build $(gfxstream_feature) $(release) + + install: build +-ifeq ($(UNAME), Linux) + install -D -m 755 $(OUT)/$(LIB_NAME) $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) +-endif + ifeq ($(UNAME), Darwin) +- install_name_tool -id $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME) ++ install_name_tool -id $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION) + endif + + ln -sf $(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME).$(RUTABAGA_VERSION_MAJOR) + ln -sf $(LIB_NAME).$(RUTABAGA_VERSION) $(DESTDIR)$(libdir)/$(LIB_NAME) + +-ifeq ($(UNAME), Linux) + install -D -m 0644 $(SRC)/share/rutabaga_gfx_ffi.pc $(DESTDIR)$(libdir)/pkgconfig/rutabaga_gfx_ffi.pc + install -D -m 0644 $(SRC)/include/rutabaga_gfx_ffi.h $(DESTDIR)$(includedir)/rutabaga_gfx_ffi.h +-endif +-ifeq ($(UNAME), Darwin) +- install -m 0644 $(SRC)/share/rutabaga_gfx_ffi.pc $(DESTDIR)$(libdir)/pkgconfig/rutabaga_gfx_ffi.pc +- install -m 0644 $(SRC)/include/rutabaga_gfx_ffi.h $(DESTDIR)$(includedir)/rutabaga_gfx_ffi.h +-endif + + clean: + cargo clean $(release) + diff --git a/nixpkgs/pkgs/development/libraries/rutabaga_gfx/default.nix b/nixpkgs/pkgs/development/libraries/rutabaga_gfx/default.nix new file mode 100644 index 000000000000..687500272735 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/rutabaga_gfx/default.nix @@ -0,0 +1,73 @@ +{ lib +, stdenv +, fetchgit +, fetchpatch +, cargo +, pkg-config +, rustPlatform +, aemu +, gfxstream +, libdrm +, libiconv +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rutabaga_gfx"; + version = "0.1.2"; + + src = fetchgit { + url = "https://chromium.googlesource.com/crosvm/crosvm"; + rev = "v${finalAttrs.version}-rutabaga-release"; + fetchSubmodules = true; + hash = "sha256-0RJDKzeU7U6hc6CLKks8QcRs3fxN+/LYUbB0t6W790M="; + }; + + patches = [ + # Make gfxstream optional + # https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4860836 + (fetchpatch { + url = "https://chromium.googlesource.com/crosvm/crosvm/+/c3ad0e43eb12cbf737a6049e0134d483e337363f%5E%21/?format=TEXT"; + decode = "base64 -d"; + hash = "sha256-Ji1bK7jnRlg0OpDfCLcTHfPSiz3zYcdgsWL4n3EoIYI="; + }) + # Fix error in Makefile where it uses eight spaces instead of a tab + # https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4863380 + (fetchpatch { + url = "https://chromium.googlesource.com/crosvm/crosvm/+/fc415bccc43d36f63a2fd4c28878591bb1053450%5E%21/?format=TEXT"; + decode = "base64 -d"; + hash = "sha256-SLzlZ4o1+R2bGTPvA0a5emq97hOIIIHrubFhcQjqYwg="; + }) + # Install the dylib on Darwin. + ./darwin-install.patch + ]; + + nativeBuildInputs = [ cargo pkg-config rustPlatform.cargoSetupHook ]; + buildInputs = [ libiconv ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform gfxstream) ([ + aemu + gfxstream + ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libdrm) [ + libdrm + ]); + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit (finalAttrs) src; + hash = "sha256-wuF3Isrp+u5J8jPQoPsIOWYGNKLSNa2pLfvladAWkLs="; + }; + + # make install always rebuilds + dontBuild = true; + + makeFlags = [ "prefix=$(out)" ]; + + preInstall = '' + cd rutabaga_gfx/ffi + ''; + + meta = with lib; { + homepage = "https://crosvm.dev/book/appendix/rutabaga_gfx.html"; + description = "cross-platform abstraction for GPU and display virtualization"; + license = licenses.bsd3; + maintainers = with maintainers; [ qyliss ]; + platforms = platforms.darwin ++ platforms.linux; + }; +}) |