Package: openocd
Version: 0.4.0-1+nmu1
Severity: wishlist
Hello,
This is a patch I worked out to be able to build openocd against **closed
source library ftd2xx**, the patch fetches source from internet, so it might
not be suitable for building in the autobuilders, but maybe patch could be
merged for local builds.
In order to be able to build against ftd2xx, LIBFTDI environment variable
needs to be set to
LIBFTDI=ftd2xx dpkg-buildpackage [...]
Best regards,
-- Hector Oron
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (700, 'unstable'), (600, 'testing'), (500, 'stable'), (1,
'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages openocd depends on:
ii dpkg 1.15.8.5 Debian package management system
ii install-info 4.13a.dfsg.1-6 Manage installed documentation in
ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib
ii libftdi1 0.18-1 Library to control and program the
ii libusb-0.1-4 2:0.1.12-16 userspace USB programming library
openocd recommends no packages.
openocd suggests no packages.
-- no debconf information
diff -Naur openocd-0.4.0/debian/rules openocd-0.4.0.ftd2xx//debian/rules
--- openocd-0.4.0/debian/rules 2010-11-01 13:38:23.000000000 +0000
+++ openocd-0.4.0.ftd2xx//debian/rules 2010-11-01 15:53:06.000000000 +0000
@@ -6,6 +6,8 @@
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/rules/utils.mk
+DEB_DH_SHLIBDEPS_ARGS := -Xopenocd
+
# Upstream ChangeLog generated via 'git log > ChangeLog'.
DEB_INSTALL_CHANGELOGS_ALL := debian/ChangeLog
@@ -20,11 +22,9 @@
DEB_CONFIGURE_EXTRA_FLAGS := \
--enable-maintainer-mode \
--disable-werror \
- --enable-ft2232_libftdi \
--enable-ep93xx \
--enable-at91rm9200 \
--enable-usbprog \
- --enable-presto_libftdi \
--enable-jlink \
--enable-vsllink \
--enable-rlink \
@@ -42,7 +42,29 @@
# as they're currently supported there only.
DEB_CONFIGURE_EXTRA_FLAGS += --enable-gw16012 --enable-amtjtagaccel
endif
-
+
+# Select which FTDI library to be used
+LIBFTDI ?= libftdi
+#LIBFTDI ?= ftd2xx
+FTDDIR ?= /tmp/libftd2xx
+
+ifeq ($(LIBFTDI),libftdi)
+configure_flags_ftdilib := \
+ --enable-ft2232_libftdi \
+ --enable-presto_libftdi
+else
+ifeq ($(LIBFTDI),ftd2xx)
+configure_flags_ftdilib := \
+ --enable-ft2232_ftd2xx \
+ --enable-presto_ftd2xx \
+ --enable-usb_blaster_ftd2xx \
+ --with-ftd2xx-linux-tardir=$(FTDDIR) \
+ --with-ftd2xx-lib=shared \
+ LDFLAGS=-L$(FTDDIR)
+endif
+endif
+DEB_CONFIGURE_EXTRA_FLAGS += $(configure_flags_ftdilib)
+
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
# Parport drivers only work on Linux and kFreeBSD, conditionally add them here
DEB_CONFIGURE_EXTRA_FLAGS += $(configure_flags_parport)
@@ -53,6 +75,20 @@
### debian/stamp-autothings-update:
### ./bootstrap
### touch $@
+makebuilddir/openocd::
+ifeq ($(LIBFTDI),ftd2xx)
+DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# Fetch the library
+ifeq ($(DEB_BUILD_ARCH),amd64)
+$(shell test -f $(FTDDIR).tar.gz || wget -N -nd http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-0.4.16_x86_64.tar.gz -O $(FTDDIR).tar.gz)
+else
+ifeq ($(DEB_BUILD_ARCH),i386)
+$(shell test -f $(FTDDIR).tar.gz || wget -N -nd http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-0.4.16.tar.gz -O $(FTDDIR).tar.gz)
+endif
+endif
+$(shell mkdir $(FTDDIR))
+$(shell tar xzf $(FTDDIR).tar.gz --strip-components=1 -C $(FTDDIR))
+endif
post-patches::
@### @# Make autotools scripts executable.
@@ -73,6 +109,7 @@
@### rm -f debian/stamp-autothings-update
@# Clean copied udev file.
rm -f debian/openocd.udev
+ rm -f /tmp/libftd2xx.tar.gz
@### @# Delete generated files, we don't want them in the diff.
@### rm -f config.guess aclocal.m4 config.h.in config.sub Makefile.in
@### rm -f install-sh missing depcomp configure src/Makefile.in