about summary refs log tree commit diff
path: root/nixpkgs/pkgs
diff options
context:
space:
mode:
authorAaron Janse <aaron@ajanse.me>2020-07-21 13:11:36 -0700
committerAlyssa Ross <hi@alyssa.is>2020-11-27 13:27:27 +0000
commit264f67859c87de433106ff97d00151b79dabc5ed (patch)
treeaaf1eae2da47ad38063725dcd9764f85c8af9621 /nixpkgs/pkgs
parentb17052ae9306cad34fd83bfe1f4f830d171052d4 (diff)
downloadnixlib-264f67859c87de433106ff97d00151b79dabc5ed.tar
nixlib-264f67859c87de433106ff97d00151b79dabc5ed.tar.gz
nixlib-264f67859c87de433106ff97d00151b79dabc5ed.tar.bz2
nixlib-264f67859c87de433106ff97d00151b79dabc5ed.tar.lz
nixlib-264f67859c87de433106ff97d00151b79dabc5ed.tar.xz
nixlib-264f67859c87de433106ff97d00151b79dabc5ed.tar.zst
nixlib-264f67859c87de433106ff97d00151b79dabc5ed.zip
redox: add as target
(cherry picked from commit 60fd049b6552d73a5162109e7d8aa0839b54c398)
Diffstat (limited to 'nixpkgs/pkgs')
-rw-r--r--nixpkgs/pkgs/development/compilers/gcc/6/default.nix13
-rw-r--r--nixpkgs/pkgs/development/compilers/rust/rustc.nix2
-rw-r--r--nixpkgs/pkgs/development/libraries/relibc/default.nix32
-rw-r--r--nixpkgs/pkgs/stdenv/cross/default.nix4
-rw-r--r--nixpkgs/pkgs/top-level/all-packages.nix17
5 files changed, 58 insertions, 10 deletions
diff --git a/nixpkgs/pkgs/development/compilers/gcc/6/default.nix b/nixpkgs/pkgs/development/compilers/gcc/6/default.nix
index a817b083f281..a2f034a4827f 100644
--- a/nixpkgs/pkgs/development/compilers/gcc/6/default.nix
+++ b/nixpkgs/pkgs/development/compilers/gcc/6/default.nix
@@ -64,9 +64,9 @@ let majorVersion = "6";
 
     inherit (stdenv) buildPlatform hostPlatform targetPlatform;
 
-    patches =
-      [ ../use-source-date-epoch.patch ./0001-Fix-build-for-glibc-2.31.patch ]
-      ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
+    patches = optionals (!stdenv.targetPlatform.isRedox) [
+      ../use-source-date-epoch.patch ./0001-Fix-build-for-glibc-2.31.patch
+    ] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
       ++ optional noSysDirs ../no-sys-dirs.patch
       ++ optional langAda ../gnat-cflags.patch
       ++ optional langFortran ../gfortran-driving.patch
@@ -120,6 +120,11 @@ stdenv.mkDerivation ({
     repo = "gcc-vc4";
     rev = "e90ff43f9671c760cf0d1dd62f569a0fb9bf8918";
     sha256 = "0gxf66hwqk26h8f853sybphqa5ca0cva2kmrw5jsiv6139g0qnp8";
+  } else if stdenv.targetPlatform.isRedox then fetchFromGitHub {
+    owner = "redox-os";
+    repo = "gcc";
+    rev = "f360ac095028d286fc6dde4d02daed48f59813fa"; # `redox` branch
+    sha256 = "1an96h8l58pppyh3qqv90g8hgcfd9hj7igvh2gigmkxbrx94khfl";
   } else fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
     sha256 = "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby";
@@ -182,7 +187,7 @@ stdenv.mkDerivation ({
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig)
-    ++ (optional (stdenv.targetPlatform.isVc4) flex);
+    ++ (optional (with stdenv.targetPlatform; isVc4 || isRedox) flex);
 
   # For building runtime libs
   depsBuildTarget =
diff --git a/nixpkgs/pkgs/development/compilers/rust/rustc.nix b/nixpkgs/pkgs/development/compilers/rust/rustc.nix
index 6b3d973f6dce..65d8920c4a4c 100644
--- a/nixpkgs/pkgs/development/compilers/rust/rustc.nix
+++ b/nixpkgs/pkgs/development/compilers/rust/rustc.nix
@@ -90,7 +90,7 @@ in stdenv.mkDerivation rec {
     "${setBuild}.llvm-config=${llvmSharedForBuild}/bin/llvm-config"
     "${setHost}.llvm-config=${llvmSharedForHost}/bin/llvm-config"
     "${setTarget}.llvm-config=${llvmSharedForTarget}/bin/llvm-config"
-  ] ++ optionals stdenv.isLinux [
+  ] ++ optionals (stdenv.isLinux && !stdenv.targetPlatform.isRedox) [
     "--enable-profiler" # build libprofiler_builtins
   ];
 
diff --git a/nixpkgs/pkgs/development/libraries/relibc/default.nix b/nixpkgs/pkgs/development/libraries/relibc/default.nix
new file mode 100644
index 000000000000..a1787ce24bb5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/relibc/default.nix
@@ -0,0 +1,32 @@
+{ stdenvNoCC, buildPackages, fetchurl }:
+
+stdenvNoCC.mkDerivation {
+  name = "binary-relibc-latest";
+
+  # snapshot of https://static.redox-os.org/toolchain/x86_64-unknown-redox/relibc-install.tar.gz
+  src = fetchurl {
+    name = "relibc-install.tar.gz";
+    url = "https://gateway.pinata.cloud/ipfs/QmNp6fPTjPA6LnCYvW1UmbAHcPpU7tqZhstfSpSXMJCRwp";
+    sha256 = "1hjdzrj67jdag3pm8h2dqh6xipbfxr6f4navdra6q1h83gl7jkd9";
+  };
+
+  # to avoid "unpacker produced multiple directories"
+  unpackPhase = "unpackFile $src";
+
+  dontBuild = true;
+  dontPatchELF = true;
+  dontStrip = true;
+  installPhase = ''
+    mkdir $out/
+    cp -r x86_64-unknown-redox/* $out/
+    rm -rf $out/bin
+  '';
+
+  meta = with stdenvNoCC.lib; {
+    homepage = "https://gitlab.redox-os.org/redox-os/relibc";
+    description = "C Library in Rust for Redox and Linux";
+    license = licenses.mit;
+    maintainers = [ maintainers.aaronjanse ];
+    platforms = platforms.redox;
+  };
+}
diff --git a/nixpkgs/pkgs/stdenv/cross/default.nix b/nixpkgs/pkgs/stdenv/cross/default.nix
index cc49af7de3b5..0f575289889f 100644
--- a/nixpkgs/pkgs/stdenv/cross/default.nix
+++ b/nixpkgs/pkgs/stdenv/cross/default.nix
@@ -38,7 +38,7 @@ in lib.init bootStages ++ [
   (buildPackages: {
     inherit config;
     overlays = overlays ++ crossOverlays
-      ++ (if crossSystem.isWasm then [(import ../../top-level/static.nix)] else []);
+      ++ (if (with crossSystem; isWasm || isRedox) then [(import ../../top-level/static.nix)] else []);
     selfBuild = false;
     stdenv = buildPackages.stdenv.override (old: rec {
       buildPlatform = localSystem;
@@ -72,7 +72,7 @@ in lib.init bootStages ++ [
              (hostPlatform.isLinux && !buildPlatform.isLinux)
              [ buildPackages.patchelf ]
         ++ lib.optional
-             (let f = p: !p.isx86 || p.libc == "musl" || p.libc == "wasilibc" || p.isiOS; in f hostPlatform && !(f buildPlatform))
+             (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS; in f hostPlatform && !(f buildPlatform))
              buildPackages.updateAutotoolsGnuConfigScriptsHook
            # without proper `file` command, libtool sometimes fails
            # to recognize 64-bit DLLs
diff --git a/nixpkgs/pkgs/top-level/all-packages.nix b/nixpkgs/pkgs/top-level/all-packages.nix
index 1b6dec687506..5c1148e06287 100644
--- a/nixpkgs/pkgs/top-level/all-packages.nix
+++ b/nixpkgs/pkgs/top-level/all-packages.nix
@@ -8265,8 +8265,12 @@ in
   gerbil-support = callPackage ../development/compilers/gerbil/gerbil-support.nix { };
   gerbilPackages-unstable = gerbil-support.gerbilPackages-unstable; # NB: don't recurseIntoAttrs for (unstable!) libraries
 
-  gccFun = callPackage (if stdenv.targetPlatform.isVc4 then ../development/compilers/gcc/6 else ../development/compilers/gcc/9);
-  gcc = if stdenv.targetPlatform.isVc4 then gcc6 else gcc9;
+  gccFun = callPackage (if (with stdenv.targetPlatform; isVc4 || libc == "relibc")
+    then ../development/compilers/gcc/6
+    else ../development/compilers/gcc/9);
+  gcc = if (with stdenv.targetPlatform; isVc4 || libc == "relibc")
+    then gcc6 else gcc9;
+  
   gcc-unwrapped = gcc.cc;
 
   gccStdenv = if stdenv.cc.isGNU then stdenv else stdenv.override {
@@ -8401,7 +8405,11 @@ in
     libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
     threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
 
-    isl = if !stdenv.isDarwin then isl_0_14 else null;
+    isl = if stdenv.isDarwin
+            then null
+          else if stdenv.targetPlatform.isRedox
+            then isl_0_17
+          else isl_0_14;
   }));
 
   gcc7 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/7 {
@@ -12015,6 +12023,7 @@ in
     else if name == "libSystem" then targetPackages.darwin.xcode
     else if name == "nblibc" then targetPackages.netbsdCross.libc
     else if name == "wasilibc" then targetPackages.wasilibc or wasilibc
+    else if name == "relibc" then targetPackages.relibc or relibc
     else if stdenv.targetPlatform.isGhcjs then null
     else throw "Unknown libc ${name}";
 
@@ -12029,6 +12038,8 @@ in
     stdenv = crossLibcStdenv;
   };
 
+  relibc = callPackage ../development/libraries/relibc { };
+
   # Only supported on Linux, using glibc
   glibcLocales = if stdenv.hostPlatform.libc == "glibc" then callPackage ../development/libraries/glibc/locales.nix { } else null;