Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: Clean up how linux and gcc config is specified #107214

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/systems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ rec {
# Either of these can be losslessly-extracted from `parsed` iff parsing succeeds.
system = parse.doubleFromSystem final.parsed;
config = parse.tripleFromSystem final.parsed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
config = parse.tripleFromSystem final.parsed;
config = parse.tripleFromSystem final.parsed;
platform = final.linux-kernel // { inherit (final) gcc rustc; };

# Just a guess, based on `system`
platform = platforms.select final;
Copy link
Member

@matthewbauer matthewbauer Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we continue to export platform for external usage?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this wouldn't work with the renames though... Maybe it's not worth it.

Copy link
Member Author

@Ericson2314 Ericson2314 Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, true. I was about to do your change below but I didn't think of that.

Copy link
Member Author

@Ericson2314 Ericson2314 Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh post merge I realize the back-compat was already not attempting the linux stuff, oops.

# Determine whether we are compatible with the provided CPU
isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
# Derived meta-data
Expand Down Expand Up @@ -79,7 +77,16 @@ rec {
};
isStatic = final.isWasm || final.isRedox;

kernelArch =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be separate from platform / linux-kernel. This should be a direct mapping from cpu name to linux kernel name. We already have qemuArch and will soon have a "darwinArch" in #105026. This shouldn't be configurable like platform / kernel-arch is.

# Just a guess, based on `system`
inherit
({
linux-kernel = args.linux-kernel or {};
gcc = args.gcc or {};
rustc = args.rust or {};
} // platforms.select final)
linux-kernel gcc rustc;

linuxArch =
if final.isAarch32 then "arm"
else if final.isAarch64 then "arm64"
else if final.isx86_32 then "x86"
Expand Down
48 changes: 10 additions & 38 deletions lib/systems/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ let

riscv = bits: {
config = "riscv${bits}-unknown-linux-gnu";
platform = platforms.riscv-multiplatform;
};
in

Expand All @@ -17,84 +16,68 @@ rec {
#
powernv = {
config = "powerpc64le-unknown-linux-gnu";
platform = platforms.powernv;
};
musl-power = {
config = "powerpc64le-unknown-linux-musl";
platform = platforms.powernv;
};

sheevaplug = {
config = "armv5tel-unknown-linux-gnueabi";
platform = platforms.sheevaplug;
};
} // platforms.sheevaplug;

raspberryPi = {
config = "armv6l-unknown-linux-gnueabihf";
platform = platforms.raspberrypi;
};
} // platforms.raspberrypi;

remarkable1 = {
config = "armv7l-unknown-linux-gnueabihf";
platform = platforms.zero-gravitas;
};
} // platforms.zero-gravitas;

remarkable2 = {
config = "armv7l-unknown-linux-gnueabihf";
platform = platforms.zero-sugar;
};
} // platforms.zero-sugar;

armv7l-hf-multiplatform = {
config = "armv7l-unknown-linux-gnueabihf";
platform = platforms.armv7l-hf-multiplatform;
};

aarch64-multiplatform = {
config = "aarch64-unknown-linux-gnu";
platform = platforms.aarch64-multiplatform;
};

armv7a-android-prebuilt = {
config = "armv7a-unknown-linux-androideabi";
sdkVer = "29";
ndkVer = "21";
platform = platforms.armv7a-android;
useAndroidPrebuilt = true;
};
} // platforms.armv7a-android;

aarch64-android-prebuilt = {
config = "aarch64-unknown-linux-android";
sdkVer = "29";
ndkVer = "21";
platform = platforms.aarch64-multiplatform;
useAndroidPrebuilt = true;
};

scaleway-c1 = armv7l-hf-multiplatform // rec {
platform = platforms.scaleway-c1;
inherit (platform.gcc) fpu;
};
scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1;

pogoplug4 = {
config = "armv5tel-unknown-linux-gnueabi";
platform = platforms.pogoplug4;
};
} // platforms.pogoplug4;

ben-nanonote = {
config = "mipsel-unknown-linux-uclibc";
platform = platforms.ben_nanonote;
};
} // platforms.ben_nanonote;

fuloongminipc = {
config = "mipsel-unknown-linux-gnu";
platform = platforms.fuloong2f_n32;
};
} // platforms.fuloong2f_n32;

muslpi = raspberryPi // {
config = "armv6l-unknown-linux-musleabihf";
};

aarch64-multiplatform-musl = aarch64-multiplatform // {
aarch64-multiplatform-musl = {
config = "aarch64-unknown-linux-musl";
};

Expand All @@ -110,13 +93,11 @@ rec {
riscv64-embedded = {
config = "riscv64-none-elf";
libc = "newlib";
platform = platforms.riscv-multiplatform;
};

riscv32-embedded = {
config = "riscv32-none-elf";
libc = "newlib";
platform = platforms.riscv-multiplatform;
};

mmix = {
Expand All @@ -136,13 +117,11 @@ rec {
vc4 = {
config = "vc4-elf";
libc = "newlib";
platform = {};
};

or1k = {
config = "or1k-elf";
libc = "newlib";
platform = {};
};

arm-embedded = {
Expand Down Expand Up @@ -204,7 +183,6 @@ rec {
xcodeVer = "11.3.1";
xcodePlatform = "iPhoneOS";
useiOSPrebuilt = true;
platform = {};
};

iphone32 = {
Expand All @@ -214,7 +192,6 @@ rec {
xcodeVer = "11.3.1";
xcodePlatform = "iPhoneOS";
useiOSPrebuilt = true;
platform = {};
};

iphone64-simulator = {
Expand All @@ -224,7 +201,6 @@ rec {
xcodeVer = "11.3.1";
xcodePlatform = "iPhoneSimulator";
useiOSPrebuilt = true;
platform = {};
};

iphone32-simulator = {
Expand All @@ -234,7 +210,6 @@ rec {
xcodeVer = "11.3.1";
xcodePlatform = "iPhoneSimulator";
useiOSPrebuilt = true;
platform = {};
};

#
Expand All @@ -245,15 +220,13 @@ rec {
mingw32 = {
config = "i686-w64-mingw32";
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
};

# 64 bit mingw-w64
mingwW64 = {
# That's the triplet they use in the mingw-w64 docs.
config = "x86_64-w64-mingw32";
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
};

# BSDs
Expand All @@ -275,6 +248,5 @@ rec {
# Ghcjs
ghcjs = {
config = "js-unknown-ghcjs";
platform = {};
};
}
Loading