diff options
author | Weijia Wang <9713184+wegank@users.noreply.github.com> | 2023-10-02 15:15:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-02 15:15:28 +0200 |
commit | a2e77ed24f47bebda2146b9df7e9c57ec03f8b72 (patch) | |
tree | 9192f1348074fea0840598db6c5a517f15cbab1f /pkgs | |
parent | a7b9a75563dbc1ca4bd91fa9afa9c351a3dee40e (diff) | |
parent | f4b3660042e1b424728f6ed55f0a09a38ad3dc45 (diff) |
Merge pull request #258259 from TomaSajt/mlx42
mlx42: init at 2.3.2
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/by-name/ml/mlx42/mlx42.pc | 10 | ||||
-rw-r--r-- | pkgs/by-name/ml/mlx42/package.nix | 62 |
2 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/by-name/ml/mlx42/mlx42.pc b/pkgs/by-name/ml/mlx42/mlx42.pc new file mode 100644 index 0000000000000..f0ca081cfed71 --- /dev/null +++ b/pkgs/by-name/ml/mlx42/mlx42.pc @@ -0,0 +1,10 @@ +prefix=@out@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: mlx42 +Description: A simple cross-platform graphics library that uses GLFW and OpenGL +Version: @version@ +Libs: -L${libdir} -lmlx42 +Cflags: -I${includedir} diff --git a/pkgs/by-name/ml/mlx42/package.nix b/pkgs/by-name/ml/mlx42/package.nix new file mode 100644 index 0000000000000..0f7447ed8f3f7 --- /dev/null +++ b/pkgs/by-name/ml/mlx42/package.nix @@ -0,0 +1,62 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, cmake +, glfw +, darwin +, enableShared ? !stdenv.hostPlatform.isStatic +, enableDebug ? false +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "mlx42"; + version = "2.3.2"; + + src = fetchFromGitHub { + owner = "codam-coding-college"; + repo = "MLX42"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-JCBV8NWibSugqXkbgP0v3gDfaaMNFYztWpBRfHJUG8E="; + }; + + patches = [ + (fetchpatch { + name = "add-cmake-install.patch"; + url = "https://github.com/codam-coding-college/MLX42/commit/a51ca8e0ec3fb793fa96d710696dcee8a4fe57d6.patch"; + hash = "sha256-i+0yHZVvfTG19BGVrz7GuEuBw3B7lylCPEvx07il23M="; + }) + ]; + + 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 + + # This file was removed after 2.3.2, so the used patch doesn't copy this file + # This line can be removed after the next release + cp $src/include/MLX42/MLX42_Input.h $out/include/MLX42 + ''; + + meta = { + 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; + }; +}) |