diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2018-05-10 18:13:00 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2018-05-10 18:13:00 -0400 |
commit | f18ddabee7812fbf409759280e1e95df2019d2d2 (patch) | |
tree | 766cd52b598ae9eb0f30a2571032b000193a19a8 /lib/systems | |
parent | e98814461d40c2907a46bbd7a81f8e0b7053019e (diff) | |
parent | 938ff5401adc7ae43bd185d8fa610f1fd4f6ead1 (diff) | |
download | nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.tar nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.tar.gz nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.tar.bz2 nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.tar.lz nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.tar.xz nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.tar.zst nixlib-f18ddabee7812fbf409759280e1e95df2019d2d2.zip |
Merge remote-tracking branch 'upstream/master' into lib-float
Diffstat (limited to 'lib/systems')
-rw-r--r-- | lib/systems/default.nix | 9 | ||||
-rw-r--r-- | lib/systems/examples.nix | 32 | ||||
-rw-r--r-- | lib/systems/for-meta.nix | 8 | ||||
-rw-r--r-- | lib/systems/inspect.nix | 8 | ||||
-rw-r--r-- | lib/systems/parse.nix | 38 |
5 files changed, 71 insertions, 24 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 9b9308246098..ee4c29660a55 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -45,8 +45,17 @@ rec { }; # Misc boolean options useAndroidPrebuilt = false; + useiOSPrebuilt = false; + isiPhoneSimulator = false; } // mapAttrs (n: v: v final.parsed) inspect.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; + assert lib.foldl + (pass: { assertion, message }: + if assertion final + then pass + else throw message) + true + (final.parsed.abi.assertions or []); final; } diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 32c24bab7c98..07728c19fc9e 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -87,16 +87,36 @@ rec { # iphone64 = { - config = "aarch64-apple-darwin14"; - arch = "arm64"; - libc = "libSystem"; + config = "aarch64-apple-ios"; + # config = "aarch64-apple-darwin14"; + sdkVer = "10.2"; + useiOSPrebuilt = true; platform = {}; }; iphone32 = { - config = "arm-apple-darwin10"; - arch = "armv7-a"; - libc = "libSystem"; + config = "armv7a-apple-ios"; + # config = "arm-apple-darwin10"; + sdkVer = "10.2"; + useiOSPrebuilt = true; + platform = {}; + }; + + iphone64-simulator = { + config = "x86_64-apple-ios"; + # config = "x86_64-apple-darwin14"; + sdkVer = "10.2"; + useiOSPrebuilt = true; + isiPhoneSimulator = true; + platform = {}; + }; + + iphone32-simulator = { + config = "i686-apple-ios"; + # config = "i386-apple-darwin11"; + sdkVer = "10.2"; + useiOSPrebuilt = true; + isiPhoneSimulator = true; platform = {}; }; diff --git a/lib/systems/for-meta.nix b/lib/systems/for-meta.nix index 68c68c2cd369..9e85cea3ad11 100644 --- a/lib/systems/for-meta.nix +++ b/lib/systems/for-meta.nix @@ -4,8 +4,8 @@ let inherit (lib.systems.inspect) patterns; in rec { - inherit (lib.systems.doubles) all mesaPlatforms; - none = []; + all = [ {} ]; # `{}` matches anything + none = []; arm = [ patterns.isAarch32 ]; aarch64 = [ patterns.isAarch64 ]; @@ -13,6 +13,7 @@ in rec { i686 = [ patterns.isi686 ]; x86_64 = [ patterns.isx86_64 ]; mips = [ patterns.isMips ]; + riscv = [ patterns.isRiscV ]; cygwin = [ patterns.isCygwin ]; darwin = [ patterns.isDarwin ]; @@ -24,4 +25,7 @@ in rec { netbsd = [ patterns.isNetBSD ]; openbsd = [ patterns.isOpenBSD ]; unix = patterns.isUnix; # Actually a list + windows = [ patterns.isWindows ]; + + inherit (lib.systems.doubles) mesaPlatforms; } diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 6738ae3d441e..9960954e4649 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -21,9 +21,11 @@ rec { isLittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; }; isBSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; }; + isDarwin = { kernel = { families = { inherit (kernelFamilies) darwin; }; }; }; isUnix = [ isBSD isDarwin isLinux isSunOS isHurd isCygwin ]; - isDarwin = { kernel = kernels.darwin; }; + isMacOS = { kernel = kernels.macos; }; + isiOS = { kernel = kernels.ios; }; isLinux = { kernel = kernels.linux; }; isSunOS = { kernel = kernels.solaris; }; isFreeBSD = { kernel = kernels.freebsd; }; @@ -38,12 +40,8 @@ rec { isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ]; isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ]; - isKexecable = map (family: { kernel = kernels.linux; cpu.family = family; }) - [ "x86" "arm" "aarch64" "mips" ]; isEfi = map (family: { cpu.family = family; }) [ "x86" "arm" "aarch64" ]; - isSeccomputable = map (family: { kernel = kernels.linux; cpu.family = family; }) - [ "x86" "arm" "aarch64" "mips" ]; # Deprecated after 18.03 isArm = isAarch32; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 3667766aa9f7..1315f290cefa 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -34,7 +34,7 @@ rec { ################################################################################ - types.openSignifiantByte = mkOptionType { + types.openSignificantByte = mkOptionType { name = "significant-byte"; description = "Endianness"; merge = mergeOneOption; @@ -42,7 +42,7 @@ rec { types.significantByte = enum (attrValues significantBytes); - significantBytes = setTypes types.openSignifiantByte { + significantBytes = setTypes types.openSignificantByte { bigEndian = {}; littleEndian = {}; }; @@ -140,6 +140,7 @@ rec { kernelFamilies = setTypes types.openKernelFamily { bsd = {}; + darwin = {}; }; ################################################################################ @@ -155,7 +156,10 @@ rec { types.kernel = enum (attrValues kernels); kernels = with execFormats; with kernelFamilies; setTypes types.openKernel { - darwin = { execFormat = macho; families = { }; }; + # TODO(@Ericson2314): Don't want to mass-rebuild yet to keeping 'darwin' as + # the nnormalized name for macOS. + macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; + ios = { execFormat = macho; families = { inherit darwin; }; }; freebsd = { execFormat = elf; families = { inherit bsd; }; }; hurd = { execFormat = elf; families = { }; }; linux = { execFormat = elf; families = { }; }; @@ -165,9 +169,13 @@ rec { solaris = { execFormat = elf; families = { }; }; windows = { execFormat = pe; families = { }; }; } // { # aliases + # 'darwin' is the kernel for all of them. We choose macOS by default. + darwin = kernels.macos; # TODO(@Ericson2314): Handle these Darwin version suffixes more generally. - darwin10 = kernels.darwin; - darwin14 = kernels.darwin; + darwin10 = kernels.macos; + darwin14 = kernels.macos; + watchos = kernels.ios; + tvos = kernels.ios; win32 = kernels.windows; }; @@ -191,7 +199,15 @@ rec { gnueabi = { float = "soft"; }; gnueabihf = { float = "hard"; }; - gnu = {}; + gnu = { + assertions = [ + { assertion = platform: !platform.isAarch32; + message = '' + The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead. + ''; + } + ]; + }; musleabi = { float = "soft"; }; musleabihf = { float = "hard"; }; @@ -206,7 +222,7 @@ rec { ################################################################################ - types.system = mkOptionType { + types.parsedPlatform = mkOptionType { name = "system"; description = "fully parsed representation of llvm- or nix-style platform tuple"; merge = mergeOneOption; @@ -220,7 +236,7 @@ rec { isSystem = isType "system"; mkSystem = components: - assert types.system.check components; + assert types.parsedPlatform.check components; setType "system" components; mkSkeletonFromList = l: { @@ -266,7 +282,7 @@ rec { kernel = getKernel args.kernel; abi = /**/ if args ? abi then getAbi args.abi - else if isLinux parsed then abis.gnu + else if isLinux parsed then (if isAarch32 parsed then abis.gnueabi else abis.gnu) else if isWindows parsed then abis.gnu else abis.unknown; }; @@ -276,8 +292,8 @@ rec { mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s)); doubleFromSystem = { cpu, vendor, kernel, abi, ... }: - if abi == abis.cygnus - then "${cpu.name}-cygwin" + /**/ if abi == abis.cygnus then "${cpu.name}-cygwin" + else if kernel.families ? darwin then "${cpu.name}-darwin" else "${cpu.name}-${kernel.name}"; tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let |