melpa-packages: build osx-dictionary helper executable

The `osx-dictionary` emacs package tries to build a helper executable
if it is not found at runtime. This fails with `nix` installations of
the package, so we build it at build time.
This commit is contained in:
Anthony Cowley 2023-10-31 09:32:59 -04:00
parent 808c0d8c53
commit 86e4d00f30

View File

@ -688,6 +688,27 @@ let
--replace '"mozc_emacs_helper"' '"${pkgs.ibus-engines.mozc}/lib/mozc/mozc_emacs_helper"'
'';
});
# Build a helper executable that interacts with the macOS Dictionary.app
osx-dictionary =
if pkgs.stdenv.isDarwin
then super.osx-dictionary.overrideAttrs (old: {
buildInputs =
old.buildInputs ++
(with pkgs.darwin.apple_sdk.frameworks; [CoreServices Foundation]);
dontUnpack = false;
buildPhase = (old.buildPhase or "") + ''
cd source
$CXX -O3 -framework CoreServices -framework Foundation osx-dictionary.m -o osx-dictionary-cli
'';
postInstall = (old.postInstall or "") + "\n" + ''
outd=$out/share/emacs/site-lisp/elpa/osx-dictionary-*
mkdir -p $out/bin
install -m444 -t $out/bin osx-dictionary-cli
rm $outd/osx-dictionary.m
'';
})
else super.osx-dictionary;
};
in lib.mapAttrs (n: v: if lib.hasAttr n overrides then overrides.${n} else v) super);