Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlx42: fix build with clang #373838

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pkgs/by-name/ml/mlx42/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
cmake,
glfw,
enableShared ? !stdenv.hostPlatform.isStatic,
Expand All @@ -19,13 +20,23 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-/HCP6F7N+J97n4orlLxg/4agEoq4+rJdpeW/3q+DI1I=";
};

patches = [
# clang no longer allows using -Ofast
# see: https://github.com/codam-coding-college/MLX42/issues/147
(fetchpatch {
name = "replace-ofast-with-o3.patch";
url = "https://github.com/codam-coding-college/MLX42/commit/ce254c3a19af8176787601a2ac3490100a5c4c61.patch";
hash = "sha256-urL/WVOXinf7hWR5kH+bAVTcAzldkkWfY0+diSf7jHE=";
})
];

postPatch =
''
patchShebangs --build ./tools
''
+ lib.optionalString enableShared ''
substituteInPlace CMakeLists.txt \
--replace-fail "mlx42 STATIC" "mlx42 SHARED"
--replace-fail "mlx42 STATIC" "mlx42 SHARED"
'';

strictDeps = true;
Expand Down