summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e8035d24c9eed1f8abd8d2956b17645088cd6562 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Maintainer: A Farzat <a@farzat.xyz>
# Contributor: éclairevoyant
# Contributor: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Caleb Maclennan <caleb@alerque.com>
# Contributor: Florian Walch <florian+aur@fwalch.com>
# Contributor: Florian Hahn <flo@fhahn.com>

_pkgname=neovim
pkgname="$_pkgname-nightly"
pkgver=0.13.0.r270.g32e249dfa6
pkgrel=1
pkgdesc='Fork of Vim aiming to improve user experience, plugins, and GUIs'
arch=(i686 x86_64 armv7h armv6h aarch64)
url='https://neovim.io'
backup=('etc/xdg/nvim/sysinit.vim')
license=(
  'Apache-2.0'
  'LicenseRef-vim'
)
depends=(
  'glibc'
  'libgcc'
  'libluv'
  'libtree-sitter.so'
  'libunibilium.so'
  'libutf8proc'
  'libuv'
  'libvterm>=0.3.3'
  'lua51-lpeg'
  'luajit'
  'msgpack-c'
  'tree-sitter'
  'unibilium'
)
makedepends=(
  'cmake'
  'git'
  'ninja'
  'lua51-mpack'
)
optdepends=(
  'python-pynvim: for Python plugin support (see :help python)'
  'tree-sitter-cli: for tree-sitter parser compilation'
  'xclip: for clipboard support on X11 (or xsel) (see :help clipboard)'
  'xsel: for clipboard support on X11 (or xclip) (see :help clipboard)'
  'wl-clipboard: for clipboard support on wayland (see :help clipboard)'
)
provides=(
  "$_pkgname=${pkgver/\.r*/}"
  'nvim'
  'vim-plugin-runtime'
)
conflicts=("$_pkgname")
source=(
  "git+https://github.com/neovim/$_pkgname.git#tag=nightly"
  nvimdoc{,.hook}
)
sha512sums=('SKIP'
            '22662462c823de243599cdd3483e46ade4ab59b219e907468d34c18e584fe7477548e357ee2ce56bb098cf54b770b108a3511703dd486f0774a65c84af78f6aa'
            '3c6ee1e4646d09c164a2212f9e4d2f53158ff32911b0972e060a395a8d4685334574a7ede995a81680dcc0750cd3327a78beb7904a4bb326b2399d79a8b12d5e')
b2sums=('SKIP'
        'd31cf81659e238fada8092755eb9be16f77c00a466107eb5770c6c9c32e043c91e6efada7ddb51663716a0e38ffa6e3d0093b3e6833aa961d845c7451a95491e'
        '26588b9da6459393076723bdfb8d2b16fed882070f2326bf7c35cd272dee9c18df603afb1ae2254cd0a59eff68189caf04828ef165d5de42c7a4222267604101')

pkgver() {
  cd "$_pkgname"
  local nvim_version nvim_version_git
  nvim_version="$(sed -nE '/NVIM_VERSION_/ s/.* +([0-9]+)\).*/\1/p' ./CMakeLists.txt | sed ':b;N;$!bb;s/\n/\./g')"
  nvim_version_git="$(git describe --first-parent --always | sed -E 's/^v[0-9]+.[0-9]+.[0-9]+-//; s/^([0-9]+)-([a-z0-9]+)/\1\.\2/')"
  printf "%s.r%s\n" "$nvim_version" "$nvim_version_git"
}

build() {
  local cmake_options=(
    -B build
    -G Ninja
    -D CMAKE_BUILD_TYPE=RelWithDebInfo
    -D CMAKE_INSTALL_PREFIX=/usr
    -D USE_BUNDLED=OFF
    -D ENABLE_TRANSLATIONS=ON
    -W no-dev
  )

  cd "$_pkgname"
  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  cd "$_pkgname"
  ./build/bin/nvim --version
  ./build/bin/nvim --headless -u NONE -i NONE +q
}

package() {
  install -Dm644 -t "$pkgdir/usr/share/libalpm/hooks/" nvimdoc.hook
  install -Dt "$pkgdir/usr/share/libalpm/scripts/" nvimdoc

  cd "$_pkgname"
  DESTDIR="$pkgdir" cmake --install build

  install -Dm644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}/"
  install -Dm644 runtime/org.neovim.nvim.desktop -t "${pkgdir}/usr/share/applications/"
  install -Dm644 runtime/org.neovim.nvim.appdata.xml -t "${pkgdir}/usr/share/metainfo/"
  install -Dm644 runtime/nvim.png -t "${pkgdir}/usr/share/pixmaps/"

  # Tree-sitter grammars are packaged separately and installed into
  # /usr/lib/tree_sitter.
  ln -s /usr/lib/tree_sitter "${pkgdir}"/usr/share/nvim/runtime/parser

  # Include system-wide Vim directory in runtimepath
  mkdir -p "${pkgdir}"/etc/xdg/nvim
  echo 'source /usr/share/nvim/archlinux.lua' > "${pkgdir}"/etc/xdg/nvim/sysinit.vim

  mkdir -p "${pkgdir}"/usr/share/vim
  cat > "${pkgdir}"/usr/share/nvim/archlinux.lua << EOF
-- Modify runtimepath to also search the system-wide Vim directory
-- (eg. for Vim runtime files from Arch Linux packages)
vim.opt.runtimepath:append({ '/usr/share/vim/vimfiles', '/usr/share/vim/vimfiles/after' })
EOF
}

# vim:set sw=2 sts=2 et: