From 75701e0b2f8dd1d7f900ce313cf38e0416a3edbe Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Wed, 29 Nov 2023 17:05:06 +1100 Subject: [PATCH] openocd-rp2040: override openocd package instead --- .../embedded/openocd-rp2040/default.nix | 74 ------------------- pkgs/top-level/all-packages.nix | 16 +++- 2 files changed, 15 insertions(+), 75 deletions(-) delete mode 100644 pkgs/development/embedded/openocd-rp2040/default.nix diff --git a/pkgs/development/embedded/openocd-rp2040/default.nix b/pkgs/development/embedded/openocd-rp2040/default.nix deleted file mode 100644 index 688d83ac27e8..000000000000 --- a/pkgs/development/embedded/openocd-rp2040/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ lib -, stdenv -, fetchgit -, pkg-config -, hidapi -, libftdi1 -, libusb1 -, which -, libtool -, autoconf -, automake -, texinfo -, git -, libgpiod_1 -}: - -stdenv.mkDerivation { - pname = "openocd-rp2040"; - version = "0.12.0"; - src = fetchgit { - url = "https://github.com/raspberrypi/openocd"; - rev = "4d87f6dcae77d3cbcd8ac3f7dc887adf46ffa504"; - sha256 = "sha256-SYC0qqNx09yO/qeKDDN8dF/9d/dofJ5B1h/PofhG8Jw="; - fetchSubmodules = true; - }; - - nativeBuildInputs = [ - pkg-config - ]; - - buildInputs = [ - hidapi - libftdi1 - libusb1 - which - libtool - autoconf - automake - texinfo - git - ] - ++ - # tracking issue for v2 api changes https://sourceforge.net/p/openocd/tickets/306/ - lib.optional stdenv.isLinux libgpiod_1; - - configurePhase = '' - SKIP_SUBMODULE=1 ./bootstrap - ./configure --prefix=$out - ''; - - enableParallelBuilding = true; - - postInstall = lib.optionalString stdenv.isLinux '' - mkdir -p "$out/etc/udev/rules.d" - rules="$out/share/openocd/contrib/60-openocd.rules" - if [ ! -f "$rules" ]; then - echo "$rules is missing, must update the Nix file." - exit 1 - fi - ln -s "$rules" "$out/etc/udev/rules.d/" - ''; - - meta = with lib; { - description = "OpenOCD fork for rp2040 microcontroller"; - longDescription = '' - This is a fork of OpenOCD by Raspberry Pi, - which brings support to the rp2040 microcontroller. - ''; - homepage = "https://github.com/raspberrypi/openocd"; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ lu15w1r7h ]; - platforms = platforms.linux; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e1a6f286610f..16406ab1bfad 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19708,7 +19708,21 @@ with pkgs; openocd = callPackage ../development/embedded/openocd { }; - openocd-rp2040 = callPackage ../development/embedded/openocd-rp2040 { }; + openocd-rp2040 = openocd.overrideAttrs (old: { + pname = "openocd-rp2040"; + src = fetchFromGitHub { + owner = "raspberrypi"; + repo = "openocd"; + rev = "4d87f6dcae77d3cbcd8ac3f7dc887adf46ffa504"; + hash = "sha256-bBqVoHsnNoaC2t8hqcduI8GGlO0VDMUovCB0HC+rxvc="; + # openocd disables the vendored libraries that use submodules and replaces them with nix versions. + # this works out as one of the submodule sources seems to be flakey. + fetchSubmodules = false; + }; + nativeBuildInputs = old.nativeBuildInputs ++ [ + autoreconfHook + ]; + }); oprofile = callPackage ../development/tools/profiling/oprofile { libiberty_static = libiberty.override { staticBuild = true; };