1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 19:29:53 +03:00
aports/testing/openocd-git/fix-jimtcl-link.patch
Sören Tempel a95affc10d testing/openocd-git: use packaged versions of jimtcl and libjaylink
OpenOCD vendors version 0.80 of jimtcl and version 0.2 of libjaylink
both of these are available as binary packages. As such, it makes more
sense to just use the packages instead.
2021-10-04 08:18:25 +02:00

44 lines
1.6 KiB
Diff

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 =