Skip to content

tree-sitter: 0.17.1 -> 0.17.3; run make install #102763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 12, 2020

Conversation

colemickens
Copy link
Member

Motivation for this change

Update tree-sitter to latest.

Also, this is necessary to actually install the lib/include/pkgconfig files. (neovim nightly now needs this and I know there are a number of us)

cc: @teto @mjlbach

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@@ -68,6 +68,11 @@ in rustPlatform.buildRustPackage {
bash ./script/build-wasm --debug
'';

postInstall = ''
export PREFIX=$out
make install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that looks wrong. make install should be called by default. If you need to export PREFIX, it can be done via configureFlags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind it uses buildRustPackage.

Copy link
Member

@teto teto Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to install both static and shared libary. we should pick one. I think you (or another) could propose a patch for their Makefile to be more granular (and for now remove the extra files via rm). Since homebrew is packaging it too, would be interesting to see how they've done it.

Copy link
Contributor

@NickHu NickHu Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the arch community repo they package the shared library https://www.archlinux.org/packages/community/x86_64/tree-sitter/files/ (I'm actually a little confounded as to why the static libraries do not appear in this file listing because the PKGBUILD seems to just run make install also https://github.com/archlinux/svntogit-community/blob/b7a0f60fa46355ee73ac42ddf4fb419832bfeafe/trunk/PKGBUILD#L30 Arch makepkg strips static libraries by default)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went to the liberty of addressing this in a follow-up commit; thanks for your contribution @colemickens!

@teto can you re-review and then I can merge?

@NickHu
Copy link
Contributor

NickHu commented Nov 4, 2020

Overlay for the impatient: ~/.config/nixpkgs/overlays/tree-sitter.nix

self: super:
{
  tree-sitter = super.tree-sitter.overrideAttrs (oldAttrs: {
    postInstall = "PREFIX=$out make install";
  });
}

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 102763 run on x86_64-darwin 1

1 package marked as broken and skipped:
  • tree-sitter

@ipetkov
Copy link
Contributor

ipetkov commented Nov 8, 2020

I noticed that the metadata sets broken = stdenv.isDarwin || stdenv.isAarch64;. I was able to build this successfully on macOS by adding buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];, so it may be worth doing that in this PR.

@@ -49,6 +51,8 @@ in rustPlatform.buildRustPackage {
pname = "tree-sitter";
inherit src version cargoSha256;

buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be darwin.apple_sdk.frameworks.Security or darwin.Security; I have no way to test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do other packages do?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe: what prompted you to add it if you don’t have a MacOS machine?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can testify that the build process indeed fails without it on MacOS. This dependency seem to be typical for Rust packages, like bat or git-and-tools.delta.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickHu sorry I didn't clarify earlier, this is how I've normally seen this accomplished:

  • add a parameter called Security at the top of tree-sitter/default.nix
  • set buildInputs = lib.optionals stdenv.isDarwin [ Security ]; in tree-sitter/default.nix
  • update top-level/all-packages.nix with:
tree-sitter = callPackage ../development/tools/parsing/tree-sitter {
   inherit (darwin.apple_sdk.frameworks) Security;
};

You can ping me when the change is made and I can test that it builds on macOS :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ipetkov ping

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickHu 4d8adcc builds on macOS 👍

Comment on lines +6 to +7
, enableShared ? true
, enableStatic ? false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableShared what? Not really clear what that means.

Do we need both options? Why is it configurable?

Copy link
Contributor

@NickHu NickHu Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're building static, maybe you want to not have the shared libraries - configurable by this flag

I didn't make up this convention, if you grep for enableShared in nixpkgs you'll find plenty of occurrences

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten to set enableShared = false in static.nix; fixed now

@@ -49,6 +51,8 @@ in rustPlatform.buildRustPackage {
pname = "tree-sitter";
inherit src version cargoSha256;

buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do other packages do?

@@ -49,6 +51,8 @@ in rustPlatform.buildRustPackage {
pname = "tree-sitter";
inherit src version cargoSha256;

buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe: what prompted you to add it if you don’t have a MacOS machine?

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@NickHu
Copy link
Contributor

NickHu commented Nov 12, 2020

Seems like this has gone quiet. I think I addressed everyone's concerns, so I'll just go ahead and merge this. If any follow-ups are required they can come in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants