about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-12-29 01:36:12 +0100
committerGitHub <noreply@github.com>2022-12-29 01:36:12 +0100
commit6c056bed3a723631798153c516b0d4a176396b2e (patch)
treeea90459e44958f9e5f4b93f5d5f328d02800437b /pkgs
parent7bc51003411d4aebc8b543b2f84da6a0eefa3789 (diff)
parent5e3e81f6048239c821e7663a2371d4cd018b1ef1 (diff)
Merge pull request #205046 from SuperSandro2000/lib-meson
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/wbg/default.nix10
-rw-r--r--pkgs/applications/video/mpv/default.nix26
-rw-r--r--pkgs/development/libraries/fcft/default.nix6
-rw-r--r--pkgs/development/libraries/harfbuzz/default.nix29
4 files changed, 26 insertions, 45 deletions
diff --git a/pkgs/applications/misc/wbg/default.nix b/pkgs/applications/misc/wbg/default.nix
index 0febd846e024b..d5f95961f37ef 100644
--- a/pkgs/applications/misc/wbg/default.nix
+++ b/pkgs/applications/misc/wbg/default.nix
@@ -16,12 +16,6 @@
 , libjpeg
 }:
 
-let
-  # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54
-  mesonFeatureFlag = feature: flag:
-    "-D${feature}=${if flag then "enabled" else "disabled"}";
-in
-
 stdenv.mkDerivation rec {
   pname = "wbg";
   version = "1.0.2";
@@ -52,8 +46,8 @@ stdenv.mkDerivation rec {
   mesonBuildType = "release";
 
   mesonFlags = [
-    (mesonFeatureFlag "png" enablePNG)
-    (mesonFeatureFlag "jpeg" enableJPEG)
+    (lib.mesonEnable "png" enablePNG)
+    (lib.mesonEnable "jpeg" enableJPEG)
   ];
 
   meta = with lib; {
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix
index 88204a47365a2..71fd52f35d885 100644
--- a/pkgs/applications/video/mpv/default.nix
+++ b/pkgs/applications/video/mpv/default.nix
@@ -99,21 +99,19 @@ in stdenv.mkDerivation rec {
 
   NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext ";
 
-  mesonFlags = let
-    inherit (lib) mesonOption mesonBool mesonEnable;
-  in [
-    (mesonOption "default_library" "shared")
-    (mesonBool "libmpv" true)
-    (mesonEnable "libarchive" archiveSupport)
-    (mesonEnable "manpage-build" true)
-    (mesonEnable "cdda" cddaSupport)
-    (mesonEnable "dvbin" dvbinSupport)
-    (mesonEnable "dvdnav" dvdnavSupport)
-    (mesonEnable "openal" openalSupport)
-    (mesonEnable "sdl2" sdl2Support)
+  mesonFlags = [
+    (lib.mesonOption "default_library" "shared")
+    (lib.mesonBool "libmpv" true)
+    (lib.mesonEnable "libarchive" archiveSupport)
+    (lib.mesonEnable "manpage-build" true)
+    (lib.mesonEnable "cdda" cddaSupport)
+    (lib.mesonEnable "dvbin" dvbinSupport)
+    (lib.mesonEnable "dvdnav" dvdnavSupport)
+    (lib.mesonEnable "openal" openalSupport)
+    (lib.mesonEnable "sdl2" sdl2Support)
     # Disable whilst Swift isn't supported
-    (mesonEnable "swift-build" swiftSupport)
-    (mesonEnable "macos-cocoa-cb" swiftSupport)
+    (lib.mesonEnable "swift-build" swiftSupport)
+    (lib.mesonEnable "macos-cocoa-cb" swiftSupport)
   ];
 
   mesonAutoFeatures = "auto";
diff --git a/pkgs/development/libraries/fcft/default.nix b/pkgs/development/libraries/fcft/default.nix
index 5090df411c2f8..453bac74b2c25 100644
--- a/pkgs/development/libraries/fcft/default.nix
+++ b/pkgs/development/libraries/fcft/default.nix
@@ -13,10 +13,6 @@ let
     "grapheme"
     "run"
   ];
-
-  # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54
-  mesonFeatureFlag = feature: flag:
-    "-D${feature}=${if flag then "enabled" else "disabled"}";
 in
 
 stdenv.mkDerivation rec {
@@ -40,7 +36,7 @@ stdenv.mkDerivation rec {
 
   mesonBuildType = "release";
   mesonFlags = builtins.map (t:
-    mesonFeatureFlag "${t}-shaping" (lib.elem t withShapingTypes)
+    lib.mesonEnable "${t}-shaping" (lib.elem t withShapingTypes)
   ) availableShapingTypes;
 
   doCheck = true;
diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index 797b3243ab9a0..977d39ba35687 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -30,16 +30,9 @@
 , qt5
 }:
 
-let
+stdenv.mkDerivation rec {
+  pname = "harfbuzz${lib.optionalString withIcu "-icu"}";
   version = "5.3.1";
-  inherit (lib) optional optionals optionalString;
-  mesonFeatureFlag = feature: flag:
-    "-D${feature}=${if flag then "enabled" else "disabled"}";
-in
-
-stdenv.mkDerivation {
-  pname = "harfbuzz${optionalString withIcu "-icu"}";
-  inherit version;
 
   src = fetchurl {
     url = "https://github.com/harfbuzz/harfbuzz/releases/download/${version}/harfbuzz-${version}.tar.xz";
@@ -72,12 +65,12 @@ stdenv.mkDerivation {
     # and is not part of the library.
     # Cairo causes transitive (build) dependencies on various X11 or other
     # GUI-related libraries, so it shouldn't be re-added lightly.
-    (mesonFeatureFlag "cairo" false)
+    (lib.mesonEnable "cairo" false)
     # chafa is only used in a development utility, not in the library
-    (mesonFeatureFlag "chafa" false)
-    (mesonFeatureFlag "coretext" withCoreText)
-    (mesonFeatureFlag "graphite" withGraphite2)
-    (mesonFeatureFlag "icu" withIcu)
+    (lib.mesonEnable "chafa" false)
+    (lib.mesonEnable "coretext" withCoreText)
+    (lib.mesonEnable "graphite" withGraphite2)
+    (lib.mesonEnable "icu" withIcu)
   ];
 
   depsBuildBuild = [
@@ -99,17 +92,17 @@ stdenv.mkDerivation {
   buildInputs = [ glib freetype gobject-introspection ]
     ++ lib.optionals withCoreText [ ApplicationServices CoreText ];
 
-  propagatedBuildInputs = optional withGraphite2 graphite2
-    ++ optionals withIcu [ icu harfbuzz ];
+  propagatedBuildInputs = lib.optional withGraphite2 graphite2
+    ++ lib.optionals withIcu [ icu harfbuzz ];
 
   doCheck = true;
 
   # Slightly hacky; some pkgs expect them in a single directory.
-  postFixup = optionalString withIcu ''
+  postFixup = lib.optionalString withIcu ''
     rm "$out"/lib/libharfbuzz.* "$dev/lib/pkgconfig/harfbuzz.pc"
     ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.la
     ln -s {'${harfbuzz.dev}',"$dev"}/lib/pkgconfig/harfbuzz.pc
-    ${optionalString stdenv.isDarwin ''
+    ${lib.optionalString stdenv.isDarwin ''
       ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.dylib
       ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.0.dylib
     ''}