diff options
author | Techcable | 2021-12-27 15:58:16 -0700 |
---|---|---|
committer | Techcable | 2021-12-27 16:47:53 -0700 |
commit | d0aaead057ca1eb4a9936f02a159fba924b1baf5 (patch) | |
tree | 16c4e47f4ae2e21a9e1b7ef8a9df90c92733b65a | |
parent | dab68176bf5d9f75b21917a600a3af8e0393dc26 (diff) | |
download | aur-d0aaead057ca1eb4a9936f02a159fba924b1baf5.tar.gz |
Update to zls 0.9.0
Compatible with zig 0.9.0
Instead of manually editing the config to place
build_runner.zig in a custom location, this simply places
it right next to the executable in /usr/bin
This avoids having to manually modify the config.
Also, this adds an install script which prompts the user
to run `zls config` to setup the initial configuration.
I highly recomend running it :)
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 58 | ||||
-rw-r--r-- | update_config.py | 31 | ||||
-rw-r--r-- | zls.install | 13 |
5 files changed, 51 insertions, 72 deletions
@@ -1,22 +1,21 @@ pkgbase = zls-bin pkgdesc = Zig Language Server, or zls, is a language server for Zig. Pre-compiled official binary. - pkgver = 0.1.0 - pkgrel = 2 + pkgver = 0.9.0 + pkgrel = 1 url = https://github.com/zigtools/zls + install = zls.install arch = x86_64 license = MIT - makedepends = python>=3.6 depends = zig provides = zls conflicts = zls conflicts = zls-git replaces = zls replaces = zls-git - backup = usr/bin/zls.json - source = update_config.py - sha256sums = f55e83f8510c50d55d7f37fa6dfa4d0f9a99061099829b350fa58892bc828a57 - source_x86_64 = https://github.com/zigtools/zls/releases/download/0.1.0/x86_64-linux.tar.xz - sha256sums_x86_64 = 1318a785e6982ef86d1d0242403b20cec34ce209c64eee339512f8267e9a5ccb + noextract = zls-LICENSE.txt + source = zls-LICENSE.txt::https://raw.githubusercontent.com/zigtools/zls/0.9.0/LICENSE + sha256sums = 39d99dfbe269e3daf483652bd925f4955e3b2a3d11fd737b538d366ef358c3ce + source_x86_64 = zls-bin-0.9.0.tar.gz::https://github.com/zigtools/zls/releases/download/0.9.0/x86_64-linux.tar.xz + sha256sums_x86_64 = f001967764565ab72e38c9320309fbbaf45f122ba01c80a2433b400f942bd18d pkgname = zls-bin - diff --git a/.gitignore b/.gitignore index 6c15264fe92e..55fe85710943 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Ignore all the tarballs *.tar.xz -zls-bin-*pkg.tar.* +zls-bin-*.tar.* +# License file +zls-LICENSE.txt # Arch Build System src @@ -1,47 +1,43 @@ # Maintainer: Nicholas Schlabach <Techcable at techcable dot net> pkgname=zls-bin -pkgver="0.1.0" -pkgrel=2 +pkgver="0.9.0" +pkgrel=1 pkgdesc="Zig Language Server, or zls, is a language server for Zig. Pre-compiled official binary." arch=('x86_64') url="https://github.com/zigtools/zls" license=('MIT') depends=('zig') -# Used to update the `zls.json` file with the path to our build runner. -# See: https://github.com/zigtools/zls/blob/master/README.md#configuration-options -# I could use `jq` but I think python is more prevalent (although jq seems -# surprisingly common, just look at the reverse dependencies for `jq-git`) -makedepends=('python>=3.6') provides=('zls') conflicts=('zls' 'zls-git') replaces=('zls' 'zls-git') -# This is the location of the ZLS config :) -# If the user makes changes they should be preserved +# Gives a friendly recomendation to run `zls config` +install="zls.install" +# The MIT is considered a "custom" license, because it has a unique copyright line # -# Of course ideally, the user would make changes locally -# in ~/.config instead of globally -backup=('usr/bin/zls.json') -source_x86_64=("https://github.com/zigtools/zls/releases/download/${pkgver}/x86_64-linux.tar.xz") -sha256sums_x86_64=("1318a785e6982ef86d1d0242403b20cec34ce209c64eee339512f8267e9a5ccb") -# Technically, our python script is a "source" -source=("update_config.py") -sha256sums=("f55e83f8510c50d55d7f37fa6dfa4d0f9a99061099829b350fa58892bc828a57") - -prepare() { - python3 "${srcdir}/update_config.py" "${srcdir}/$CARCH-linux/zls.json" -} +# See the wiki for more info: https://wiki.archlinux.org/title/PKGBUILD#license +source=("zls-LICENSE.txt::https://raw.githubusercontent.com/zigtools/zls/0.9.0/LICENSE") +noextract=("zls-LICENSE.txt") +# This is the actual binary (everything except the license) +source_x86_64=("$pkgname-$pkgver.tar.gz::https://github.com/zigtools/zls/releases/download/${pkgver}/${CARCH}-linux.tar.xz") +sha256sums=('39d99dfbe269e3daf483652bd925f4955e3b2a3d11fd737b538d366ef358c3ce') +sha256sums_x86_64=('f001967764565ab72e38c9320309fbbaf45f122ba01c80a2433b400f942bd18d') package() { - _output="${srcdir}/$CARCH-linux" - install -Dm755 "${_output}/zls" "${pkgdir}/usr/bin/zls" - # Unfortunately, this config needs to sit alongside - # the `zls` executable in order to be found :( - install -Dm644 "${_output}/zls.json" "${pkgdir}/usr/bin/zls.json" + _output="${srcdir}" + install -Dm755 "${_output}/bin/zls" "${pkgdir}/usr/bin/zls" - # Install `build_runner.zig` (this is the reason we have to customize `zls.json`) - install -Dm644 "${_output}/build_runner.zig" "${pkgdir}/usr/share/zls/build_runner.zig" - install -Dm644 "${_output}/README.md" "${pkgdir}/usr/share/zls/README.md" - # License - install -Dm644 "${_output}/LICENSE.md" "${pkgdir}/usr/share/zls/LICENSE.md" + # Install `build_runner.zig into the /usr/bin directory, alongside the executable. + # + # According to the README.md file, this is the default location. + # + # Prior versions of zls-bin manually modified the zls.json configuration to + # move build_runner.zig into /usr/share instead of /usr/bin + # + # This was IMO not worth the complexity. We'll just keep it in /usr/bin + install -Dm644 "${_output}/bin/build_runner.zig" "${pkgdir}/usr/bin/build_runner.zig" + + install -Dm644 "${_output}/README.md" "${pkgdir}/usr/share/zls/README.md" + # Install license file + install -Dm644 "${_output}/zls-LICENSE.txt" "${pkgdir}/usr/share/licenses/zls-bin/LICENSE" } diff --git a/update_config.py b/update_config.py deleted file mode 100644 index cde87997aa96..000000000000 --- a/update_config.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# Update the `zls.json` file with our added configuration -import json -import sys - -# Additional configuration, as definied here: -# https://github.com/zigtools/zls#configuration-options -ADDITIONAL_CONFIGURATION = { - # We install the build runner globally - "build_runner_path": "/usr/share/zls/build_runner.zig", -} - -if __name__ == "__main__": - if len(sys.argv) < 2: - print("Insufficient arguments", file=sys.stderr) - sys.exit(1) - zls_config_file = sys.argv[1] - print(f"Updating ZLS config file: {zls_config_file}") - with open(zls_config_file, 'rt') as f: - original_data = json.load(f) - # If there is any overlapping keys, we fail-fast - # If the `zls.json` file conflicts with this that is a big problem - overlapping_keys = set(original_data.keys()) & ADDITIONAL_CONFIGURATION.keys() - if overlapping_keys: - print(f"Overlapping keys: {overlapping_keys}", file=sys.stderr) - sys.exit(1) - updated_data = dict(original_data) # Copy - updated_data.update(ADDITIONAL_CONFIGURATION) - # Overwite in place - with open(zls_config_file, 'wt') as f: - json.dump(updated_data, f, indent=4) diff --git a/zls.install b/zls.install new file mode 100644 index 000000000000..7d4f2457dea0 --- /dev/null +++ b/zls.install @@ -0,0 +1,13 @@ +post_install() { + echo "Consider runing `zls config` to setup initial configuration" + echo "" + echo "This is not required, but it is highly recommended" +} + +post_upgrade() { + echo "Consider re-running `zls config` to reconfigure the language server" + echo "" + echo "Some options may have changed when upgrading from $2 -> $1" + echo "" + echo "Make sure to backup your old configuration!" +} |