Merge pull request #205046 from SuperSandro2000/lib-meson

This commit is contained in:
Sandro 2022-12-29 01:36:12 +01:00 committed by GitHub
commit 6c056bed3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 45 deletions

View file

@ -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; {

View file

@ -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";

View file

@ -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;

View file

@ -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
''}