aboutsummaryrefslogtreecommitdiffstats
path: root/community/openocd/fix-jimtcl-link.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/openocd/fix-jimtcl-link.patch')
-rw-r--r--community/openocd/fix-jimtcl-link.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/community/openocd/fix-jimtcl-link.patch b/community/openocd/fix-jimtcl-link.patch
new file mode 100644
index 00000000000..657f3333c65
--- /dev/null
+++ b/community/openocd/fix-jimtcl-link.patch
@@ -0,0 +1,44 @@
+Without this patch, OpenOCD only adds -ljim when linking against the
+internal version of jimtcl is disabled. This is insufficient as we build
+jimtcl with various additional features (OpenSSL, …) and thus also need
+to link against the libraries needed for these features (e.g. -lssl).
+For this reason, it is required to extract libraries needed by jimtcl
+using pkg-config. In the GNU autotools context, this can be achieved using
+the PKG_CHECK_MODULES macro from pkg.m4(7).
+
+This patch uses this macro for jimtcl and adds the required
+CFLAGS/LDFLAGS values for linking against jimtcl for the openocd target.
+
+diff -upr a/configure.ac b/configure.ac
+--- a/configure.ac 2021-09-14 17:31:53.000000000 +0200
++++ b/configure.ac 2021-10-02 11:32:04.066085040 +0200
+@@ -622,6 +622,9 @@ PKG_CHECK_MODULES([LIBGPIOD], [libgpiod]
+ PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
+ [use_libjaylink=yes], [use_libjaylink=no])
+
++PKG_CHECK_MODULES([LIBJIM], [jimtcl >= 0.80],
++ [use_internal_jimtcl=no], [use_internal_jimtcl=yes])
++
+ m4_define([PROCESS_ADAPTERS], [
+ m4_foreach([adapter], [$1], [
+ AS_IF([test $2], [
+diff -upr a/src/Makefile.am b/src/Makefile.am
+--- a/src/Makefile.am 2021-09-14 17:31:53.000000000 +0200
++++ b/src/Makefile.am 2021-10-02 11:31:57.529416686 +0200
+@@ -9,13 +9,15 @@ bin_PROGRAMS += %D%/openocd
+ %D%/openocd.c %D%/openocd.h
+
+ %C%_openocd_LDADD = %D%/libopenocd.la
++%C%_openocd_CFLAGS =
+
+ %C%_openocd_LDADD += $(MINGWLDADD)
+
+ if INTERNAL_JIMTCL
+ %C%_openocd_LDADD += $(top_builddir)/jimtcl/libjim.a
+ else
+-%C%_openocd_LDADD += -ljim
++%C%_openocd_CFLAGS += $(LIBJIM_CFLAGS)
++%C%_openocd_LDADD += $(LIBJIM_LIBS)
+ endif
+
+ %C%_libopenocd_la_CPPFLAGS =