From f2b7738e26120a06d921f20ec0a5ae9da9b36c9c Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 10 Mar 2024 12:28:21 -0300 Subject: [PATCH 1/2] xemu: migrate to by-name --- .../emulators/xemu/default.nix => by-name/xe/xemu/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{applications/emulators/xemu/default.nix => by-name/xe/xemu/package.nix} (100%) diff --git a/pkgs/applications/emulators/xemu/default.nix b/pkgs/by-name/xe/xemu/package.nix similarity index 100% rename from pkgs/applications/emulators/xemu/default.nix rename to pkgs/by-name/xe/xemu/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a8f0f5f46101..fd8ddc0f8139 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2833,8 +2833,6 @@ with pkgs; xcpc = callPackage ../applications/emulators/xcpc { }; - xemu = callPackage ../applications/emulators/xemu { }; - yapesdl = callPackage ../applications/emulators/yapesdl { }; zsnes = pkgsi686Linux.callPackage ../applications/emulators/zsnes { }; From 8e4b61dc907e02ece07bf1ab93e7d329026b5357 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 24 Mar 2024 19:55:23 -0300 Subject: [PATCH 2/2] xemu: refactor - pick Python packages from python3Packages - patch things should go to patchPhase --- pkgs/by-name/xe/xemu/package.nix | 47 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/pkgs/by-name/xe/xemu/package.nix b/pkgs/by-name/xe/xemu/package.nix index 08cac956b5a1..7fc390049cb9 100644 --- a/pkgs/by-name/xe/xemu/package.nix +++ b/pkgs/by-name/xe/xemu/package.nix @@ -1,9 +1,8 @@ { lib -, stdenv -, fetchFromGitHub , SDL2 , SDL2_image , copyDesktopItems +, fetchFromGitHub , gettext , glib , gtk3 @@ -20,7 +19,8 @@ , openssl , perl , pkg-config -, python3 +, python3Packages +, stdenv , vte , which , wrapGAppsHook @@ -34,8 +34,8 @@ stdenv.mkDerivation (finalAttrs: { owner = "xemu-project"; repo = "xemu"; rev = "v${finalAttrs.version}"; - hash = "sha256-FFxYp53LLDOPZ1Inr70oyQXhNjJO23G+gNmXd/lvrYs="; fetchSubmodules = true; + hash = "sha256-FFxYp53LLDOPZ1Inr70oyQXhNjJO23G+gNmXd/lvrYs="; }; nativeBuildInputs = [ @@ -44,11 +44,12 @@ stdenv.mkDerivation (finalAttrs: { ninja perl pkg-config - python3 - python3.pkgs.pyyaml which wrapGAppsHook - ]; + ] ++ (with python3Packages; [ + python + pyyaml + ]); buildInputs = [ SDL2 @@ -91,13 +92,18 @@ stdenv.mkDerivation (finalAttrs: { }) ]; - preConfigure = '' + postPatch = '' patchShebangs . - configureFlagsArray+=("--extra-cflags=-DXBOX=1 -Wno-error=redundant-decls") substituteInPlace ./scripts/xemu-version.sh \ --replace 'date -u' "date -d @$SOURCE_DATE_EPOCH '+%Y-%m-%d %H:%M:%S'" - # When the data below can't be obtained through git, the build process tries - # to run `XEMU_COMMIT=$(cat XEMU_COMMIT)` (and similar) + ''; + + preConfigure = '' + configureFlagsArray+=("--extra-cflags=-DXBOX=1 -Wno-error=redundant-decls") + '' + + # When the data below can't be obtained through git, the build process tries + # to run `XEMU_COMMIT=$(cat XEMU_COMMIT)` (and similar) + '' echo '${finalAttrs.version}' > XEMU_VERSION ''; @@ -106,18 +112,19 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace ./build.ninja --replace /usr/bin/env $(which env) ''; - installPhase = '' + installPhase = let + installIcon = resolution: '' + install -Dm644 -T ../ui/icons/xemu_${resolution}.png \ + $out/share/icons/hicolor/${resolution}/apps/xemu.png + ''; + in '' runHook preInstall install -Dm755 -T qemu-system-i386 $out/bin/xemu '' + - # Generate code to install the icons - (lib.concatMapStringsSep ";\n" - (res: - "install -Dm644 -T ../ui/icons/xemu_${res}.png $out/share/icons/hicolor/${res}/apps/xemu.png") - [ "16x16" "24x24" "32x32" "48x48" "128x128" "256x256" "512x512" ]) + + (lib.concatMapStringsSep "\n" installIcon + [ "16x16" "24x24" "32x32" "48x48" "128x128" "256x256" "512x512" ]) + "\n" + '' - runHook postInstall ''; @@ -131,8 +138,8 @@ stdenv.mkDerivation (finalAttrs: { ''; changelog = "https://github.com/xemu-project/xemu/releases/tag/v${finalAttrs.version}"; license = lib.licenses.gpl2Plus; - maintainers = with lib.maintainers; [ AndersonTorres genericnerdyusername ]; - platforms = lib.platforms.linux; mainProgram = "xemu"; + maintainers = with lib.maintainers; [ AndersonTorres ]; + platforms = lib.platforms.linux; }; })