From a92266b0fe2de4781b327b9ea85fdcfb357b2aca Mon Sep 17 00:00:00 2001
From: leo60228 <iakornfeld@gmail.com>
Date: Fri, 10 May 2019 09:40:45 -0400
Subject: [PATCH] Build Switch on CI

---
 .travis.yml    | 21 +++++++++++++++++++++
 ci/switch.json | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644 ci/switch.json

diff --git a/.travis.yml b/.travis.yml
index 7175ae4a..c02be13b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -207,6 +207,27 @@ matrix:
     - env: TARGET=wasm32-unknown-wasi
       rust: nightly
       stage: tier2
+    - name: "Nintendo Switch - build libcore only"
+      rust: nightly
+      stage: tier2
+      install:
+        - rustup component add rust-src
+        - (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild)
+      script:
+        - mkdir -p target
+        - cd target
+        - wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
+        - sudo dpkg -i devkitpro-pacman.deb
+        - sudo dkp-pacman -Sy
+        - sudo dkp-pacman -Syu
+        - sudo dkp-pacman -S -v --noconfirm switch-dev devkitA64
+        - export PATH="$PATH:/opt/devkitpro/devkitA64/bin"
+        - export PATH="$PATH:/opt/devkitpro/tools/bin"
+        - cd ..
+        # Pull the target spec up into the current directory and then build
+        - mv ci/switch.json switch.json
+        - cargo xbuild --target switch.json
+
 
   allow_failures:
       # FIXME: android build bots time out irregularly
diff --git a/ci/switch.json b/ci/switch.json
new file mode 100644
index 00000000..bc189487
--- /dev/null
+++ b/ci/switch.json
@@ -0,0 +1,37 @@
+{
+  "family": "unix",
+  "env": "newlib",
+  "target-env": "newlib",
+  "target-family": "unix",
+  "target-c-int-width": "32",
+  "target-endian": "little",
+  "target-pointer-width": "64",
+  "os": "horizon",
+  "arch": "aarch64",
+  "panic-strategy": "unwind",
+  "abi-blacklist": [
+      "stdcall",
+      "fastcall",
+      "vectorcall",
+      "thiscall",
+      "win64",
+      "sysv64"
+  ],
+  "dynamic-linking" : false,
+  "features": "+a53,+strict-align",
+  "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128",
+  "executables": true,
+  "position-independent-executables" : true,
+  "linker-flavor": "gcc",
+  "llvm-target": "aarch64-unknown-none",
+  "has-elf-tls" : false,
+  "linker-is-gnu" : true,
+  "disable-redzone" : true,
+  "relocation-model" : "pic",
+  "max-atomic-width": 128,
+  "exe-suffix": ".elf",
+  "staticlib-suffix" : ".a",
+  "trap-unreachable" : true,
+  "emit-debug-gdb-scripts" : true,
+  "requires-uwtable" : true
+}
\ No newline at end of file
-- 
GitLab