From 71a0aff9cf58791f2b777f2e52f1505270a8b16d Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Thu, 24 Sep 2026 15:15:33 +0200 Subject: [PATCH] package/swig: also create a swig4.0 symlink MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FindSWIG in CMake searches for swig4.0, swig3.0 and swig2.0 before it tries plain swig, and it searches the whole PATH for one name before moving on to the next. We only create swig3.0 and swig$(SWIG_VERSION_MAJOR) (swig4.5) symlinks in $(HOST_DIR)/bin, so a swig4.0 installed on the build machine, as Ubuntu 22.04 does with its swig4.0 package, takes precedence over our host-swig for every CMake package that does not pass SWIG_EXECUTABLE explicitly. With CMake 3.22.1, libftdi1 with Python bindings ends up with -- Found SWIG: /usr/bin/swig4.0 (found suitable version "4.0.2", ...) Also create a swig4.0 symlink, and update the comment accordingly. Signed-off-by: Yegor Yefremov Assisted-by: Claude:claude-opus-5 Signed-off-by: Thomas Petazzoni (cherry picked from commit 9722f61382cd86a55e80585af3a088b4d121def4) Signed-off-by: Raphaël Mélotte --- package/swig/swig.mk | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/package/swig/swig.mk b/package/swig/swig.mk index 71e5e05f96..0776ad3d74 100644 --- a/package/swig/swig.mk +++ b/package/swig/swig.mk @@ -30,18 +30,19 @@ endef HOST_SWIG_POST_INSTALL_HOOKS += HOST_SWIG_INSTALL_WRAPPER -# CMake looks first at swig3.0, then swig2.0 and then swig. However, -# when doing the search, it will look into the PATH for swig2.0 first, -# and then for swig. +# CMake looks first for swig4.0, then swig3.0 and swig2.0, and only +# then for swig. However, it searches the whole PATH for one name before +# trying the next one. # While the PATH contains first our $(HOST_DIR)/bin, it also contains # /usr/bin and other system directories. Therefore, if there is an -# installed swig3.0 on the system, it will get the preference over the -# swig installed in $(HOST_DIR)/bin, which isn't nice. To prevent -# this from happening we create a symbolic link swig3.0 -> swig, so that -# our swig always gets used. +# installed swig4.0 or swig3.0 on the system, it will get the preference +# over the swig installed in $(HOST_DIR)/bin, which isn't nice. To prevent +# this from happening we create swig4.0 and swig3.0 symbolic links to +# swig, so that our swig always gets used. define HOST_SWIG_INSTALL_SYMLINK ln -fs swig $(HOST_DIR)/bin/swig$(SWIG_VERSION_MAJOR) + ln -fs swig $(HOST_DIR)/bin/swig4.0 ln -fs swig $(HOST_DIR)/bin/swig3.0 endef