8 , enableShared ? !stdenv.hostPlatform.isStatic
12 stdenv.mkDerivation (finalAttrs: {
16 src = fetchFromGitHub {
17 owner = "codam-coding-college";
19 rev = "refs/tags/v${finalAttrs.version}";
20 hash = "sha256-JCBV8NWibSugqXkbgP0v3gDfaaMNFYztWpBRfHJUG8E=";
25 name = "add-cmake-install.patch";
26 url = "https://github.com/codam-coding-college/MLX42/commit/a51ca8e0ec3fb793fa96d710696dcee8a4fe57d6.patch";
27 hash = "sha256-i+0yHZVvfTG19BGVrz7GuEuBw3B7lylCPEvx07il23M=";
34 + lib.optionalString enableShared ''
35 substituteInPlace CMakeLists.txt \
36 --replace "mlx42 STATIC" "mlx42 SHARED"
39 nativeBuildInputs = [ cmake ];
41 buildInputs = [ glfw ]
42 ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ OpenGL Cocoa IOKit ]);
44 cmakeFlags = [ "-DDEBUG=${toString enableDebug}" ];
47 mkdir -p $out/lib/pkgconfig
48 substituteAll ${./mlx42.pc} $out/lib/pkgconfig/mlx42.pc
50 # This file was removed after 2.3.2, so the used patch doesn't copy this file
51 # This line can be removed after the next release
52 cp $src/include/MLX42/MLX42_Input.h $out/include/MLX42
56 description = "A simple cross-platform graphics library that uses GLFW and OpenGL";
57 homepage = "https://github.com/codam-coding-college/MLX42";
58 license = lib.licenses.gpl2Only;
59 maintainers = with lib.maintainers; [ tomasajt ];
60 platforms = lib.platforms.unix;