2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
|
|
|
, glfw
|
|
|
|
, darwin
|
|
|
|
, enableShared ? !stdenv.hostPlatform.isStatic
|
|
|
|
, enableDebug ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "mlx42";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "2.3.3";
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "codam-coding-college";
|
|
|
|
repo = "MLX42";
|
2024-01-02 11:29:13 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-igkTeOnqGYBISzmtDGlDx9cGJjoQ8fzXtVSR9hU4F5E=";
|
2023-10-09 19:29:22 +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 = {
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/codam-coding-college/MLX42/releases/tag/${finalAttrs.src.rev}";
|
2023-10-09 19:29:22 +00:00
|
|
|
description = "A 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;
|
|
|
|
};
|
|
|
|
})
|