nixpkgs/pkgs/by-name/ml/mlx42/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.3 KiB
Nix
Raw Normal View History

2023-09-30 19:26:17 +00:00
{ lib
, stdenv
, fetchFromGitHub
, cmake
, glfw
, darwin
, enableShared ? !stdenv.hostPlatform.isStatic
, enableDebug ? false
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mlx42";
2024-06-10 14:38:43 +00:00
version = "2.3.4";
2023-09-30 19:26:17 +00:00
src = fetchFromGitHub {
owner = "codam-coding-college";
repo = "MLX42";
rev = "v${finalAttrs.version}";
2024-06-10 14:38:43 +00:00
hash = "sha256-c4LoTePHhQeZTx33V1K3ZyXmT7vjB6NdkGVAiSuJKfI=";
2023-09-30 19:26:17 +00:00
};
postPatch = ''
patchShebangs ./tools
''
+ lib.optionalString enableShared ''
substituteInPlace CMakeLists.txt \
--replace "mlx42 STATIC" "mlx42 SHARED"
'';
nativeBuildInputs = [ cmake ];
buildInputs = [ glfw ]
++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ OpenGL Cocoa IOKit ]);
cmakeFlags = [ "-DDEBUG=${toString enableDebug}" ];
postInstall = ''
mkdir -p $out/lib/pkgconfig
substituteAll ${./mlx42.pc} $out/lib/pkgconfig/mlx42.pc
'';
meta = {
changelog = "https://github.com/codam-coding-college/MLX42/releases/tag/${finalAttrs.src.rev}";
2023-09-30 19:26:17 +00:00
description = "Simple cross-platform graphics library that uses GLFW and OpenGL";
homepage = "https://github.com/codam-coding-college/MLX42";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.unix;
};
})