From 730a17fd1c7a96cf14452fc56a4a5b886d1a1933 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 17 Sep 2015 10:05:36 -0700
Subject: [PATCH] Root urls for everyone!

Also refator to only list all the triples once
---
 ci/dox.sh  | 28 ++++++++--------------------
 src/lib.rs | 38 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/ci/dox.sh b/ci/dox.sh
index 5450088c..a003dc38 100644
--- a/ci/dox.sh
+++ b/ci/dox.sh
@@ -7,29 +7,17 @@ mkdir -p target/doc
 
 cp ci/landing-page-head.html target/doc/index.html
 
-doc() {
-  local _target=$1
-  echo documenting $_target
-  rustdoc -o target/doc/$_target --target $_target src/lib.rs --cfg dox \
+TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`
+
+for target in $TARGETS; do
+  echo documenting $target
+
+  rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \
     --crate-name libc
 
-  echo "<li><a href="$_target/libc/index.html">$_target</a></li>" \
+  echo "<li><a href="$target/libc/index.html">$target</a></li>" \
     >> target/doc/index.html
-}
-
-doc x86_64-unknown-linux-gnu
-doc i686-unknown-linux-gnu
-doc x86_64-apple-darwin
-doc i686-apple-darwin
-doc x86_64-pc-windows-gnu
-doc x86_64-pc-windows-msvc
-doc i686-pc-windows-gnu
-doc i686-pc-windows-msvc
-
-doc arm-unknown-linux-gnueabihf
-doc mips-unknown-linux-gnu
-doc arm-linux-androideabi
-doc x86_64-unknown-linux-musl
+done
 
 cat ci/landing-page-footer.html >> target/doc/index.html
 
diff --git a/src/lib.rs b/src/lib.rs
index cf2ba526..4ae6ac5a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,8 +14,42 @@
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "https://doc.rust-lang.org/favicon.ico")]
 
-#![cfg_attr(all(target_os = "linux", target_arch = "x86_64"),
-            doc(html_root_url = "http://alexcrichton.com/libc/x86_64-unknown-linux-gnu"))]
+#![cfg_attr(all(target_os = "linux", target_arch = "x86_64"), doc(
+    html_root_url = "http://alexcrichton.com/libc/x86_64-unknown-linux-gnu"
+))]
+#![cfg_attr(all(target_os = "linux", target_arch = "x86"), doc(
+    html_root_url = "http://alexcrichton.com/libc/i686-unknown-linux-gnu"
+))]
+#![cfg_attr(all(target_os = "linux", target_arch = "arm"), doc(
+    html_root_url = "http://alexcrichton.com/libc/arm-unknown-linux-gnueabihf"
+))]
+#![cfg_attr(all(target_os = "linux", target_arch = "mips"), doc(
+    html_root_url = "http://alexcrichton.com/libc/mips-unknown-linux-gnu"
+))]
+#![cfg_attr(all(target_os = "linux", target_env = "musl"), doc(
+    html_root_url = "http://alexcrichton.com/libc/x86_64-unknown-linux-musl"
+))]
+#![cfg_attr(all(target_os = "macos", target_arch = "x86_64"), doc(
+    html_root_url = "http://alexcrichton.com/libc/x86_64-apple-darwin"
+))]
+#![cfg_attr(all(target_os = "macos", target_arch = "x86"), doc(
+    html_root_url = "http://alexcrichton.com/libc/i686-apple-darwin"
+))]
+#![cfg_attr(all(windows, target_arch = "x86_64", target_env = "gnu"), doc(
+    html_root_url = "http://alexcrichton.com/libc/x86_64-pc-windows-gnu"
+))]
+#![cfg_attr(all(windows, target_arch = "i686", target_env = "gnu"), doc(
+    html_root_url = "http://alexcrichton.com/libc/i686-pc-windows-gnu"
+))]
+#![cfg_attr(all(windows, target_arch = "x86_64", target_env = "msvc"), doc(
+    html_root_url = "http://alexcrichton.com/libc/x86_64-pc-windows-msvc"
+))]
+#![cfg_attr(all(windows, target_arch = "i686", target_env = "msvc"), doc(
+    html_root_url = "http://alexcrichton.com/libc/i686-pc-windows-msvc"
+))]
+#![cfg_attr(all(target_os = "android"), doc(
+    html_root_url = "http://alexcrichton.com/libc/arm-linux-androideabi"
+))]
 
 #[macro_use] mod macros;
 mod dox;
-- 
GitLab