e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
66 lines
1.3 KiB
Nix
66 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
SDL2,
|
|
darwin,
|
|
fetchurl,
|
|
freetype,
|
|
harfbuzz,
|
|
libGL,
|
|
pkg-config,
|
|
stdenv,
|
|
testers,
|
|
# Boolean flags
|
|
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "SDL2_ttf";
|
|
version = "2.22.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-${finalAttrs.version}.tar.gz";
|
|
hash = "sha256-1Iy9HOR1ueF4IGvzty1Wtm2E1E9krAWAMyg5YjTWdyM=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
SDL2
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
SDL2
|
|
freetype
|
|
harfbuzz
|
|
]
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
libGL
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
darwin.libobjc
|
|
];
|
|
|
|
configureFlags = [
|
|
(lib.enableFeature false "harfbuzz-builtin")
|
|
(lib.enableFeature false "freetype-builtin")
|
|
(lib.enableFeature enableSdltest "sdltest")
|
|
];
|
|
|
|
strictDeps = true;
|
|
|
|
passthru = {
|
|
tests.pkg-config = testers.hasPkgConfigModules {
|
|
package = finalAttrs.finalPackage;
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
homepage = "https://github.com/libsdl-org/SDL_ttf";
|
|
description = "Support for TrueType (.ttf) font files with Simple Directmedia Layer";
|
|
license = lib.licenses.zlib;
|
|
maintainers = lib.teams.sdl.members
|
|
++ (with lib.maintainers; [ ]);
|
|
inherit (SDL2.meta) platforms;
|
|
pkgConfigModules = [ "SDL2_ttf" ];
|
|
};
|
|
})
|