mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
Swig has a compiled in absolute path to its data files, which can be overridden using the SWIG_LIB environment variable: https://github.com/swig/swig/blob/v4.1.1/Source/Modules/main.cxx#L931-L945 This unfortunately means that host-swig misbehaves when used in the SDK, as this points to the ${HOST_DIR}/bin of the build, which may not be available when the SDK is used. The issue was reported upstream but rejected in https://github.com/swig/swig/issues/253, so instead add a wrapper script which calculates a sensible SWIG_LIB relative to the wrapper location unless SWIG_LIB is set, similar to how we do it for E.G. gcc or pkgconf. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> [Peter: add quotes to make shellcheck happy] Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
53 lines
1.9 KiB
Makefile
53 lines
1.9 KiB
Makefile
################################################################################
|
|
#
|
|
# swig
|
|
#
|
|
################################################################################
|
|
|
|
SWIG_VERSION_MAJOR = 4.1
|
|
SWIG_VERSION = $(SWIG_VERSION_MAJOR).1
|
|
SWIG_SITE = http://downloads.sourceforge.net/project/swig/swig/swig-$(SWIG_VERSION)
|
|
HOST_SWIG_DEPENDENCIES = host-bison host-pcre2
|
|
HOST_SWIG_CONF_OPTS = \
|
|
--with-pcre \
|
|
--disable-ccache \
|
|
--without-octave
|
|
SWIG_LICENSE = GPL-3.0+, BSD-2-Clause, BSD-3-Clause
|
|
SWIG_LICENSE_FILES = LICENSE LICENSE-GPL LICENSE-UNIVERSITIES
|
|
|
|
# Swig has a compiled in absolute path to its data files, so it does
|
|
# not work when copied somewhere else for the SDK. Issue was reported
|
|
# upstream but rejected in https://github.com/swig/swig/issues/253 so
|
|
# instead add a wrapper to work around this
|
|
|
|
define HOST_SWIG_INSTALL_WRAPPER
|
|
mv -f $(HOST_DIR)/bin/swig $(HOST_DIR)/bin/swig.br_real
|
|
$(INSTALL) -m 0755 -D package/swig/swig-wrapper.in \
|
|
$(HOST_DIR)/bin/swig
|
|
$(SED) 's,@SWIG_VERSION@,$(SWIG_VERSION),g' \
|
|
$(HOST_DIR)/bin/swig
|
|
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.
|
|
# 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.
|
|
|
|
define HOST_SWIG_INSTALL_SYMLINK
|
|
ln -fs swig $(HOST_DIR)/bin/swig$(SWIG_VERSION_MAJOR)
|
|
ln -fs swig $(HOST_DIR)/bin/swig3.0
|
|
endef
|
|
|
|
HOST_SWIG_POST_INSTALL_HOOKS += HOST_SWIG_INSTALL_SYMLINK
|
|
|
|
$(eval $(host-autotools-package))
|
|
|
|
SWIG = $(HOST_DIR)/bin/swig$(SWIG_VERSION_MAJOR)
|