From b79ab667758a7edceb725aee6f2dddda6f88f984 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 28 Dec 2023 17:07:22 +0100 Subject: [PATCH 1/4] libsidplayfp: 2.5.0 -> 2.5.1 --- pkgs/development/libraries/libsidplayfp/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/libsidplayfp/default.nix b/pkgs/development/libraries/libsidplayfp/default.nix index b8b62781d0a6..e6c1e4cce80c 100644 --- a/pkgs/development/libraries/libsidplayfp/default.nix +++ b/pkgs/development/libraries/libsidplayfp/default.nix @@ -16,16 +16,16 @@ , graphviz }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libsidplayfp"; - version = "2.5.0"; + version = "2.5.1"; src = fetchFromGitHub { owner = "libsidplayfp"; repo = "libsidplayfp"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; fetchSubmodules = true; - sha256 = "sha256-KCp/8UjVl8e3+4s1FD4GvHP7AUAS+eIB7RWhmgm5GIA="; + hash = "sha256-1e1QDSJ8CjLU794saba2auCKko7p2ylrdI0JWhh8Kco="; }; patches = [ @@ -66,7 +66,7 @@ stdenv.mkDerivation rec { "--with-gcrypt" "--with-exsid" ] - ++ lib.optional doCheck "--enable-tests"; + ++ lib.optional finalAttrs.finalPackage.doCheck "--enable-tests"; FONTCONFIG_FILE = lib.optionalString docSupport (makeFontsConf { fontDirectories = [ ]; }); @@ -97,4 +97,4 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ ramkromberg OPNA2608 ]; platforms = platforms.all; }; -} +}) From 6ee837e8f179b2aff8a698fa7d1dfc828e1c070d Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 28 Dec 2023 18:59:17 +0100 Subject: [PATCH 2/4] libsidplayfp: Cleanups & formatting - Use lib.strings.*Feature functions for generating configureFlags - Fetch upstream-submitted patch to fix some flag logic - Move documentation building to buildPhase - Add meta.pkgConfigModules + test - Switch to finalAttrs pattern --- .../libraries/libsidplayfp/default.nix | 85 +++++++++++++------ 1 file changed, 60 insertions(+), 25 deletions(-) diff --git a/pkgs/development/libraries/libsidplayfp/default.nix b/pkgs/development/libraries/libsidplayfp/default.nix index e6c1e4cce80c..fbfdc0b7ff0d 100644 --- a/pkgs/development/libraries/libsidplayfp/default.nix +++ b/pkgs/development/libraries/libsidplayfp/default.nix @@ -4,16 +4,17 @@ , fetchpatch , makeFontsConf , nix-update-script +, testers , autoreconfHook -, pkg-config -, perl -, unittest-cpp -, xa -, libgcrypt -, libexsid , docSupport ? true , doxygen , graphviz +, libexsid +, libgcrypt +, perl +, pkg-config +, unittest-cpp +, xa }: stdenv.mkDerivation (finalAttrs: { @@ -28,14 +29,30 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-1e1QDSJ8CjLU794saba2auCKko7p2ylrdI0JWhh8Kco="; }; + outputs = [ + "out" + ] ++ lib.optionals docSupport [ + "doc" + ]; + patches = [ # Pull autoconf-2.72 compatibility fix: # https://github.com/libsidplayfp/libsidplayfp/pull/103 + # Remove when version > 2.5.1 (fetchpatch { - name = "autoconf-2.72"; - url = "https://github.com/libsidplayfp/libsidplayfp/commit/b8fff55f6aaa005a3899b59e70cd8730f962641b.patch"; + name = "0001-libsidplayfp-autoconf-2.72-compat.patch"; + url = "https://github.com/libsidplayfp/libsidplayfp/commit/2b1b41beb5099d5697e3f8416d78f27634732a9e.patch"; hash = "sha256-5Hk202IuHUBow7HnnPr2/ieWFjKDuHLQjQ9mJUML9q8="; }) + + # Fix --disable-tests logic + # https://github.com/libsidplayfp/libsidplayfp/pull/108 + # Remove when version > 2.5.1 + (fetchpatch { + name = "0002-libsidplayfp-Fix-autoconf-logic-for-tests-option.patch"; + url = "https://github.com/libsidplayfp/libsidplayfp/commit/39dd2893b6186c4932d17b529bb62627b742b742.patch"; + hash = "sha256-ErdfPvu8R81XxdHu2TaV87OpLFlRhJai51QcYUIkUZ4="; + }) ]; postPatch = '' @@ -44,30 +61,35 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; - nativeBuildInputs = [ autoreconfHook pkg-config perl xa ] - ++ lib.optionals docSupport [ doxygen graphviz ]; + nativeBuildInputs = [ + autoreconfHook + perl + pkg-config + xa + ] ++ lib.optionals docSupport [ + doxygen + graphviz + ]; - buildInputs = [ libgcrypt libexsid ]; + buildInputs = [ + libexsid + libgcrypt + ]; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; - - checkInputs = [ unittest-cpp ]; + checkInputs = [ + unittest-cpp + ]; enableParallelBuilding = true; - installTargets = [ "install" ] - ++ lib.optionals docSupport [ "doc" ]; - - outputs = [ "out" ] - ++ lib.optionals docSupport [ "doc" ]; - configureFlags = [ - "--enable-hardsid" - "--with-gcrypt" - "--with-exsid" - ] - ++ lib.optional finalAttrs.finalPackage.doCheck "--enable-tests"; + (lib.strings.enableFeature true "hardsid") + (lib.strings.withFeature true "gcrypt") + (lib.strings.withFeature true "exsid") + (lib.strings.enableFeature finalAttrs.finalPackage.doCheck "tests") + ]; + # Make Doxygen happy with the setup, reduce log noise FONTCONFIG_FILE = lib.optionalString docSupport (makeFontsConf { fontDirectories = [ ]; }); preBuild = '' @@ -75,12 +97,21 @@ stdenv.mkDerivation (finalAttrs: { export XDG_CACHE_HOME=$TMPDIR ''; + buildFlags = [ + "all" + ] ++ lib.optionals docSupport [ + "doc" + ]; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + postInstall = lib.optionalString docSupport '' mkdir -p $doc/share/doc/libsidplayfp mv docs/html $doc/share/doc/libsidplayfp/ ''; passthru = { + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; updateScript = nix-update-script { }; }; @@ -96,5 +127,9 @@ stdenv.mkDerivation (finalAttrs: { license = with licenses; [ gpl2Plus ]; maintainers = with maintainers; [ ramkromberg OPNA2608 ]; platforms = platforms.all; + pkgConfigModules = [ + "libsidplayfp" + "libstilview" + ]; }; }) From 93d26a6f8f20e61a327f60981546f5ff49f2eb3f Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 28 Dec 2023 19:02:21 +0100 Subject: [PATCH 3/4] sidplayfp: 2.5.0 -> 2.5.1 --- pkgs/applications/audio/sidplayfp/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/audio/sidplayfp/default.nix b/pkgs/applications/audio/sidplayfp/default.nix index 3e485e9de4c3..406e14c61e1d 100644 --- a/pkgs/applications/audio/sidplayfp/default.nix +++ b/pkgs/applications/audio/sidplayfp/default.nix @@ -16,13 +16,13 @@ stdenv.mkDerivation rec { pname = "sidplayfp"; - version = "2.5.0"; + version = "2.5.1"; src = fetchFromGitHub { owner = "libsidplayfp"; repo = "sidplayfp"; rev = "v${version}"; - sha256 = "sha256-ECHtHJrkJ5Y0YvDNdMM3VB+s7I/8JCPZiwsPYLM/oig="; + hash = "sha256-oV7ZPWgMEsNlsF2OoOvf7Ah5ZLcVkIDyC+PrPIJGyzQ="; }; nativeBuildInputs = [ autoreconfHook perl pkg-config ]; From f4e3ecb31e90dbcf6aaa4f6b317e2a198b054b06 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 28 Dec 2023 19:13:18 +0100 Subject: [PATCH 4/4] sidplayfp: Cleanups & formatting - Use lib.strings.*Feature functions for generating configureFlags - Add meta.mainProgram - Switch to finalAttrs pattern --- pkgs/applications/audio/sidplayfp/default.nix | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/audio/sidplayfp/default.nix b/pkgs/applications/audio/sidplayfp/default.nix index 406e14c61e1d..31fa49702203 100644 --- a/pkgs/applications/audio/sidplayfp/default.nix +++ b/pkgs/applications/audio/sidplayfp/default.nix @@ -2,38 +2,49 @@ , lib , fetchFromGitHub , nix-update-script -, autoreconfHook -, perl -, pkg-config -, libsidplayfp , alsaSupport ? stdenv.hostPlatform.isLinux , alsa-lib +, autoreconfHook , pulseSupport ? stdenv.hostPlatform.isLinux , libpulseaudio +, libsidplayfp , out123Support ? stdenv.hostPlatform.isDarwin , mpg123 +, perl +, pkg-config }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "sidplayfp"; version = "2.5.1"; src = fetchFromGitHub { owner = "libsidplayfp"; repo = "sidplayfp"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-oV7ZPWgMEsNlsF2OoOvf7Ah5ZLcVkIDyC+PrPIJGyzQ="; }; - nativeBuildInputs = [ autoreconfHook perl pkg-config ]; + strictDeps = true; - buildInputs = [ libsidplayfp ] - ++ lib.optional alsaSupport alsa-lib - ++ lib.optional pulseSupport libpulseaudio - ++ lib.optional out123Support mpg123; + nativeBuildInputs = [ + autoreconfHook + perl + pkg-config + ]; - configureFlags = lib.optionals out123Support [ - "--with-out123" + buildInputs = [ + libsidplayfp + ] ++ lib.optionals alsaSupport [ + alsa-lib + ] ++ lib.optionals pulseSupport [ + libpulseaudio + ] ++ lib.optionals out123Support [ + mpg123 + ]; + + configureFlags = [ + (lib.strings.withFeature out123Support "out123") ]; enableParallelBuilding = true; @@ -46,7 +57,8 @@ stdenv.mkDerivation rec { description = "A SID player using libsidplayfp"; homepage = "https://github.com/libsidplayfp/sidplayfp"; license = with licenses; [ gpl2Plus ]; + mainProgram = "sidplayfp"; maintainers = with maintainers; [ dezgeg OPNA2608 ]; platforms = platforms.all; }; -} +})