From aa4707fc3449192b961bfd2dfc16b9042df0d7f3 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Fri, 12 Oct 2018 15:21:26 -0500 Subject: [PATCH] treewide: use gnu toolchain for avr/arm-embedded These packages should in theory work with our GCC toolchains, but there are some definite breakages that need to be tracked down. Comparing output of these to old gcc-arm-embedded is important. Affected packages include: - axolooti - avrdudess - opentx - microscheme - betaflight - inav - blackmagic - simavr - gnuk --- pkgs/applications/audio/axoloti/default.nix | 5 +-- pkgs/applications/misc/avrdudess/default.nix | 4 +-- pkgs/applications/misc/opentx/default.nix | 8 +++-- .../compilers/microscheme/default.nix | 7 +---- pkgs/development/misc/newlib/default.nix | 5 +-- .../misc/stm32/betaflight/default.nix | 7 ++--- pkgs/development/misc/stm32/inav/default.nix | 7 ++--- .../tools/misc/blackmagic/default.nix | 7 +++-- pkgs/development/tools/simavr/default.nix | 14 +++------ pkgs/misc/gnuk/generic.nix | 4 +-- pkgs/top-level/all-packages.nix | 31 +++++++++++++++---- 11 files changed, 57 insertions(+), 42 deletions(-) diff --git a/pkgs/applications/audio/axoloti/default.nix b/pkgs/applications/audio/axoloti/default.nix index 274233167bd8..ece036687018 100644 --- a/pkgs/applications/audio/axoloti/default.nix +++ b/pkgs/applications/audio/axoloti/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchFromGitHub, fetchurl, makeWrapper, unzip -, gnumake, gcc-arm-embedded, dfu-util-axoloti, jdk, ant, libfaketime }: +, gnumake, gcc-arm-embedded, binutils-arm-embedded +, dfu-util-axoloti, jdk, ant, libfaketime }: stdenv.mkDerivation rec { version = "1.0.12-2"; @@ -20,7 +21,7 @@ stdenv.mkDerivation rec { sha256 = "0lb5s8pkj80mqhsy47mmq0lqk34s2a2m3xagzihalvabwd0frhlj"; }; - buildInputs = [ makeWrapper unzip gcc-arm-embedded dfu-util-axoloti jdk ant libfaketime ]; + buildInputs = [ makeWrapper unzip gcc-arm-embedded binutils-arm-embedded dfu-util-axoloti jdk ant libfaketime ]; patchPhase = '' unzip ${chibios} diff --git a/pkgs/applications/misc/avrdudess/default.nix b/pkgs/applications/misc/avrdudess/default.nix index c803eb37ad6f..1144d5152847 100644 --- a/pkgs/applications/misc/avrdudess/default.nix +++ b/pkgs/applications/misc/avrdudess/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, unzip, mono, avrbinutils, avrgcc, avrdude, gtk2, xdg_utils }: +{ stdenv, fetchurl, unzip, mono, avrdude, gtk2, xdg_utils }: stdenv.mkDerivation rec { name = "avrdudess-2.2.20140102"; @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { export LD_LIBRARY_PATH="${stdenv.lib.makeLibraryPath [gtk2 mono]}" # We need PATH from user env for xdg-open to find its tools, which # typically depend on the currently running desktop environment. - export PATH="${stdenv.lib.makeBinPath [ avrgcc avrbinutils avrdude xdg_utils ]}:\$PATH" + export PATH="${stdenv.lib.makeBinPath [ avrdude xdg_utils ]}:\$PATH" # avrdudess must have its resource files in its current working directory cd $out/avrdudess && exec ${mono}/bin/mono "$out/avrdudess/avrdudess.exe" "\$@" diff --git a/pkgs/applications/misc/opentx/default.nix b/pkgs/applications/misc/opentx/default.nix index 8a941a719f29..0aecc43d1e53 100644 --- a/pkgs/applications/misc/opentx/default.nix +++ b/pkgs/applications/misc/opentx/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub -, cmake, gcc-arm-embedded, python +, cmake, gcc-arm-embedded, binutils-arm-embedded, python , qt5, SDL, gmock , dfu-util, avrdude }: @@ -21,10 +21,12 @@ in stdenv.mkDerivation { enableParallelBuilding = true; - nativeBuildInputs = [ cmake ]; + nativeBuildInputs = [ + cmake + gcc-arm-embedded binutils-arm-embedded + ]; buildInputs = with qt5; [ - gcc-arm-embedded python python.pkgs.pyqt4 qtbase qtmultimedia qttranslations SDL gmock diff --git a/pkgs/development/compilers/microscheme/default.nix b/pkgs/development/compilers/microscheme/default.nix index cfee1b0d8639..f15a76243277 100644 --- a/pkgs/development/compilers/microscheme/default.nix +++ b/pkgs/development/compilers/microscheme/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchzip, vim, avrdude, avrbinutils, avrgcc, avrlibc, makeWrapper }: +{ stdenv, fetchzip, vim, makeWrapper }: stdenv.mkDerivation rec { name = "microscheme-${version}"; @@ -10,15 +10,10 @@ stdenv.mkDerivation rec { sha256 = "1r3ng4pw1s9yy1h5rafra1rq19d3vmb5pzbpcz1913wz22qdd976"; }; - # Just a guess - propagatedBuildInputs = [ avrlibc ]; buildInputs = [ makeWrapper vim ]; installPhase = '' make install PREFIX=$out - - wrapProgram $out/bin/microscheme \ - --prefix PATH : "${stdenv.lib.makeBinPath [ avrdude avrgcc avrbinutils ]}" ''; meta = with stdenv.lib; { diff --git a/pkgs/development/misc/newlib/default.nix b/pkgs/development/misc/newlib/default.nix index e26f0f78f210..693cfa093b08 100644 --- a/pkgs/development/misc/newlib/default.nix +++ b/pkgs/development/misc/newlib/default.nix @@ -23,12 +23,13 @@ in stdenv.mkDerivation { "--disable-nls" "--enable-newlib-io-long-long" "--enable-newlib-register-fini" + "--enable-newlib-retargetable-locking" ]; dontDisableStatic = true; passthru = { - incdir = "/${stdenv.hostPlatform.config}/include"; - libdir = "/${stdenv.hostPlatform.config}/lib"; + incdir = "/${stdenv.targetPlatform.config}/include"; + libdir = "/${stdenv.targetPlatform.config}/lib"; }; } diff --git a/pkgs/development/misc/stm32/betaflight/default.nix b/pkgs/development/misc/stm32/betaflight/default.nix index 0c601c7773cc..21230464e747 100644 --- a/pkgs/development/misc/stm32/betaflight/default.nix +++ b/pkgs/development/misc/stm32/betaflight/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub -, gcc-arm-embedded, python2 +, gcc-arm-embedded, binutils-arm-embedded, python2 , skipTargets ? [ # These targets do not build, for the reasons listed, along with the last version checked. # Probably all of the issues with these targets need to be addressed upstream. @@ -24,8 +24,8 @@ in stdenv.mkDerivation rec { sha256 = "1wyp23p876xbfi9z6gm4xn1nwss3myvrjjjq9pd3s0vf5gkclkg5"; }; - buildInputs = [ - gcc-arm-embedded + nativeBuildInputs = [ + gcc-arm-embedded binutils-arm-embedded python2 ]; @@ -58,7 +58,6 @@ in stdenv.mkDerivation rec { homepage = https://github.com/betaflight/betaflight; license = licenses.gpl3; maintainers = with maintainers; [ elitak ]; - platforms = [ "i686-linux" "x86_64-linux" ]; }; } diff --git a/pkgs/development/misc/stm32/inav/default.nix b/pkgs/development/misc/stm32/inav/default.nix index cb9cc80d3252..9c35ac2ffce1 100644 --- a/pkgs/development/misc/stm32/inav/default.nix +++ b/pkgs/development/misc/stm32/inav/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub -, gcc-arm-embedded, ruby +, gcc-arm-embedded, binutils-arm-embedded, ruby }: let @@ -17,8 +17,8 @@ in stdenv.mkDerivation rec { sha256 = "15zai8qf43b06fmws1sbkmdgip51zp7gkfj7pp9b6gi8giarzq3y"; }; - buildInputs = [ - gcc-arm-embedded + nativeBuildInputs = [ + gcc-arm-embedded binutils-arm-embedded ruby ]; @@ -50,7 +50,6 @@ in stdenv.mkDerivation rec { homepage = https://inavflight.github.io; license = licenses.gpl3; maintainers = with maintainers; [ elitak ]; - platforms = [ "i686-linux" "x86_64-linux" ]; }; } diff --git a/pkgs/development/tools/misc/blackmagic/default.nix b/pkgs/development/tools/misc/blackmagic/default.nix index 2974c653acdd..281463528354 100644 --- a/pkgs/development/tools/misc/blackmagic/default.nix +++ b/pkgs/development/tools/misc/blackmagic/default.nix @@ -1,5 +1,5 @@ { stdenv, lib, fetchFromGitHub -, gcc-arm-embedded, libftdi +, gcc-arm-embedded, binutils-arm-embedded, libftdi , python, pythonPackages }: @@ -17,8 +17,11 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + nativeBuildInputs = [ + gcc-arm-embedded binutils-arm-embedded + ]; + buildInputs = [ - gcc-arm-embedded libftdi python pythonPackages.intelhex diff --git a/pkgs/development/tools/simavr/default.nix b/pkgs/development/tools/simavr/default.nix index b009d5ed601b..e28aad40ef47 100644 --- a/pkgs/development/tools/simavr/default.nix +++ b/pkgs/development/tools/simavr/default.nix @@ -1,4 +1,5 @@ -{ stdenv, fetchFromGitHub, avrbinutils, avrgcc, avrlibc, libelf, which, git, pkgconfig, freeglut +{ stdenv, fetchFromGitHub, libelf, which, git, pkgconfig, freeglut +, avrbinutils, avrgcc, avrlibc , libGLU_combined }: stdenv.mkDerivation rec { @@ -15,14 +16,10 @@ stdenv.mkDerivation rec { # ld: cannot find -lsimavr enableParallelBuilding = false; - preConfigure = '' - substituteInPlace Makefile.common --replace "-I../simavr/sim/avr -I../../simavr/sim/avr" \ - "-I${avrlibc}/avr/include -L${avrlibc}/avr/lib/avr5 -B${avrlibc}/avr/lib -I../simavr/sim/avr -I../../simavr/sim/avr" - ''; buildFlags = "AVR_ROOT=${avrlibc}/avr SIMAVR_VERSION=${version}"; installFlags = buildFlags + " DESTDIR=$(out)"; - + # Hack to avoid TMPDIR in RPATHs. preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" ''; @@ -31,8 +28,8 @@ stdenv.mkDerivation rec { patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target" ''; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ which git avrbinutils avrgcc avrlibc libelf freeglut libGLU_combined ]; + nativeBuildInputs = [ which git pkgconfig avrgcc avrbinutils ]; + buildInputs = [ libelf freeglut libGLU_combined ]; meta = with stdenv.lib; { description = "A lean and mean Atmel AVR simulator"; @@ -43,4 +40,3 @@ stdenv.mkDerivation rec { }; } - diff --git a/pkgs/misc/gnuk/generic.nix b/pkgs/misc/gnuk/generic.nix index 22aaa2d1cb57..80a4518f3f70 100644 --- a/pkgs/misc/gnuk/generic.nix +++ b/pkgs/misc/gnuk/generic.nix @@ -1,4 +1,4 @@ -{ stdenv, gcc-arm-embedded, makeWrapper +{ stdenv, gcc-arm-embedded, binutils-arm-embedded, makeWrapper , python, pythonPackages # Extra options @@ -14,7 +14,7 @@ stdenv.mkDerivation { inherit src; - nativeBuildInputs = [ gcc-arm-embedded makeWrapper ]; + nativeBuildInputs = [ gcc-arm-embedded binutils-arm-embedded makeWrapper ]; buildInputs = [ python ] ++ (with pythonPackages; [ pyusb colorama ]); configurePhase = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 15f50090576d..cd83ad728b8d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -830,7 +830,10 @@ with pkgs; libssl = openssl; }; - axoloti = callPackage ../applications/audio/axoloti { }; + axoloti = callPackage ../applications/audio/axoloti { + gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc; + binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils; + }; dfu-util-axoloti = callPackage ../applications/audio/axoloti/dfu-util.nix { }; libusb1-axoloti = callPackage ../applications/audio/axoloti/libusb1.nix { inherit (darwin) libobjc; @@ -7998,7 +8001,10 @@ with pkgs; avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; - betaflight = callPackage ../development/misc/stm32/betaflight { }; + betaflight = callPackage ../development/misc/stm32/betaflight { + gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc; + binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils; + }; sourceFromHead = callPackage ../build-support/source-from-head-fun.nix {}; @@ -8034,7 +8040,10 @@ with pkgs; guile = guile_2_0; }; - inav = callPackage ../development/misc/stm32/inav { }; + inav = callPackage ../development/misc/stm32/inav { + gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc; + binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils; + }; pharo-vms = callPackage ../development/pharo/vm { }; pharo = pharo-vms.multi-vm-wrapper; @@ -8192,6 +8201,8 @@ with pkgs; blackmagic = callPackage ../development/tools/misc/blackmagic { stdenv = overrideCC stdenv gcc6; + gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc; + binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils; }; bloaty = callPackage ../development/tools/bloaty { }; @@ -12206,7 +12217,11 @@ with pkgs; graphite2 = callPackage ../development/libraries/silgraphite/graphite2.nix {}; - simavr = callPackage ../development/tools/simavr { }; + simavr = callPackage ../development/tools/simavr { + avrgcc = pkgsCross.avr.buildPackages.gcc; + avrbinutils = pkgsCross.avr.buildPackages.binutils; + avrlibc = pkgsCross.avr.libcCross; + }; simgear = callPackage ../development/libraries/simgear { }; @@ -18301,7 +18316,10 @@ with pkgs; opentimestamps-client = python3Packages.callPackage ../tools/misc/opentimestamps-client {}; - opentx = callPackage ../applications/misc/opentx { }; + opentx = callPackage ../applications/misc/opentx { + gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc; + binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils; + }; opera = callPackage ../applications/networking/browsers/opera {}; @@ -21982,7 +22000,8 @@ with pkgs; gnome-breeze = callPackage ../misc/themes/gnome-breeze { }; gnuk = callPackage ../misc/gnuk { - gcc-arm-embedded = gcc-arm-embedded-4_9; + gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc; + binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils; }; greybird = callPackage ../misc/themes/greybird { };