-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(neovim): add in update-aternatives support (#6168)
Co-authored-by: oklopfer <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5f057e2
commit 8f4e32b
Showing
2 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pkgbase = neovim | ||
pkgver = 0.10.0 | ||
pkgrel = 2 | ||
pkgdesc = Neovim is a vim fork maintained by the community | ||
url = https://neovim.io/ | ||
makedepends = gettext | ||
|
@@ -10,7 +11,12 @@ pkgbase = neovim | |
makedepends = cmake | ||
makedepends = g++ | ||
makedepends = pkg-config | ||
conflicts = neovim | ||
conflicts = neovim-git | ||
conflicts = nvim | ||
conflicts = neovim-runtime | ||
replaces = neovim | ||
replaces = neovim-git | ||
replaces = nvim | ||
replaces = neovim-runtime | ||
maintainer = Elsie19 <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,80 @@ | ||
pkgname="neovim" | ||
pkgver="0.10.0" | ||
pkgrel="2" | ||
source=("https://github.com/neovim/neovim/archive/refs/tags/v${pkgver}.tar.gz") | ||
url='https://neovim.io/' | ||
makedepends=("gettext" "libtool" "libtool-bin" "autoconf" "automake" "cmake" "g++" "pkg-config") | ||
replaces=("neovim" "nvim" "neovim-runtime") | ||
replaces=("neovim" "neovim-git" "nvim" "neovim-runtime") | ||
conflicts=("${replaces[@]}") | ||
pkgdesc="Neovim is a vim fork maintained by the community" | ||
sha256sums=("372ea2584b0ea2a5a765844d95206bda9e4a57eaa1a2412a9a0726bab750f828") | ||
maintainer=("Elsie19 <[email protected]>") | ||
external_connection=true | ||
repology=("project: ${pkgname}") | ||
|
||
build() { | ||
cd "${_archive}" | ||
cd "${pkgname}-${pkgver}" | ||
make CMAKE_BUILD_TYPE=Release CMAKE_INSTALL_PREFIX=/usr -j"${NCPU}" | ||
} | ||
|
||
package() { | ||
cd "${_archive}" | ||
cd "${pkgname}-${pkgver}" | ||
make install DESTDIR="${pkgdir}" | ||
install -Dm644 "LICENSE.txt" -t "${pkgdir}/usr/share/licenses/${pkgname}" | ||
install -Dm644 "README.md" -t "${pkgdir}/usr/share/doc/${pkgname}" | ||
install -Dm755 /dev/stdin "${pkgdir}/usr/libexec/${pkgname}/ex" << 'EOF' | ||
#!/bin/sh | ||
exec /usr/bin/nvim -e "$@" | ||
EOF | ||
install -Dm755 /dev/stdin "${pkgdir}/usr/libexec/${pkgname}/rview" << 'EOF' | ||
#!/bin/sh | ||
exec /usr/bin/nvim -RZ "$@" | ||
EOF | ||
install -Dm755 /dev/stdin "${pkgdir}/usr/libexec/${pkgname}/rvim" << 'EOF' | ||
#!/bin/sh | ||
exec /usr/bin/nvim -Z "$@" | ||
EOF | ||
install -Dm755 /dev/stdin "${pkgdir}/usr/libexec/${pkgname}/view" << 'EOF' | ||
#!/bin/sh | ||
exec /usr/bin/nvim -R "$@" | ||
EOF | ||
install -Dm755 /dev/stdin "${pkgdir}/usr/libexec/${pkgname}/vimdiff" << 'EOF' | ||
#!/bin/sh | ||
exec /usr/bin/nvim -d "$@" | ||
EOF | ||
} | ||
|
||
post_install() { | ||
update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 30 \ | ||
--slave /usr/share/man/man1/editor.1.gz editor.1.gz \ | ||
/usr/share/man/man1/nvim.1.gz | ||
update-alternatives --install /usr/bin/ex ex "/usr/libexec/${pkgname}/ex" 30 | ||
update-alternatives --install /usr/bin/rvim rvim "/usr/libexec/${pkgname}/rvim" 30 | ||
update-alternatives --install /usr/bin/rview rview "/usr/libexec/${pkgname}/rview" 30 | ||
update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 30 | ||
update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 30 | ||
update-alternatives --install /usr/bin/view view "/usr/libexec/${pkgname}/view" 30 | ||
update-alternatives --install /usr/bin/vimdiff vimdiff "/usr/libexec/${pkgname}/vimdiff" 30 | ||
} | ||
|
||
pre_remove() { | ||
case "$1" in | ||
remove | deconfigure) | ||
update-alternatives --remove editor /usr/bin/nvim | ||
update-alternatives --remove ex "/usr/libexec/${pkgname}/ex" | ||
update-alternatives --remove rvim "/usr/libexec/${pkgname}/rvim" | ||
update-alternatives --remove rview "/usr/libexec/${pkgname}/rview" | ||
update-alternatives --remove vi /usr/bin/nvim | ||
update-alternatives --remove vim /usr/bin/nvim | ||
update-alternatives --remove view "/usr/libexec/${pkgname}/view" | ||
update-alternatives --remove vimdiff "/usr/libexec/${pkgname}/vimdiff" | ||
;; | ||
|
||
upgrade | failed-upgrade) ;; | ||
|
||
*) | ||
echo "prerm called with unknown argument '$1'" >&2 | ||
exit 0 | ||
;; | ||
esac | ||
} |