testing/openocd-esp32: new aport

Fork of OpenOCD with ESP32 support
https://github.com/espressif/openocd-esp32
This commit is contained in:
Marian Buschsieweke 2022-10-20 18:13:25 +00:00 committed by psykose
parent df81029b25
commit 9c770b8936
2 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,64 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=openocd-esp32
pkgver=0_git20221007
_commit=f6c3cc469e43f676f5b9030859f7596f2057167c
pkgrel=0
pkgdesc="Fork of OpenOCD with ESP32 support"
url="https://github.com/espressif/openocd-esp32"
arch="all"
license="GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only"
makedepends="
autoconf
automake
hidapi-dev
jimtcl-dev
libftdi1-dev
libjaylink-dev
libtool
libusb-dev
"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/espressif/openocd-esp32/archive/$_commit.tar.gz
fix-jimtcl-link.patch"
builddir="$srcdir/openocd-esp32-$_commit"
##
# XXX: Remove this aport when changes are upstreamed.
##
prepare() {
default_prepare
./bootstrap nosubmodule
}
build() {
# --datadir:
# avoid conflicts with upstream openocd to allow parallel installations
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--datadir=/usr/share/$pkgname \
--localstatedir=/var \
--disable-werror \
--disable-internal-jimtcl \
--disable-internal-libjaylink
make
}
check() {
make check
}
package() {
make DESTDIR="$pkgdir" install
mv "$pkgdir"/usr/bin/openocd "$pkgdir"/usr/bin/$pkgname
}
sha512sums="
c84d13c8a00ee7e9d587dd7eef7b71a909c7e1bc5214360b614606000b7e35ca04033d5dc4a1acc0b2b70c20985287b94b426224fe9077deb5f8a0665f8ebdfc openocd-esp32-0_git20221007.tar.gz
6fd2fbe11917bb7f181ba67812f63e75d51bcd19e4df6a7e22e1abb8f36a4f4bdc9202e815f560476ec184d54d84df8ae4dceb17f2429b9dc1d9503804dacb03 fix-jimtcl-link.patch
"

View File

@ -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 =