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

Upgrade Rust base (9th June) (fb7cca33f) #144

Closed
wants to merge 5 commits into from
Closed
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
29 changes: 29 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
image: docker:stable

variables:
# When using dind service we need to instruct docker, to talk with the
# daemon started inside of the service. The daemon is available with
# a network connection instead of the default /var/run/docker.sock socket.
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
#
# Note that if you're using Kubernetes executor, the variable should be set to
# tcp://localhost:2375 because of how Kubernetes executor connects services
# to the job container
DOCKER_HOST: tcp://docker:2375/
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
DOCKER_DRIVER: overlay2

services:
- docker:dind

before_script:
- docker info

build:
stage: build
script:
- docker build -t avr-rust .
- docker run avr-rust echo hello world
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
url = https://github.com/rust-lang-nursery/edition-guide.git
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/8.0-2019-03-18
url = https://github.com/avr-rust/llvm-project.git
branch = avr-rustc/8.0-2019-03-18.new
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
url = https://github.com/rust-embedded/book.git
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM ubuntu:18.04

USER root

# Install dependencies.
RUN apt-get update && apt-get install -y build-essential cmake curl git python

# Create a regular user.
RUN useradd -m rustacean

# Copy the code over, create an empty directory for builds.
ADD . /code
# RUN cd /code
RUN mkdir /build && cd /build

# symlink Rust build directory to the /build volume
# RUN mkdir /build && ln -sf /build /code/build

# Compile rust.
# RUN /code/x.py build

# Generate Makefile using settings suitable for an experimental compiler
RUN /code/configure \
--enable-debug \
--disable-docs \
--enable-llvm-assertions \
--enable-debug-assertions \
--enable-optimize \
--enable-llvm-release-debuginfo \
--experimental-targets=AVR

RUN make
RUN make install

# Drop down to the regular user
USER rustacean

VOLUME /code
VOLUME /build
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,18 @@ First make sure you've installed all dependencies for building, as specified in
the main Rust repository [here](https://github.com/rust-lang/rust/#building-from-source).
Then use the following commands:

### Notes for macOS

The conventional install directory for macOS is `/usr/local/avr-rust` rather than the Linux default `/opt/avr-rust`, so before the steps below, you must:

1. Edit `build/config.toml` to set `prefix = '/usr/local/avr-rust'`.
2. Ensure `/usr/local/avr-rust` exists and has the correct permissions: `sudo mkdir /usr/local/avr-rust && sudo chown $USER:admin /usr/local/avr-rust`

Finally, `realpath` isn't included by default on macOS but is included in GNU Coreutils, so you can either `brew install coreutils` so the `rustup toolchain...` step works properly, or just use the explicit path (`rustup toolchain link avr-toolchain /usr/local/avr-rust`).

``` bash
# Grab the avr-rust sources
git clone https://github.com/avr-rust/rust.git
git clone https://github.com/avr-rust/rust.git --recursive

# Create a directory to place built files in
mkdir build && cd build
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2631,14 +2631,14 @@ macro_rules! fnptr_impls_safety_abi {
#[stable(feature = "fnptr_impls", since = "1.4.0")]
impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&(*self as *const ()), f)
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
}
}

#[stable(feature = "fnptr_impls", since = "1.4.0")]
impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Pointer::fmt(&(*self as *const ()), f)
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
}
}
}
Expand Down