presenterm: fix linking to libsixel on darwin & refactor (#418671)
This commit is contained in:
@@ -3,12 +3,15 @@
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
makeBinaryWrapper,
|
||||
lld,
|
||||
libsixel,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) isDarwin isx86_64;
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "presenterm";
|
||||
version = "0.14.0";
|
||||
@@ -20,9 +23,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
hash = "sha256-vBEHk0gQe4kUTtH4qtc0jVfDvYGabnkJrwPxmxt10hs=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
|
||||
lld
|
||||
];
|
||||
nativeBuildInputs =
|
||||
lib.optionals isDarwin [
|
||||
makeBinaryWrapper
|
||||
]
|
||||
++ lib.optionals (isDarwin && isx86_64) [
|
||||
lld
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libsixel
|
||||
@@ -35,7 +42,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-u0wOWKAfzi1Fxmx6x2ckrIv/PKgtqKrDiDauD4/BY24=";
|
||||
|
||||
env = lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) {
|
||||
env = lib.optionalAttrs (isDarwin && isx86_64) {
|
||||
NIX_CFLAGS_LINK = "-fuse-ld=lld";
|
||||
};
|
||||
|
||||
@@ -48,6 +55,12 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
"--skip=external_snippet"
|
||||
];
|
||||
|
||||
# sixel-sys is dynamically linked to libsixel
|
||||
postInstall = lib.optionalString isDarwin ''
|
||||
wrapProgram $out/bin/presenterm \
|
||||
--prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsixel ]}"
|
||||
'';
|
||||
|
||||
nativeInstallCheckInputs = [
|
||||
versionCheckHook
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user