diff options
author | Brian Leung <leungbk@posteo.net> | 2022-12-06 17:12:24 -0800 |
---|---|---|
committer | Brian Leung <leungbk@posteo.net> | 2022-12-06 17:12:24 -0800 |
commit | b57c104d0b4bcea51426271b32f18776d7667a72 (patch) | |
tree | c0eb4458c12267d2d84f452a682719707247c5fa /overlays | |
parent | 49e3c66d211d5110909375fe48d85c3c43753d61 (diff) | |
download | nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.tar nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.tar.gz nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.tar.bz2 nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.tar.lz nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.tar.xz nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.tar.zst nixlib-b57c104d0b4bcea51426271b32f18776d7667a72.zip |
Revert "Revert "add tree sitter languages to rpath (#273)""
This reverts commit 1e4763dd90ad8712b459d1f5e53cbbc047b75dd0.
Diffstat (limited to 'overlays')
-rw-r--r-- | overlays/emacs.nix | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/overlays/emacs.nix b/overlays/emacs.nix index ab16a7250416..7731175a8bc7 100644 --- a/overlays/emacs.nix +++ b/overlays/emacs.nix @@ -83,7 +83,6 @@ let /usr/bin/codesign -s - -f $out/lib/${lib drv} '' else ''ln -s ${drv}/parser $out/lib/${lib drv}''; - linkerFlag = drv: "-l" + libName drv; plugins = with self.pkgs.tree-sitter-grammars; [ tree-sitter-bash tree-sitter-c @@ -101,20 +100,14 @@ let (super.lib.concatStringsSep "\n" (["mkdir -p $out/lib"] ++ (map linkCmd plugins))); in { buildInputs = old.buildInputs ++ [ self.pkgs.tree-sitter tree-sitter-grammars ]; - # before building the `.el` files, we need to allow the `tree-sitter` libraries - # bundled in emacs to be dynamically loaded. - TREE_SITTER_LIBS = super.lib.concatStringsSep " " ([ "-ltree-sitter" ] ++ (map linkerFlag plugins)); - # Add to directories that tree-sitter looks in for language definitions / shared object parsers - # FIXME: This was added for macOS, but it shouldn't be necessary on any platform. - # https://git.savannah.gnu.org/cgit/emacs.git/tree/src/treesit.c?h=64044f545add60e045ff16a9891b06f429ac935f#n533 - # appends a bunch of filenames that appear to be incorrectly skipped over - # in https://git.savannah.gnu.org/cgit/emacs.git/tree/src/treesit.c?h=64044f545add60e045ff16a9891b06f429ac935f#n567 - # on macOS, but are handled properly in Linux. - postPatch = old.postPatch + super.lib.optionalString super.stdenv.isDarwin '' - substituteInPlace src/treesit.c \ - --replace "Vtreesit_extra_load_path = Qnil;" \ - "Vtreesit_extra_load_path = list1 ( build_string ( \"${tree-sitter-grammars}/lib\" ) );" - ''; + TREE_SITTER_LIBS = "-ltree-sitter"; + # Add to list of directories dlopen/dynlib_open searches for tree sitter languages *.so/*.dylib. + postFixup = old.postFixup + super.lib.optionalString self.stdenv.isDarwin '' + /usr/bin/install_name_tool -add_rpath ${super.lib.makeLibraryPath [ tree-sitter-grammars ]} $out/bin/emacs + /usr/bin/codesign -s - -f $out/bin/emacs + '' + super.lib.optionalString self.stdenv.isLinux '' + ${self.pkgs.patchelf}/bin/patchelf --add-rpath ${super.lib.makeLibraryPath [ tree-sitter-grammars ]} $out/bin/emacs + ''; } ) ))); |