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