openocd: update libftdi dependency, fix Darwin build

Restrict Linux-only features to Linux and disable any feature that
doesn't build on Darwin for any reason.

Restrict GCC-specific cflags to GCC.
This commit is contained in:
Andrew Childs 2019-05-01 18:56:15 +09:00 committed by Bjørn Forsman
parent 16e5ce4058
commit 8e2ab5d8dd

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, libftdi, libusb1, pkgconfig, hidapi }:
{ stdenv, lib, fetchurl, libftdi1, libusb1, pkgconfig, hidapi }:
stdenv.mkDerivation rec {
name = "openocd-${version}";
@ -10,28 +10,28 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libftdi libusb1 hidapi ];
buildInputs = [ libftdi1 libusb1 hidapi ];
configureFlags = [
"--enable-jtag_vpi"
"--enable-usb_blaster_libftdi"
"--enable-amtjtagaccel"
"--enable-gw16012"
(lib.enableFeature (! stdenv.isDarwin) "amtjtagaccel")
(lib.enableFeature (! stdenv.isDarwin) "gw16012")
"--enable-presto_libftdi"
"--enable-openjtag_ftdi"
"--enable-oocd_trace"
(lib.enableFeature (! stdenv.isDarwin) "oocd_trace")
"--enable-buspirate"
"--enable-sysfsgpio"
(lib.enableFeature stdenv.isLinux "sysfsgpio")
"--enable-remote-bitbang"
];
NIX_CFLAGS_COMPILE = [
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
"-Wno-implicit-fallthrough"
"-Wno-format-truncation"
"-Wno-format-overflow"
];
postInstall = ''
postInstall = lib.optionalString stdenv.isLinux ''
mkdir -p "$out/etc/udev/rules.d"
rules="$out/share/openocd/contrib/60-openocd.rules"
if [ ! -f "$rules" ]; then
@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
ln -s "$rules" "$out/etc/udev/rules.d/"
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing";
longDescription = ''
OpenOCD provides on-chip programming and debugging support with a layered
@ -55,6 +55,6 @@ stdenv.mkDerivation rec {
homepage = http://openocd.sourceforge.net/;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ bjornfor ];
platforms = platforms.linux;
platforms = platforms.unix;
};
}