Small series on vim
cover Small series on vim
Hello,
Here is a very small series on vim.mk. The first patch is a fix for the reinstallation of vim, and the 3 others are just cleanups made while I was reading through vim.mk.
Thomas
Thomas Petazzoni (4):
package/vim: fix reinstallation package/vim: use more conventional $(MAKE) construct package/vim: refactor install target logic package/vim: inline the VIM_REMOVE_DOCS variable
package/vim/vim.mk | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/4 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.
--- package/vim/vim.mk | 1 + 1 file changed, 1 insertion(+)
package/vim/vim.mk +1 -0
@@ -47,6 +47,7 @@ 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; \
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/4] package/vim: fix reinstallation
Quoted 17 lines · Thomas Petazzoni via buildroot
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
Quoted 4 lines
To fix this, we remove the target links before proceeding with the installation.
Signed-off-by Thomas Petazzoni <[email protected]>
Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/4] package/vim: fix reinstallation
In reply to Thomas Petazzoni via buildrootIn reply of:
Quoted 17 lines
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
Quoted 4 lines
To fix this, we remove the target links before proceeding with the installation.
Signed-off-by Thomas Petazzoni <[email protected]>
Applied to 2025.02.x and 2025.11.x. Thanks
Quoted 23 lines
--- package/vim/vim.mk | 1 + 1 file changed, 1 insertion(+)package/vim/vim.mk +1
-0@@ -47,6 +47,7 @@ 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; \Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/4 package/vim: use more conventional $(MAKE) construct
In reply to Thomas Petazzoni via buildrootIn Buildroot, we more commonly do:
$(MAKE) -C $(@D)/src
than:
cd $(@D)/src; $(MAKE)
so let's adopt this more conventional style.
This coding style in vim.mk dates from when the package was introduced by Peter Korsgaard back in 2010.
--- package/vim/vim.mk | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
package/vim/vim.mk +6 -8
@@ -48,17 +48,15 @@ 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 + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installvimbin + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installpack + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installtools + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src 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 + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installrtbase + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installmacros endef define VIM_REMOVE_DOCS
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/4] package/vim: use more conventional $(MAKE) construct
In reply of:
Quoted 6 lines
In Buildroot, we more commonly do:
$(MAKE) -C $(@D)/srcthan:
Quoted 8 lines
cd $(@D)/src; $(MAKE)so let's adopt this more conventional style.
This coding style in vim.mk dates from when the package was introduced by Peter Korsgaard back in 2010.
Signed-off-by Thomas Petazzoni <[email protected]>
Applied to 2025.02.x and 2025.11.x. Thanks
Quoted 39 lines
--- package/vim/vim.mk | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)package/vim/vim.mk +6
-8@@ -48,17 +48,15 @@ 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 + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installvimbin + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installpack + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installtools + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src 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 + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installrtbase + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installmacros endef define VIM_REMOVE_DOCSSignature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/4 package/vim: refactor install target logic
In reply to Thomas Petazzoni via buildrootInstead of calling $(MAKE) multiple times, let's call it once, with all installation targets needed. We introduce a VIM_INSTALL_TARGETS variable to collect the list of make install targets that need to be invoked.
--- package/vim/vim.mk | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
package/vim/vim.mk +10 -10
@@ -46,17 +46,18 @@ else VIM_CONF_OPTS += --disable-selinux endif +VIM_INSTALL_TARGETS = \ + installvimbin installpack \ + installtools installlinks + +ifeq ($(BR2_PACKAGE_VIM_RUNTIME),y) +VIM_INSTALL_TARGETS += installrtbase installmacros +endif + define VIM_INSTALL_TARGET_CMDS $(RM) -f $(TARGET_DIR)/usr/bin/{ex,view,rvim,rview,vimdiff} - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installvimbin - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installpack - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installtools - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installlinks -endef - -define VIM_INSTALL_RUNTIME_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installrtbase - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installmacros + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) \ + $(VIM_INSTALL_TARGETS) endef define VIM_REMOVE_DOCS
@@ -77,7 +78,6 @@ 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
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 3/4] package/vim: refactor install target logic
In reply of:
Quoted 6 lines
Instead of calling $(MAKE) multiple times, let's call it once, with all installation targets needed. We introduce a
VIM_INSTALL_TARGETSvariable to collect the list of make install targets that need to be invoked.Signed-off-by Thomas Petazzoni <[email protected]>
Applied to 2025.02.x and 2025.11.x. Thanks
Quoted 51 lines
--- package/vim/vim.mk | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)package/vim/vim.mk +10
-10@@ -46,17 +46,18 @@ else VIM_CONF_OPTS += --disable-selinux endif +VIM_INSTALL_TARGETS = \ + installvimbin installpack \ + installtools installlinks + +ifeq ($(BR2_PACKAGE_VIM_RUNTIME),y) +VIM_INSTALL_TARGETS += installrtbase installmacros +endif + define VIM_INSTALL_TARGET_CMDS $(RM) -f $(TARGET_DIR)/usr/bin/{ex,view,rvim,rview,vimdiff} - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installvimbin - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installpack - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installtools - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installlinks -endef - -define VIM_INSTALL_RUNTIME_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installrtbase - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) installmacros + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) \ + $(VIM_INSTALL_TARGETS) endef define VIM_REMOVE_DOCS@@ -77,7 +78,6 @@ 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 endifSignature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 4/4 package/vim: inline the VIM_REMOVE_DOCS variable
In reply to Thomas Petazzoni via buildrootThe VIM_REMOVE_DOCS variable is currently a post install target hook, but it can just as well be done inside VIM_INSTALL_TARGET_CMDS directly.
The hook was registered conditionally based on BR2_PACKAGE_VIM_RUNTIME because prior to commit f7a07f42f70a73806fd2f6bf3662fc6907845fe9, the hook's logic was:
find $(TARGET_DIR)/usr/share/vim -type f -name "*.txt" -delete
which was failing if BR2_PACKAGE_VIM_RUNTIME was not enabled, as $(TARGET_DIR)/usr/share/vim would not exist.
But since this commit, the hook logic is:
$(RM) -rf $(TARGET_DIR)/usr/share/vim/vim*/doc/
which obviously won't fail if $(TARGET_DIR)/usr/share/vim doesn't exist.
So let's simplify the whole logic.
--- package/vim/vim.mk | 7 ------- 1 file changed, 7 deletions(-)
package/vim/vim.mk +0 -7
@@ -58,9 +58,6 @@ define VIM_INSTALL_TARGET_CMDS $(RM) -f $(TARGET_DIR)/usr/bin/{ex,view,rvim,rview,vimdiff} $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) \ $(VIM_INSTALL_TARGETS) -endef - -define VIM_REMOVE_DOCS $(RM) -rf $(TARGET_DIR)/usr/share/vim/vim*/doc/ endef
@@ -77,10 +74,6 @@ endef endif VIM_POST_INSTALL_TARGET_HOOKS += VIM_INSTALL_VI_SYMLINK -ifeq ($(BR2_PACKAGE_VIM_RUNTIME),y) -VIM_POST_INSTALL_TARGET_HOOKS += VIM_REMOVE_DOCS -endif - HOST_VIM_DEPENDENCIES = host-ncurses HOST_VIM_CONF_OPTS = \ --with-tlib=ncurses \
Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 4/4] package/vim: inline the VIM_REMOVE_DOCS variable
In reply of:
Quoted 15 lines
The
VIM_REMOVE_DOCSvariable is currently a post install target hook, but it can just as well be done insideVIM_INSTALL_TARGET_CMDSdirectly.The hook was registered conditionally based on
BR2_PACKAGE_VIM_RUNTIMEbecause prior to commitf7a07f42f70a73806fd2f6bf3662fc6907845fe9, the hook's logic was:find $(TARGET_DIR)/usr/share/vim -type f -name "*.txt" -deletewhich was failing if
BR2_PACKAGE_VIM_RUNTIMEwas not enabled, as $(TARGET_DIR)/usr/share/vim would not exist.But since this commit, the hook logic is:
Quoted 8 lines
$(RM) -rf $(TARGET_DIR)/usr/share/vim/vim*/doc/which obviously won't fail if $(TARGET_DIR)/usr/share/vim doesn't exist.
So let's simplify the whole logic.
Signed-off-by Thomas Petazzoni <[email protected]>
Applied to 2025.02.x and 2025.11.x. Thanks
Quoted 36 lines
--- package/vim/vim.mk | 7 ------- 1 file changed, 7 deletions(-)package/vim/vim.mk +0
-7@@ -58,9 +58,6 @@ define VIM_INSTALL_TARGET_CMDS $(RM) -f $(TARGET_DIR)/usr/bin/{ex,view,rvim,rview,vimdiff} $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) \ $(VIM_INSTALL_TARGETS) -endef - -define VIM_REMOVE_DOCS $(RM) -rf $(TARGET_DIR)/usr/share/vim/vim*/doc/ endef@@ -77,10 +74,6 @@ endef endif VIM_POST_INSTALL_TARGET_HOOKS += VIM_INSTALL_VI_SYMLINK -ifeq ($(BR2_PACKAGE_VIM_RUNTIME),y) -VIM_POST_INSTALL_TARGET_HOOKS += VIM_REMOVE_DOCS -endif - HOST_VIM_DEPENDENCIES = host-ncurses HOST_VIM_CONF_OPTS = \ --with-tlib=ncurses \Signature · 6 lines
2.52.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot