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

Implement RFC 1291 changes #21

Merged
merged 200 commits into from
Oct 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
dafaca9
Initial import of liblibc
alexcrichton Sep 10, 2015
8e5f0cd
Add skeleton testing framework
alexcrichton Sep 10, 2015
1608306
Get size/align tests working for typedefs
alexcrichton Sep 10, 2015
a9adfbf
Test size/align of structs
alexcrichton Sep 10, 2015
3e5155b
Test struct field offsets/sizes
alexcrichton Sep 10, 2015
6036c18
Run travis everywhere!
alexcrichton Sep 10, 2015
984477b
Add back in env for travis
alexcrichton Sep 10, 2015
f522b13
Make all padding and such private
alexcrichton Sep 10, 2015
310d623
Tweak script, fix on linux
alexcrichton Sep 10, 2015
b2a9107
Fix glob_t definition on linux
alexcrichton Sep 10, 2015
429c2de
Build on stable Rust
alexcrichton Sep 10, 2015
f012990
Nope, let's try 1.2.0
alexcrichton Sep 10, 2015
f8b1b3d
Try using a newer gcc on travis
alexcrichton Sep 10, 2015
7ff62a4
Fix rlim_t for 32-bit linux
alexcrichton Sep 10, 2015
ec5538c
OK, just use clang
alexcrichton Sep 10, 2015
c8b895c
Attempt to fix 32-bit
alexcrichton Sep 10, 2015
fc32c6d
Keep installing gcc-multilib
alexcrichton Sep 10, 2015
0df7c10
Test constant values
alexcrichton Sep 10, 2015
148033a
Fix wrong constants on linux
alexcrichton Sep 10, 2015
e1272fa
Fix defines on x86_64 OSX
alexcrichton Sep 10, 2015
126e506
Attempt to find header files
alexcrichton Sep 11, 2015
e7afdd8
Handle when constants aren't defined
alexcrichton Sep 11, 2015
c37f22c
Re-fix _PC_NAME_MAX
alexcrichton Sep 11, 2015
a5086b1
Done probing
alexcrichton Sep 11, 2015
6b853c7
What is wrong with _PC_NAME_MAX
alexcrichton Sep 11, 2015
ac2bd85
Windows MSVC support
alexcrichton Sep 11, 2015
b01a8cc
Don't worry about unused parameters
alexcrichton Sep 11, 2015
671376b
No parameters in C
alexcrichton Sep 11, 2015
5f624a5
arg => flag
alexcrichton Sep 11, 2015
d7a1547
Try to fix _PC_NAME_MAX again
alexcrichton Sep 11, 2015
13a6f2d
More windows fixes
alexcrichton Sep 11, 2015
26333d3
Semi-pin to a version of syntex_syntax
alexcrichton Sep 11, 2015
2237882
Test some functions!
alexcrichton Sep 11, 2015
e860619
Get OSX tests compiling
alexcrichton Sep 11, 2015
45ae2f4
Fix linkage on OSX
alexcrichton Sep 11, 2015
7da9b10
More windows compat
alexcrichton Sep 11, 2015
3bf33a4
Add appveyor config
alexcrichton Sep 11, 2015
4d0eb6d
Fix OSX
alexcrichton Sep 11, 2015
dc37640
Can we masquerade to get trusty tahr?
alexcrichton Sep 11, 2015
3150484
Windows 32-bit fixes
alexcrichton Sep 11, 2015
7ff0fdb
Tweak macros module
alexcrichton Sep 11, 2015
2d3608e
Correct ip6_mreq => ipv6_mreq
alexcrichton Sep 11, 2015
5d6cf05
Let's just juggle everything around!
alexcrichton Sep 11, 2015
084f9ea
Get OSX working
alexcrichton Sep 11, 2015
f81e3d3
Compat back to 1.0.0
alexcrichton Sep 11, 2015
6b8bdca
Remove stray file
alexcrichton Sep 11, 2015
e001d8c
Remove now stray comment
alexcrichton Sep 11, 2015
bfc6ebc
Windows working again
alexcrichton Sep 11, 2015
4185dde
Get android compiling
alexcrichton Sep 11, 2015
d3d7792
Get android tests working
alexcrichton Sep 12, 2015
c89d56b
Fix style for linux
alexcrichton Sep 12, 2015
3dc9916
Fix compile on linux
alexcrichton Sep 12, 2015
95c90fa
Let's try running android
alexcrichton Sep 12, 2015
d2e41c1
Fix compile on linux-32
alexcrichton Sep 12, 2015
79199af
Add docker file to build android image
alexcrichton Sep 12, 2015
83a3049
Aight, let's try running everything on travis
alexcrichton Sep 12, 2015
3f07aeb
Use clang instead of cc
alexcrichton Sep 12, 2015
b7de09c
Temporarily only test docker
alexcrichton Sep 12, 2015
ea4db3c
Get android rust download working
alexcrichton Sep 12, 2015
6ce2bae
Fix TARGET spec on android
alexcrichton Sep 12, 2015
e47a450
Fix shell syntax
alexcrichton Sep 12, 2015
985744f
Run everything!
alexcrichton Sep 13, 2015
16ceef2
Use nightly, not stable
alexcrichton Sep 13, 2015
cf3b010
Install gcc-multilib on linux
alexcrichton Sep 13, 2015
a3c854d
Never notify on success for travis
alexcrichton Sep 13, 2015
87fdebd
Use MSYS2 on appveyor
alexcrichton Sep 13, 2015
9e97afd
Break apart src/unix/other.rs a bit
alexcrichton Sep 13, 2015
1cf98ae
Get MUSL working
alexcrichton Sep 13, 2015
acda013
Add MUSL to CI
alexcrichton Sep 13, 2015
4071037
Correct android rust nightly version
alexcrichton Sep 13, 2015
2f846f3
Fix test script
alexcrichton Sep 14, 2015
1398566
Revert alloc_system change
alexcrichton Sep 14, 2015
11b5ca4
Fix MUSL script
alexcrichton Sep 14, 2015
1e6056e
Try to fix musl CI again
alexcrichton Sep 14, 2015
5a28433
Run all tests manually
alexcrichton Sep 14, 2015
b9ca232
Fix arm-linux compile
alexcrichton Sep 14, 2015
23ab70b
Add CI for ARM linux
alexcrichton Sep 14, 2015
517b76a
Install qemu-user as well
alexcrichton Sep 14, 2015
89bfb30
Tweak ordering
alexcrichton Sep 14, 2015
8419621
Revert "Tweak ordering"
alexcrichton Sep 14, 2015
0c78471
Try to fix arm linux again
alexcrichton Sep 14, 2015
e6280d8
Let's try again!
alexcrichton Sep 14, 2015
2333a52
Fix arm... yet again...
alexcrichton Sep 14, 2015
4aecc61
Fix all defn's/compiling for mips linux
alexcrichton Sep 14, 2015
8fc95d2
Get tests for mips passing
alexcrichton Sep 14, 2015
944a733
Run MIPS on CI
alexcrichton Sep 14, 2015
947d675
Fix cargo config
alexcrichton Sep 14, 2015
ac5ba00
Attempt another package on mips
alexcrichton Sep 14, 2015
86c7c43
Really install mips gcc
alexcrichton Sep 14, 2015
4a62f61
I can spell MIPS
alexcrichton Sep 14, 2015
a4d78c4
Refactor with fewer intermediate artifacts
alexcrichton Sep 14, 2015
2fe6de4
Remove trailing slash
alexcrichton Sep 14, 2015
213c629
Move Dockerfile to ci folder
alexcrichton Sep 14, 2015
412d4f9
OK, don't actually run mips for now...
alexcrichton Sep 15, 2015
17da63d
I hate shell
alexcrichton Sep 15, 2015
e04155f
Get FreeBSD compiling
alexcrichton Sep 15, 2015
50a42e2
Major organization revamp
alexcrichton Sep 15, 2015
27f7a6c
Consolidate common linux defn's upwards
alexcrichton Sep 15, 2015
6d3cfdb
Test signedness of integer types
alexcrichton Sep 15, 2015
918f8e1
Move common linux defn's up
alexcrichton Sep 15, 2015
9c99c16
Fix signedness of c_char/c_wchar on ARM linux
alexcrichton Sep 15, 2015
5260587
More consolidation and fix all android types
alexcrichton Sep 15, 2015
64768f5
Fix compile on OSX
alexcrichton Sep 15, 2015
eef03da
Don't test mach_timebase_info_t signedness
alexcrichton Sep 15, 2015
8293ced
Get FreeBSD compiling
alexcrichton Sep 16, 2015
9d5b8b2
Fix android build
alexcrichton Sep 16, 2015
2c57e36
Move linkage to specific modules
alexcrichton Sep 16, 2015
7b28c27
Fix build on MSVC
alexcrichton Sep 16, 2015
1846918
Fix windows build
alexcrichton Sep 16, 2015
d11e914
Switch to ctest crate
alexcrichton Sep 16, 2015
e0f4d10
Skip the pointer check for functions on windows
alexcrichton Sep 16, 2015
f3b9748
Start testing types of struct fields
alexcrichton Sep 16, 2015
316c367
Fix tests on OSX
alexcrichton Sep 16, 2015
094f44d
Fix android
alexcrichton Sep 16, 2015
848faed
Now fix other platforms!
alexcrichton Sep 16, 2015
d809601
OK, different strategy for fixing
alexcrichton Sep 16, 2015
2482400
Oops, backwards
alexcrichton Sep 17, 2015
b5da7c0
Fix unused variable warning
alexcrichton Sep 17, 2015
2de0b8b
Fix windows
alexcrichton Sep 17, 2015
4f04e23
Fix align of in6_addr on Windows
alexcrichton Sep 17, 2015
3abaff1
Another attempt to fix windows
alexcrichton Sep 17, 2015
e3b6f83
Attempt to fix windows
alexcrichton Sep 17, 2015
9f2b101
Hide variants of c_void from docs
alexcrichton Sep 17, 2015
24abc4f
Attempt to build docs on Travis
alexcrichton Sep 17, 2015
41afa80
Add upload tokens
alexcrichton Sep 17, 2015
d82bc6b
Add a landing page
alexcrichton Sep 17, 2015
356d1f3
Temp disable travis
alexcrichton Sep 17, 2015
3fffd10
Try another config
alexcrichton Sep 17, 2015
9eca468
Another?
alexcrichton Sep 17, 2015
12240ad
Go back to a real travis yml
alexcrichton Sep 17, 2015
0de482c
Ok... another key?
alexcrichton Sep 17, 2015
dab1ead
Auto-generate an index
alexcrichton Sep 17, 2015
730a17f
Root urls for everyone!
alexcrichton Sep 17, 2015
611e9a3
i686 => x86
alexcrichton Sep 17, 2015
95b18b7
Show some crate docs
alexcrichton Sep 17, 2015
e00e24a
Add more badges
alexcrichton Sep 17, 2015
d5c493e
Remove .gitmodules
alexcrichton Sep 17, 2015
242d3d3
Only test autotest for now
alexcrichton Sep 17, 2015
cd9b33e
Import lots of the stdlib
alexcrichton Sep 17, 2015
1ff9610
Fix android
alexcrichton Sep 17, 2015
684cfa4
Add aarch64 support/CI
alexcrichton Sep 17, 2015
de9736d
Fix all tests on OSX
alexcrichton Sep 17, 2015
b347b44
Fix x86_64 linux
alexcrichton Sep 17, 2015
6de3816
Fix references to Option through dox
alexcrichton Sep 17, 2015
15b83c2
Use musl-gcc, fix musl headers
alexcrichton Sep 18, 2015
97a2c17
Impl Copy/Clone for dummy Option
alexcrichton Sep 18, 2015
d13e1e4
Add aarch64 url
alexcrichton Sep 18, 2015
d9962f4
CI dox
alexcrichton Sep 18, 2015
d86471c
Only install gcc-multilib when necessary
alexcrichton Sep 18, 2015
145ac09
Describe CI processes
alexcrichton Sep 18, 2015
0262b07
Fix impl syntax
alexcrichton Sep 18, 2015
b66b8a4
Run apt-get update before installing
alexcrichton Sep 18, 2015
038aedb
Fix android build
alexcrichton Sep 18, 2015
751b42e
Merge pull request #1 from alexcrichton/std-merge
alexcrichton Sep 18, 2015
a1b948e
Fix FreeBSD
alexcrichton Sep 18, 2015
1e1ff67
Fix backtrace for android
alexcrichton Sep 18, 2015
c4a8d60
Consolidate mode_t upwards on linux
alexcrichton Sep 18, 2015
83c8168
Consolidate freebsd arch's upwards
alexcrichton Sep 18, 2015
78f5aca
Note triples in README
alexcrichton Sep 18, 2015
2eb32ef
Format openbsd
alexcrichton Sep 18, 2015
a4e27ed
Upward movement for BSD
alexcrichton Sep 18, 2015
c674e37
Upward movement for Unix
alexcrichton Sep 18, 2015
6603ca0
AppVeyor only autotest branch
alexcrichton Sep 18, 2015
3715e83
Move ifaddrs up a level on BSD
alexcrichton Sep 18, 2015
239f9cd
Fix resolution in notbsd/mod.rs
alexcrichton Sep 18, 2015
70b1f23
Try running MIPS again
alexcrichton Sep 18, 2015
caeb3fa
Fix resolution on OSX
alexcrichton Sep 18, 2015
a760061
Add sample OpenBSD VM
alexcrichton Sep 19, 2015
babf390
Add some IPv6 options
alexcrichton Sep 19, 2015
2536b35
OK, apparently MIPS can run now?
alexcrichton Sep 19, 2015
22f3c5e
Use a switch instead of if/else
alexcrichton Sep 19, 2015
fa3f6e7
Merge pull request #2 from alexcrichton/freebsd
alexcrichton Sep 19, 2015
32dc227
add a script to run everything locally
alexcrichton Sep 19, 2015
d3bbec4
Ignore .cargo
alexcrichton Sep 19, 2015
9cb1634
Move to master branch
alexcrichton Sep 21, 2015
c4d4c70
Slim down Windows bindings
alexcrichton Sep 21, 2015
baef611
iOS support
alexcrichton Sep 20, 2015
a6b8521
Merge pull request #4 from alexcrichton/slim-windows
alexcrichton Sep 23, 2015
1791046
Use isize/usize
alexcrichton Sep 23, 2015
41e7a69
Fix OSX
alexcrichton Sep 23, 2015
6ca7818
Merge pull request #5 from alexcrichton/uisize
alexcrichton Sep 23, 2015
67e3388
Add FIONBIO
alexcrichton Sep 23, 2015
9b5447f
Merge pull request #6 from alexcrichton/FIONBIO
alexcrichton Sep 23, 2015
ab0442c
AppVeyor has MSYS2 installed by default now!
alexcrichton Oct 7, 2015
cc12d2b
Pass -y to apt-get
alexcrichton Oct 14, 2015
a1da67d
Try to fix nightly CI
alexcrichton Oct 21, 2015
573f2de
Another attempt at fixing nightly
alexcrichton Oct 21, 2015
354693d
Update CI
alexcrichton Oct 28, 2015
b017b5e
Really fix ci...
alexcrichton Oct 28, 2015
657eeec
Run more extra targets on nightly
alexcrichton Oct 29, 2015
13418a5
Improve the README and switch URLs
alexcrichton Oct 29, 2015
b1fbefa
Add some notes for common platforms
alexcrichton Oct 29, 2015
524e137
Add numbered steps to add an API
alexcrichton Oct 29, 2015
5289b31
Fix a link
alexcrichton Oct 29, 2015
1f7e2e8
Fix appveyor link
alexcrichton Oct 29, 2015
26942d5
Don't ignore .cargo
alexcrichton Oct 29, 2015
a9a9c70
Merge remote-tracking branch 'origin/master'
alexcrichton Oct 29, 2015
bbf73de
Add a link to the RFC from the README
alexcrichton Oct 29, 2015
d5c4e55
Explain weirdness of c_void and android missing fns
alexcrichton Oct 29, 2015
2995f55
Use the standard android slave docker image
alexcrichton Oct 29, 2015
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/Cargo.lock
target
Cargo.lock
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

55 changes: 41 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
language: rust
sudo: false
before_install:
- git submodule update --init --recursive
sudo: required
rust:
- 1.0.0
- beta
- nightly
services:
- docker
script:
- cargo build --verbose
- cargo doc --verbose
after_success: |
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] &&
echo '<meta http-equiv=refresh content=0;url=libc/index.html>' > target/doc/index.html &&
pip install ghp-import --user $USER &&
$HOME/.local/bin/ghp-import -n target/doc &&
git push -fq https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages

- sh ci/run-travis.sh
os:
- linux
- osx
env:
matrix:
- ARCH=x86_64
- ARCH=i686
global:
secure: MZGg+symX6/fcY7TsQ1LkJ28V/CUevNZgs3MiilgvnlgTjqn7BU7gbTvwhLdVZq04/EQ1hTeVzrFGpBfcCUVHYKmP2vooEFJJ+bDGEvyD8ChwCB4nV+NmxF5+NwCi3+Y+0pBgKbt2BasJ+MXkGJpRyFozis6loMWbXTzZzL9jjU=
secure: knGy4XLi5DVpZPcBaB8PiGA49NtZLcaWwLIPwSS68CwRJXOeeNPe/+xb7vWCWblJp3k7jK1HkJgHq+muWe1e+gUvXpmvASyuwpIBd4eQn55k4jfQlAVPCpxoIYANnv7bjfDMhuTEUDmvt9vI7BXDlLfi2VRrSrUd9obSwd3QU+ie5V88FTvPIe12zVmcvW8YVkKYsWRM4auIOU7CZSEW4nT+OE6RCpETE12u1qxUhsq03byCL7HQYGJs2S0RsqdyEZV+kAeJxA0ULNXlPs0FEagpqFbxfmZSSWzGp6K9juaRc03OBYiCcxrhYopuU1B1q4xMJk/2xWfPhoNJTU8yKW6fHstJz9Eb7MXH2y3UzDBAbDdwaNH4/aq0fN6O2U2lr7n09oF+pa9Gi5gyUYhKN19skaHMPF+Y7GCkqyCpR2oKTWTp+zSKycvgcsfl9zX2MvZG2NCgLPqRPaCEg/Psa2HvnM4/LgZw5ViDHJDVvNofzKx+2zzUlpsrkXaVDeRqUYVnO/LLiLl1cVT0QDHH1DHLXFY8G7CLfQYA64Np0LURartCmoamC86FavkSPTmnUL7i3RBMJnOUy2Uzf/SzbdRq3Sfp5tAV/miGzWaJFs81wuDKTWq5bnSGNVR18Wori6K8BboRYLmxMpSgQJ/8AnvnXETKwoP2lajJr1A4oPI=
matrix:
include:
- os: linux
env: TARGET=arm-linux-androideabi
rust: nightly
- os: linux
env: TARGET=x86_64-unknown-linux-musl
rust: nightly
- os: linux
env: TARGET=arm-unknown-linux-gnueabihf
rust: nightly
- os: linux
env: TARGET=mips-unknown-linux-gnu
rust: nightly
- os: linux
env: TARGET=aarch64-unknown-linux-gnu
rust: nightly
- os: osx
env: TARGET=i386-apple-ios
rust: nightly-2015-09-08
- os: osx
env: TARGET=x86_64-apple-ios
rust: nightly-2015-09-08
notifications:
email:
on_success: never
branches:
only:
- master
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ description = """
A library for types and bindings to native C functions often found in libc or
other common platform libraries.
"""
include = ["Cargo.toml", "rust/src/liblibc/*"]

[features]
default = ["cargo-build"]
cargo-build = []

[lib]
name = "libc"
path = "rust/src/liblibc/lib.rs"
default = []
101 changes: 96 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,112 @@ A Rust library with native bindings to the types and functions commonly found on
various systems, including libc.

[![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc)
[![Build status](https://ci.appveyor.com/api/projects/status/v0414slj8y8nga0p?svg=true)](https://ci.appveyor.com/project/alexcrichton/libc)

[Documentation](http://doc.rust-lang.org/libc)
[Documentation](#platforms-and-documentation)

## Usage

Add this to your `Cargo.toml`:
First, add the following to your `Cargo.toml`:

```toml
[dependencies]

libc = "0.1"
libc = "1.0"
```

and this to your crate root:
Next, add this to your crate root:

```rust
extern crate libc;
```

## What is libc?

The primary purpose of this crate is to provide all of the definitions necessary
to easily interoperate with C code (or "C-like" code) on each of the platforms
that Rust supports. This includes type definitions (e.g. `c_int`), constants
(e.g. `EINVAL`) as well as function headers (e.g. `malloc`).

This crate does not strive to have any form of compatibility across platforms,
but rather it is simply a straight binding to the system libraries on the
platform in question.

## Public API

This crate exports all underlying platform types, functions, and constants under
the crate root, so all items are accessible as `libc::foo`. The types and values
of all the exported APIs match the platform that libc is compiled for.

More detailed information about the design of this library can be found in its
[associated RFC][rfc].

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md

## Adding an API

Want to use an API which currently isn't bound in `libc`? It's quite easy to add
one!

The internal structure of this crate is designed to minimize the number of
`#[cfg]` attributes in order to easily be able to add new items which apply
to all platforms in the future. As a result, the crate is organized
hierarchically based on platform. Each module has a number of `#[cfg]`'d
children, but only one is ever actually compiled. Each module then reexports all
the contents of its children.

This means that for each platform that libc supports, the path from a
leaf module to the root will contain all bindings for the platform in question.
Consequently, this indicates where an API should be added! Adding an API at a
particular level in the hierarchy means that it is supported on all the child
platforms of that level. For example, when adding a Unix API it should be added
to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to
`src/unix/notbsd/linux/mod.rs`.

If you're not 100% sure at what level of the hierarchy an API should be added
at, fear not! This crate has CI support which tests any binding against all
platforms supported, so you'll see failures if an API is added at the wrong
level or has different signatures across platforms.

With that in mind, the steps for adding a new API are:

1. Determine where in the module hierarchy your API should be added.
2. Add the API.
3. Send a PR to this repo.
4. Wait for CI to pass, fixing errors.
5. Wait for a merge!

## Platforms and Documentation

The following platforms are currently tested and have documentation available:

Tested:
* [`i686-pc-windows-msvc`](https://doc.rust-lang.org/libc/i686-pc-windows-msvc/libc)
* [`x86_64-pc-windows-msvc`](https://doc.rust-lang.org/libc/x86_64-pc-windows-msvc/libc)
(Windows)
* [`i686-pc-windows-gnu`](https://doc.rust-lang.org/libc/i686-pc-windows-gnu/libc)
* [`x86_64-pc-windows-gnu`](https://doc.rust-lang.org/libc/x86_64-pc-windows-gnu/libc)
* [`i686-apple-darwin`](https://doc.rust-lang.org/libc/i686-apple-darwin/libc)
* [`x86_64-apple-darwin`](https://doc.rust-lang.org/libc/x86_64-apple-darwin/libc)
(OSX)
* [`i686-apple-ios`](https://doc.rust-lang.org/libc/i686-apple-ios/libc)
* [`x86_64-apple-ios`](https://doc.rust-lang.org/libc/x86_64-apple-ios/libc)
(iOS)
* [`i686-unknown-linux-gnu`](https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc)
* [`x86_64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu/libc)
(Linux)
* [`x86_64-unknown-linux-musl`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl/libc)
(Linux MUSL)
* [`aarch64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/aarch64-unknown-linux-gnu/libc)
* [`mips-unknown-linux-gnu`](https://doc.rust-lang.org/libc/mips-unknown-linux-gnu/libc)
* [`arm-unknown-linux-gnueabihf`](https://doc.rust-lang.org/libc/arm-unknown-linux-gnueabihf/libc)
* [`arm-linux-androideabi`](https://doc.rust-lang.org/libc/arm-linux-androideabi/libc)
(Android)

The following may be supported, but are not guaranteed to always work:

* `x86_64-unknown-freebsd`
* `i686-unknown-freebsd`
* `x86_64-unknown-bitrig`
* `x86_64-unknown-dragonfly`
* `x86_64-unknown-openbsd`
* `x86_64-unknown-netbsd`
25 changes: 25 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
environment:
matrix:
- TARGET: x86_64-pc-windows-gnu
MSYS2_BITS: 64
- TARGET: i686-pc-windows-gnu
MSYS2_BITS: 32
- TARGET: x86_64-pc-windows-msvc
- TARGET: i686-pc-windows-msvc
install:
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe"
- rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
- if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin
- rustc -V
- cargo -V

build: false

test_script:
- cargo test
- cargo run --manifest-path libc-test/Cargo.toml

branches:
only:
- master
68 changes: 68 additions & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
The goal of the libc crate is to have CI running everywhere to have the
strongest guarantees about the definitions that this library contains, and as a
result the CI is pretty complicated and also pretty large! Hopefully this can
serve as a guide through the sea of scripts in this directory and elsewhere in
this project.

# Files

First up, let's talk about the files in this directory:

* `msys2.ps1` - a PowerShell script which is used to install MSYS2 on the
AppVeyor bots. As of this writing MSYS2 isn't installed by default, and this
script will install the right version/arch of msys2 in preparation of using
the contained C compiler to compile C shims.

* `run-travis.sh` - a shell script run by all Travis builders, this is
responsible for setting up the rest of the environment such as installing new
packages, downloading Rust target libraries, etc.

* `run.sh` - the actual script which runs tests for a particular architecture.
Called from the `run-travis.sh` script this will run all tests for the target
specified.

* `cargo-config` - Cargo configuration of linkers to use copied into place by
the `run-travis.sh` script before builds are run.

* `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly
Travis bots to build documentation for this crate.

* `landing-page-*.html` - used by `dox.sh` to generate a landing page for all
architectures' documentation.

# CI Systems

Currently this repository leverages a combination of Travis CI and AppVeyor for
running tests. The triples tested are:

* AppVeyor
* `{i686,x86_64}-pc-windows-{msvc,gnu}`
* Travis
* `{i686,x86_64,mips,aarch64}-unknown-linux-gnu`
* `x86_64-unknown-linux-musl`
* `arm-unknown-linux-gnueabihf`
* `arm-linux-androideabi`
* `{i686,x86_64}-apple-{darwin,ios}`

The Windows triples are all pretty standard, they just set up their environment
then run tests, no need for downloading any extra target libs (we just download
the right installer). The Intel Linux/OSX builds are similar in that we just
download the right target libs and run tests. Note that the Intel Linux/OSX
builds are run on stable/beta/nightly, but are the only ones that do so.

The remaining architectures look like:

* Android runs in a [docker image][android-docker] with an emulator, the NDK,
and the SDK already set up. The entire build happens within the docker image.
* The MIPS, ARM, and AArch64 builds all use QEMU to run the generated binary to
actually verify the tests pass.
* The MUSL build just has to download a MUSL compiler and target libraries and
then otherwise runs tests normally.
* iOS builds need an extra linker flag currently, but beyond that they're built
as standard as everything else.

[android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile

Hopefully that's at least somewhat of an introduction to everything going on
here, and feel free to ping @alexcrichton with questions!

38 changes: 38 additions & 0 deletions ci/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# A vagrant configuration file for running tests on BSD-like machines
#
# Note that this was originally intended to later be used to run tests on
# Travis, but it didn't work out. Regardless this has stuck around! You can run
# tests in FreeBSD via:
#
# git clone https://github.com/alexcrichton/libc
# cd libc/ci
# vagrant up freebsd
# vagrant ssh freebsd
# ...
# cd /vagrant/libc-test
# cargo run
#
# And "that's it"! You look up instructions on Vagrant's website for how to
# install vagrant.

Vagrant.configure(2) do |config|
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

config.vm.synced_folder "..", "/vagrant"

config.vm.define :freebsd do |bsd|
bsd.vm.box = "arkadi/freebsd-10.1-amd64"
bsd.vm.provision :shell, inline: 'yes | sudo pkg install rust cargo'
bsd.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
end

config.vm.define :openbsd do |bsd|
bsd.vm.box = "bodgit/openbsd-5.7-amd64"
bsd.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
end
end
13 changes: 13 additions & 0 deletions ci/cargo-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Configuration of which linkers to call on Travis for various architectures

[target.arm-linux-androideabi]
linker = "arm-linux-androideabi-gcc"

[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc-4.7"

[target.mips-unknown-linux-gnu]
linker = "mips-linux-gnu-gcc"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
33 changes: 33 additions & 0 deletions ci/dox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

# Builds documentation for all target triples that we have a registered URL for
# in liblibc. This scrapes the list of triples to document from `src/lib.rs`
# which has a bunch of `html_root_url` directives we pick up.

set -e

TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`

rm -rf target/doc
mkdir -p target/doc

cp ci/landing-page-head.html target/doc/index.html

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>" \
>> target/doc/index.html
done

cat ci/landing-page-footer.html >> target/doc/index.html

# If we're on travis, not a PR, and on the right branch, publish!
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
pip install ghp-import --user $USER
$HOME/.local/bin/ghp-import -n target/doc
git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
fi
7 changes: 7 additions & 0 deletions ci/landing-page-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<ul>
4 changes: 4 additions & 0 deletions ci/landing-page-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
</ul>
</body>
</html>

Loading