From 1b5ba6d5bd22ae637b30013fd016900b8a49e94e Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sat, 1 Apr 2023 18:19:09 +0200 Subject: [PATCH] emacs.pkgs.jinx: build .so file Co-authored-by: Jian Lin <75130626+jian-lin@users.noreply.github.com> --- .../emacs/elisp-packages/elpa-packages.nix | 25 +++++++++++++++++ .../emacs/elisp-packages/melpa-packages.nix | 27 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix index 1ffdb3365503..d1f9dbd3a4a5 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/elpa-packages.nix @@ -106,6 +106,31 @@ self: let }; }); + jinx = super.jinx.overrideAttrs (old: { + dontUnpack = false; + + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ + pkgs.pkg-config + ]; + + buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.enchant2 ]; + + postBuild = '' + NIX_CFLAGS_COMPILE="$($PKG_CONFIG --cflags enchant-2) $NIX_CFLAGS_COMPILE" + $CC -shared -o jinx-mod.so jinx-mod.c -lenchant-2 + ''; + + postInstall = (old.postInstall or "") + "\n" + '' + outd=$out/share/emacs/site-lisp/elpa/jinx-* + install -m444 -t $outd jinx-mod.so + rm $outd/jinx-mod.c $outd/emacs-module.h + ''; + + meta = old.meta // { + maintainers = [ lib.maintainers.DamienCassou ]; + }; + }); + plz = super.plz.overrideAttrs ( old: { dontUnpack = false; diff --git a/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix index 33d489b60aba..7efe6a68b0f6 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/melpa-packages.nix @@ -314,6 +314,33 @@ let ivy-rtags = fix-rtags super.ivy-rtags; + jinx = super.jinx.overrideAttrs (old: { + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ + pkgs.pkg-config + ]; + + buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.enchant2 ]; + + postBuild = '' + pushd working/jinx + NIX_CFLAGS_COMPILE="$($PKG_CONFIG --cflags enchant-2) $NIX_CFLAGS_COMPILE" + $CC -shared -o jinx-mod.so jinx-mod.c -lenchant-2 + popd + ''; + + postInstall = (old.postInstall or "") + "\n" + '' + pushd source + outd=$(echo $out/share/emacs/site-lisp/elpa/jinx-*) + install -m444 --target-directory=$outd jinx-mod.so + rm $outd/jinx-mod.c $outd/emacs-module.h + popd + ''; + + meta = old.meta // { + maintainers = [ lib.maintainers.DamienCassou ]; + }; + }); + libgit = super.libgit.overrideAttrs(attrs: { nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [ pkgs.cmake ]; buildInputs = attrs.buildInputs ++ [ pkgs.libgit2 ];