Unverified Commit 0a040b6f authored by adisbladis's avatar adisbladis Committed by GitHub
Browse files

Merge pull request #264588 from acowley/osx-dictionary

melpa-packages: build osx-dictionary helper executable
parents 27a96b7a 86e4d00f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -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);