diff --git a/pkgs/by-name/gu/guitarix/package.nix b/pkgs/by-name/gu/guitarix/package.nix index 55cc36dfde98..a1cc284088ce 100644 --- a/pkgs/by-name/gu/guitarix/package.nix +++ b/pkgs/by-name/gu/guitarix/package.nix @@ -8,19 +8,20 @@ curl, eigen, faust, + fetchpatch2, fftwSinglePrec, gettext, glib, glib-networking, glibmm, - adwaita-icon-theme, - gsettings-desktop-schemas, + gperf, gtk3, gtkmm3, hicolor-icon-theme, intltool, ladspaH, libjack2, + liblo, libsndfile, lilv, lrdf, @@ -28,19 +29,30 @@ pkg-config, python3, sassc, - serd, - sord, - sratom, wafHook, + which, wrapGAppsHook3, zita-convolver, zita-resampler, - optimizationSupport ? false, # Enable support for native CPU extensions + + enableFaust ? false, # Transpiles Faust DSP code to C++ + enableGperf ? false, # Regenerates gperf files + enableOptimization ? # Enables support for native CPU extensions + if optimizationSupport != null then + lib.warn "`optimizationSupport` is deprecated in guitarix; use `enableOptimization` instead." optimizationSupport + else + false, + enableNSM ? true, # Enables NSM support + enableSse ? stdenv.hostPlatform.isx86, # Enables support for SSE CPU extensions + optimizationSupport ? null, + withAvahi ? true, + withBluez ? stdenv.hostPlatform.isLinux, + withLiblo ? enableNSM, + withZitaConvolver ? true, + withZitaResampler ? true, }: -let - inherit (lib) optional; -in +assert enableNSM -> withLiblo; stdenv.mkDerivation (finalAttrs: { pname = "guitarix"; @@ -49,36 +61,40 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "brummer10"; repo = "guitarix"; - rev = "V${finalAttrs.version}"; + tag = "V${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-YQqcpdehfC9UE1OowC1/YUw2eWgbLWMbAJ3V5tVmtiU="; }; sourceRoot = "${finalAttrs.src.name}/trunk"; + strictDeps = true; + nativeBuildInputs = [ gettext hicolor-icon-theme intltool pkg-config python3 + sassc wafHook wrapGAppsHook3 - ]; + ] + ++ lib.optionals enableFaust [ + faust + which + ] + ++ lib.optional enableGperf gperf; buildInputs = [ - avahi - bluez boost curl eigen - faust fftwSinglePrec + gettext glib glib-networking.out glibmm - adwaita-icon-theme - gsettings-desktop-schemas gtk3 gtkmm3 ladspaH @@ -87,14 +103,34 @@ stdenv.mkDerivation (finalAttrs: { lilv lrdf lv2 - sassc - serd - sord - sratom - zita-convolver - zita-resampler + ] + ++ lib.optional withAvahi avahi + ++ lib.optional withBluez bluez + ++ lib.optional withLiblo liblo + ++ lib.optional withZitaConvolver zita-convolver + ++ lib.optional withZitaResampler zita-resampler; + + patchFlags = [ "-p2" ]; + patches = [ + # Remove the mandatory check for `boost_system` which was removed in boost 1.89 + (fetchpatch2 { + name = "make-boost-system-stub-optional.patch"; + url = "https://github.com/brummer10/guitarix/compare/v0.47.0..187670358ffc47a0fa09e140586b2e88dfdcf043.patch?full_index=1"; + hash = "sha256-9Z0sAM/oTm3ejv9chDbXEpkjNvlX/SN+k48XaJTqdy0="; + includes = [ + "trunk/waf" + "*/wscript" + "trunk/waftools/*.py" + ]; + }) ]; + # There are many bad shebangs which can fail builds. + # See `https://github.com/brummer10/guitarix/issues/246`. + postPatch = '' + patchShebangs --build tools/** + ''; + wafConfigureFlags = [ "--no-font-cache-update" "--shared-lib" @@ -102,34 +138,34 @@ stdenv.mkDerivation (finalAttrs: { "--enable-nls" "--install-roboto-font" ] - ++ optional optimizationSupport "--optimization"; - - env.NIX_CFLAGS_COMPILE = toString [ "-fpermissive" ]; + # Use explicit flags to guarantee correct configuration + ++ lib.optional enableFaust "--faust" # Force waf to use the provided faust + ++ lib.optional (!enableFaust) "--no-faust" + ++ lib.optional (!enableNSM) "--no-nsm" + ++ lib.optional enableOptimization "--optimization" + ++ lib.optional (!enableSse) "--disable-sse" + ++ lib.optional (!withAvahi) "--no-avahi" + ++ lib.optional (!withBluez) "--no-bluez" + ++ lib.optional (!withZitaConvolver) "--includeconvolver" + ++ lib.optional (!withZitaResampler) "--includeresampler"; meta = { description = "Virtual guitar amplifier for Linux running with JACK"; mainProgram = "guitarix"; longDescription = '' - guitarix is a virtual guitar amplifier for Linux running with - JACK (Jack Audio Connection Kit). It is free as in speech and - free as in beer. Its free sourcecode allows to build it for - other UNIX-like systems also, namely for BSD and for MacOSX. + Guitarix takes the signal from your guitar as any real amp would do: as a + mono-signal from your sound card. Your tone is processed by a main amp and + a rack-section. Both can be routed separately and deliver a processed + stereo-signal via JACK. You may fill the rack with effects from more than + 25 built-in modules spanning from a simple noise-gate to brain-slashing + modulation-fx like flanger, phaser or auto-wah. Your signal is processed + with minimum latency. On a properly set-up Linux-system you do not need to + wait for more than 10 milliseconds for your playing to be delivered, + processed by guitarix. - It takes the signal from your guitar as any real amp would do: - as a mono-signal from your sound card. Your tone is processed by - a main amp and a rack-section. Both can be routed separately and - deliver a processed stereo-signal via JACK. You may fill the - rack with effects from more than 25 built-in modules spanning - from a simple noise-gate to brain-slashing modulation-fx like - flanger, phaser or auto-wah. Your signal is processed with - minimum latency. On any properly set-up Linux-system you do not - need to wait for more than 10 milli-seconds for your playing to - be delivered, processed by guitarix. - - guitarix offers the range of sounds you would expect from a - full-featured universal guitar-amp. You can get crisp - clean-sounds, nice overdrive, fat distortion and a diversity of - crazy sounds never heard before. + Guitarix offers the range of sounds you would expect from a full-featured + universal guitar-amp. You can get crisp clean-sounds, nice overdrive, fat + distortion and a diversity of crazy sounds never heard before. ''; homepage = "https://github.com/brummer10/guitarix"; license = lib.licenses.gpl3Plus; @@ -137,6 +173,7 @@ stdenv.mkDerivation (finalAttrs: { lord-valen anderscs ]; + # TODO: This potentially also works on darwin and BSD. platforms = lib.platforms.linux; }; })