On Thu, Oct 27, 2016 at 12:08:07AM +0300, Theodoros Foradis wrote: > * gnu/packages/embedded.scm (openocd): New variable. > * gnu/packages/patches/openocd-nrf52.patch: New file. > * gnu/local.mk (dist_patch_DATA): Add the patch. > --- > gnu/local.mk | 1 + > gnu/packages/embedded.scm | 70 +++ > gnu/packages/patches/openocd-nrf52.patch | 843 +++++++++++++++++++++++++++++++ > 3 files changed, 914 insertions(+) > create mode 100644 gnu/packages/patches/openocd-nrf52.patch > > diff --git a/gnu/local.mk b/gnu/local.mk > index 9019b98..b2db850 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -742,6 +742,7 @@ dist_patch_DATA = \ > %D%/packages/patches/openjpeg-CVE-2016-5157.patch \ > %D%/packages/patches/openjpeg-CVE-2016-7163.patch \ > %D%/packages/patches/openjpeg-use-after-free-fix.patch \ > + %D%/packages/patches/openocd-nrf52.patch \ > %D%/packages/patches/openssh-memory-exhaustion.patch \ > %D%/packages/patches/openssl-runpath.patch \ > %D%/packages/patches/openssl-1.1.0-c-rehash-in.patch \ > diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm > index 0b4f9ab..f65523d 100644 > --- a/gnu/packages/embedded.scm > +++ b/gnu/packages/embedded.scm > @@ -28,11 +28,16 @@ > #:use-module (guix build-system trivial) > #:use-module (guix build utils) > #:use-module (gnu packages) > + #:use-module (gnu packages autotools) > #:use-module (gnu packages cross-base) > #:use-module (gnu packages flex) > #:use-module (gnu packages gcc) > #:use-module (gnu packages gdb) > + #:use-module (gnu packages hidapi) > + #:use-module (gnu packages libftdi) > + #:use-module (gnu packages libusb) > #:use-module (gnu packages perl) > + #:use-module (gnu packages pkg-config) > #:use-module (gnu packages texinfo)) > > ;; We must not use the released GCC sources here, because the cross-compiler > @@ -236,3 +241,68 @@ languages are C and C++.") > "--enable-languages=c,c++" > "--disable-nls") > ,@(package-arguments gdb))))) > + > +;; We build openocd from git, because the JTAG library libjaylink > +;; is not included in tarball releases. > +(define-public openocd > + (let* ((commit "674141e8a7a6413cb803d90c2a20150260015f81") > + (revision "1")) > + (package > + (name "openocd") > + (version (string-append "0.9.0-" revision "." > + (string-take commit 7))) > + (source (origin > + (method git-fetch) > + (uri (git-reference > + (url (string-append "git://git.code.sf.net/p/" name "/code.git")) > + (commit commit) > + (recursive? #t))) > + (sha256 > + (base32 "0p8rcqhkx3f29j08w33fkp8xnzj4xxa41lzdfq5wd1i4x8s07s0p")) > + (file-name (string-append name "-" version "-checkout.tar.xz")) quick nit-pick, since it's a checkout it doesn't need the .tar.xz > + (patches > + (search-patches "openocd-nrf52.patch")))) > + (build-system gnu-build-system) > + (arguments > + '(#:configure-flags > + (append (list "--disable-werror") > + (map (lambda (programmer) > + (string-append "--enable-" programmer)) > + '("amtjtagaccel" "armjtagew" "buspirate" "ftdi" > + "gw16012" "jlink" "oocd_trace" "opendous" "osbdm" > + "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi" "remote-bitbang" > + "rlink" "stlink" "ti-icdi" "ulink" "usbprog" "vsllink" > + "usb-blaster-2" "usb_blaster" "presto" "openjtag"))) > + #:phases > + (modify-phases %standard-phases > + (add-before 'configure 'autoreconf > + (lambda _ > + (zero? (system* "autoreconf" "-vfi")))) > + (add-after 'autoreconf 'patch-configure > + (lambda _ > + (substitute* "configure" > + (("SHELL = /bin/sh") (string-append "SHELL = " (which "sh")))) > + (substitute* "configure" > + (("srcdir/src/jtag/drivers/libjaylink/configure.gnu") > + (string-append "echo -e '#!" (which "sh") "\nexec \"`dirname \"'\\$'0\"` > +/configure\" --enable-subproject-build \"'\\$'@\"' > \" > +$srcdir/src/jtag/drivers/libjaylink/configure.gnu\""))) > + #t))))) > + (inputs > + `(("hidapi" ,hidapi) > + ("libftdi" ,libftdi) > + ("libusb" ,libusb) > + ("libusb-compat" ,libusb-compat))) > + (native-inputs > + `(("autoconf" ,autoconf) > + ("automake" ,automake) > + ("libtool" ,libtool) > + ("pkg-config" ,pkg-config))) > + (home-page "http://openocd.org") > + (synopsis "Open On-Chip Debugger") > + (description > + "OpenOCD provides on-chip programming and debugging support with a > +layered architecture of JTAG interface and TAP support.") > + (license (list license:gpl2 ;; openocd and git2cl submodule > + license:gpl2+ ;; libjaylink submodule > + license:bsd-2))))) ;; jimctl submodule -- Efraim Flashner אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted