Files
rpi-buildroot/package/vim/vim.mk
Thomas Petazzoni c33f9a2871 package/vim: fix reinstallation
While not very common, it is nice when package re-installation
works. Unfortunately the "installlinks" target of vim installs links
with "ln -s", causing a package reinstallation to fail with:

cd /home/thomas/buildroot/br/output-all/target/usr/bin; ln -s vim ex
cd /home/thomas/buildroot/br/output-all/target/usr/bin; ln -s vim view
cd /home/thomas/buildroot/br/output-all/target/usr/bin; ln -s vim rvim
cd /home/thomas/buildroot/br/output-all/target/usr/bin; ln -s vim rview
cd /home/thomas/buildroot/br/output-all/target/usr/bin; ln -s vim vimdiff
ln: failed to create symbolic link 'ex': File exists
ln: failed to create symbolic link 'view': File exists
make[2]: *** [Makefile:2749: /home/thomas/buildroot/br/output-all/target/usr/bin/ex] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:2752: /home/thomas/buildroot/br/output-all/target/usr/bin/view] Error 1
ln: failed to create symbolic link 'rvim': File exists
ln: failed to create symbolic link 'rview': File exists

To fix this, we remove the target links before proceeding with the
installation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit 67e84345c156170fa01103289f1d255a74ad830d)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2026-01-06 08:35:54 +01:00

97 lines
2.6 KiB
Makefile

################################################################################
#
# vim
#
################################################################################
VIM_VERSION = 9.1.1684
VIM_SITE = $(call github,vim,vim,v$(VIM_VERSION))
VIM_DEPENDENCIES = ncurses $(TARGET_NLS_DEPENDENCIES)
VIM_SUBDIR = src
VIM_CONF_ENV = \
vim_cv_toupper_broken=no \
vim_cv_terminfo=yes \
vim_cv_tgetent=zero \
vim_cv_tty_group=world \
vim_cv_tty_mode=0620 \
vim_cv_getcwd_broken=no \
vim_cv_stat_ignores_slash=yes \
vim_cv_memmove_handles_overlap=yes \
ac_cv_sizeof_int=4 \
ac_cv_small_wchar_t=no
# GUI/X11 headers leak from the host so forcibly disable them
VIM_CONF_OPTS = --with-tlib=ncurses --enable-gui=no --without-x
VIM_LICENSE = Charityware
VIM_LICENSE_FILES = LICENSE README.txt
VIM_CPE_ID_VENDOR = vim
ifeq ($(BR2_PACKAGE_ACL),y)
VIM_CONF_OPTS += --enable-acl
VIM_DEPENDENCIES += acl
else
VIM_CONF_OPTS += --disable-acl
endif
ifeq ($(BR2_PACKAGE_GPM),y)
VIM_CONF_OPTS += --enable-gpm
VIM_DEPENDENCIES += gpm
else
VIM_CONF_OPTS += --disable-gpm
endif
ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
VIM_CONF_OPTS += --enable-selinux
VIM_DEPENDENCIES += libselinux
else
VIM_CONF_OPTS += --disable-selinux
endif
define VIM_INSTALL_TARGET_CMDS
$(RM) -f $(TARGET_DIR)/usr/bin/{ex,view,rvim,rview,vimdiff}
cd $(@D)/src; \
$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) installvimbin; \
$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) installpack; \
$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) installtools; \
$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) installlinks
endef
define VIM_INSTALL_RUNTIME_CMDS
cd $(@D)/src; \
$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) installrtbase; \
$(TARGET_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) installmacros
endef
define VIM_REMOVE_DOCS
$(RM) -rf $(TARGET_DIR)/usr/share/vim/vim*/doc/
endef
# Avoid oopses with vipw/vigr (from package shadow), lack of $EDITOR,
# or other packages expecting plain 'vi' command to exist.
ifeq ($(BR2_ROOTFS_MERGED_USR),y)
define VIM_INSTALL_VI_SYMLINK
ln -sf vim $(TARGET_DIR)/usr/bin/vi
endef
else
define VIM_INSTALL_VI_SYMLINK
ln -sf ../usr/bin/vim $(TARGET_DIR)/bin/vi
endef
endif
VIM_POST_INSTALL_TARGET_HOOKS += VIM_INSTALL_VI_SYMLINK
ifeq ($(BR2_PACKAGE_VIM_RUNTIME),y)
VIM_POST_INSTALL_TARGET_HOOKS += VIM_INSTALL_RUNTIME_CMDS
VIM_POST_INSTALL_TARGET_HOOKS += VIM_REMOVE_DOCS
endif
HOST_VIM_DEPENDENCIES = host-ncurses
HOST_VIM_CONF_OPTS = \
--with-tlib=ncurses \
--enable-gui=no \
--without-x \
--disable-acl \
--disable-gpm \
--disable-selinux
$(eval $(autotools-package))
$(eval $(host-autotools-package))