2024-09-21 12:53:12 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
cmake,
|
|
|
|
glfw,
|
|
|
|
darwin,
|
|
|
|
enableShared ? !stdenv.hostPlatform.isStatic,
|
|
|
|
enableDebug ? false,
|
2023-09-30 19:26:17 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "mlx42";
|
2024-10-16 14:56:31 +00:00
|
|
|
version = "2.4.0";
|
2023-09-30 19:26:17 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "codam-coding-college";
|
|
|
|
repo = "MLX42";
|
2024-09-21 12:53:12 +00:00
|
|
|
rev = "refs/tags/v${finalAttrs.version}";
|
2024-10-16 14:56:31 +00:00
|
|
|
hash = "sha256-jYcBvvx0Xfc/wDWSUROfQeRvn+tWvSS0ymKO1iuzg8w=";
|
2023-09-30 19:26:17 +00:00
|
|
|
};
|
|
|
|
|
2024-09-21 12:53:12 +00:00
|
|
|
postPatch =
|
|
|
|
''
|
|
|
|
patchShebangs --build ./tools
|
|
|
|
''
|
|
|
|
+ lib.optionalString enableShared ''
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace-fail "mlx42 STATIC" "mlx42 SHARED"
|
|
|
|
'';
|
|
|
|
|
|
|
|
strictDeps = true;
|
2023-09-30 19:26:17 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2024-09-21 12:53:12 +00:00
|
|
|
buildInputs =
|
|
|
|
[ glfw ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin (
|
|
|
|
with darwin.apple_sdk.frameworks;
|
|
|
|
[
|
|
|
|
OpenGL
|
|
|
|
Cocoa
|
|
|
|
IOKit
|
|
|
|
]
|
|
|
|
);
|
2023-09-30 19:26:17 +00:00
|
|
|
|
2024-09-21 12:53:12 +00:00
|
|
|
cmakeFlags = [ (lib.cmakeBool "DEBUG" enableDebug) ];
|
2023-09-30 19:26:17 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
substituteAll ${./mlx42.pc} $out/lib/pkgconfig/mlx42.pc
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2024-09-21 12:53:12 +00:00
|
|
|
changelog = "https://github.com/codam-coding-college/MLX42/releases/tag/v${finalAttrs.version}";
|
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;
|
|
|
|
};
|
|
|
|
})
|