aboutsummaryrefslogtreecommitdiffstats
path: root/testing/openocd-git
diff options
context:
space:
mode:
Diffstat (limited to 'testing/openocd-git')
-rw-r--r--testing/openocd-git/APKBUILD26
-rw-r--r--testing/openocd-git/fix-dynamic-linking.patch25
-rw-r--r--testing/openocd-git/fix-jimtcl-link.patch44
3 files changed, 80 insertions, 15 deletions
diff --git a/testing/openocd-git/APKBUILD b/testing/openocd-git/APKBUILD
index 1807668e5d..4bc0a4bd36 100644
--- a/testing/openocd-git/APKBUILD
+++ b/testing/openocd-git/APKBUILD
@@ -2,32 +2,26 @@
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
_pkgname=openocd
_commit=28c91b8f80937e6ec6521496f363038d9a5f9a04
-_jimtcl_commit=fb923fab4f0cf276c336d98692d00df6a943791d
-_libjaylink_commit=9aa7a5957c07bb6e862fc1a6d3153d109c7407e4
pkgname=$_pkgname-git
pkgver=20210702
-pkgrel=0
+pkgrel=1
pkgdesc="Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing"
url="http://openocd.org/"
arch="all"
license="GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only"
-makedepends="libftdi1-dev libusb-dev hidapi-dev libtool autoconf automake"
+makedepends="libftdi1-dev libusb-dev hidapi-dev jimtcl-dev
+ libjaylink-dev libtool autoconf automake"
provides="openocd"
subpackages="$pkgname-dev $pkgname-doc"
# Note: Using a github mirror here as sourceforge git snapshots have changing checksums
source="$_pkgname-$_commit.tar.gz::https://github.com/ntfreak/openocd/archive/$_commit.tar.gz
- jimtcl-$_jimtcl_commit.tar.gz::https://github.com/msteveb/jimtcl/archive/$_jimtcl_commit.tar.gz
- libjaylink-$_libjaylink_commit.tar.gz::https://repo.or.cz/libjaylink.git/snapshot/$_libjaylink_commit.tar.gz
- "
+ fix-jimtcl-link.patch
+ fix-dynamic-linking.patch"
builddir="$srcdir/$_pkgname-$_commit"
prepare() {
default_prepare
- rmdir jimtcl
- ln -s ../jimtcl-$_jimtcl_commit jimtcl
- rmdir src/jtag/drivers/libjaylink
- ln -s "../../../../libjaylink-${_libjaylink_commit:0:7}" src/jtag/drivers/libjaylink
- ./bootstrap
+ ./bootstrap nosubmodule
}
build() {
@@ -41,7 +35,9 @@ build() {
--disable-werror \
--enable-cmsis-dap \
--enable-sysfsgpio \
- --enable-bcm2835gpio
+ --enable-bcm2835gpio \
+ --disable-internal-jimtcl \
+ --disable-internal-libjaylink
make
}
@@ -55,6 +51,6 @@ package() {
sha512sums="
c1f02277262ec3cc168b18a71d436a123f08e5246e35f94e37c922618c9d91e34b8ca525eed1f93a2ce37315f23c6d9a6a8f88ca4c2bc16bc3e432127ffcd70d openocd-28c91b8f80937e6ec6521496f363038d9a5f9a04.tar.gz
-faa6a1e490715da83bac3f7e5115d53803a50401689b4e36f7694598470d263e4ce8744647d11e6c2b2d8e10eae08d6213f31b0b883848b67659ef93cb8f3ed9 jimtcl-fb923fab4f0cf276c336d98692d00df6a943791d.tar.gz
-bf7f342033e79fde5a023661b90deb2b9b7de4ba94fa79cca8b0ae00c6f335ed4b14554dbef8bfcf87b69484508ad7ac9aab8d35b1e3028ad00e2ac29e948fe9 libjaylink-9aa7a5957c07bb6e862fc1a6d3153d109c7407e4.tar.gz
+6fd2fbe11917bb7f181ba67812f63e75d51bcd19e4df6a7e22e1abb8f36a4f4bdc9202e815f560476ec184d54d84df8ae4dceb17f2429b9dc1d9503804dacb03 fix-jimtcl-link.patch
+a0980806af54bafd759c2e329cd11eabf0eb352f7f823966ab0f4a60508559fb7abd41072c0a882da0906ddf086ee139115deca04bb1a70ab915b50a1d3fc2e7 fix-dynamic-linking.patch
"
diff --git a/testing/openocd-git/fix-dynamic-linking.patch b/testing/openocd-git/fix-dynamic-linking.patch
new file mode 100644
index 0000000000..44cec60630
--- /dev/null
+++ b/testing/openocd-git/fix-dynamic-linking.patch
@@ -0,0 +1,25 @@
+Without this patch, linking against libjim dynamically will cause an
+infinite loop. We just fix the memory leak, for which this thingy is
+supposed to be a workaround, directly in the jimtcl package instead.
+
+See: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13046#note_182639
+
+diff -upr a/src/helper/command.c b/src/helper/command.c
+--- a/src/helper/command.c 2021-10-02 11:47:43.452995606 +0200
++++ b/src/helper/command.c 2021-10-02 11:51:10.803049538 +0200
+@@ -148,9 +148,14 @@ static void command_log_capture_finish(s
+ * If jimtcl is linked-in from a precompiled library, either static or dynamic,
+ * the symbol Jim_CreateCommandObj is not exported and the build will use the
+ * bugged API.
++ *
++ * This workaround creates an infinite loop when OpenOCD is linked
++ * dynamically against jimtcl on Alpine and thus only enabled if the internal
++ * version of jimtcl is used.
++ *
+ * To be removed when OpenOCD will switch to jimtcl 0.81
+ */
+-#if JIM_VERSION == 80 && defined __linux__
++#if JIM_VERSION == 80 && defined __linux__ && defined INTERNAL_JIMTCL
+ static int workaround_createcommand(Jim_Interp *interp, const char *cmdName,
+ Jim_CmdProc *cmdProc, void *privData, Jim_DelCmdProc *delProc);
+ int Jim_CreateCommandObj(Jim_Interp *interp, Jim_Obj *cmdNameObj,
diff --git a/testing/openocd-git/fix-jimtcl-link.patch b/testing/openocd-git/fix-jimtcl-link.patch
new file mode 100644
index 0000000000..657f3333c6
--- /dev/null
+++ b/testing/openocd-git/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 =