mirror of
https://github.com/ziglang/zig.git
synced 2024-12-14 07:10:16 +00:00
travis: add macos script
This commit is contained in:
parent
b59aa7b906
commit
6623a11b2c
28
.travis.yml
28
.travis.yml
@ -1,24 +1,16 @@
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
dist: trusty
|
||||
osx_image: xcode8.3
|
||||
sudo: required
|
||||
language: cpp
|
||||
before_install:
|
||||
- sudo sh -c 'echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main" >> /etc/apt/sources.list'
|
||||
- wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo apt-get update -q
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ci/travis_linux_before_install; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ci/travis_osx_before_install; fi
|
||||
install:
|
||||
- sudo apt-get remove -y llvm-*
|
||||
- sudo rm -rf /usr/local/*
|
||||
- sudo apt-get install -y clang-5.0 libclang-5.0 libclang-5.0-dev llvm-5.0 llvm-5.0-dev liblld-5.0 liblld-5.0-dev cmake
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ci/travis_linux_install; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ci/travis_osx_install; fi
|
||||
script:
|
||||
- export CC=clang-5.0
|
||||
- export CXX=clang++-5.0
|
||||
- which $CC
|
||||
- which $CXX
|
||||
- echo $PATH
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print-file-name=crt1.o)) -DZIG_LIBC_INCLUDE_DIR=$(echo -n | $CC -E -x c - -v 2>&1 | grep -B1 "End of search list." | head -n1 | cut -c 2- | sed "s/ .*//") -DZIG_LIBC_STATIC_LIB_DIR=$(dirname $($CC -print-file-name=crtbegin.o))
|
||||
- make VERBOSE=1
|
||||
- make install
|
||||
- ./zig build --build-file ../build.zig test
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ci/travis_linux_script; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ci/travis_osx_script; fi
|
||||
|
6
ci/travis_linux_before_install
Executable file
6
ci/travis_linux_before_install
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
sudo sh -c 'echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main" >> /etc/apt/sources.list'
|
||||
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
sudo apt-get update -q
|
5
ci/travis_linux_install
Executable file
5
ci/travis_linux_install
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
sudo apt-get remove -y llvm-*
|
||||
sudo rm -rf /usr/local/*
|
||||
sudo apt-get install -y clang-5.0 libclang-5.0 libclang-5.0-dev llvm-5.0 llvm-5.0-dev liblld-5.0 liblld-5.0-dev cmake
|
13
ci/travis_linux_script
Executable file
13
ci/travis_linux_script
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
export CC=clang-5.0
|
||||
export CXX=clang++-5.0
|
||||
which $CC
|
||||
which $CXX
|
||||
echo $PATH
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print-file-name=crt1.o)) -DZIG_LIBC_INCLUDE_DIR=$(echo -n | $CC -E -x c - -v 2>&1 | grep -B1 "End of search list." | head -n1 | cut -c 2- | sed "s/ .*//") -DZIG_LIBC_STATIC_LIB_DIR=$(dirname $($CC -print-file-name=crtbegin.o))
|
||||
make VERBOSE=1
|
||||
make install
|
||||
./zig build --build-file ../build.zig test
|
3
ci/travis_osx_before_install
Executable file
3
ci/travis_osx_before_install
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
brew update
|
39
ci/travis_osx_install
Executable file
39
ci/travis_osx_install
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
brew install gcc@7
|
||||
brew outdated gcc@7 || brew upgrade gcc@7
|
||||
|
||||
SRC_DIR=$(pwd)
|
||||
PREFIX_DIR=$SRC_DIR/local
|
||||
export CC=/usr/local/opt/gcc/bin/$(uname -m)-apple-darwin$(uname -r)-gcc-7
|
||||
export CXX=/usr/local/opt/gcc/bin/$(uname -m)-apple-darwin$(uname -r)-g++-7
|
||||
|
||||
wget http://prereleases.llvm.org/5.0.0/rc2/llvm-5.0.0rc2.src.tar.xz
|
||||
wget http://prereleases.llvm.org/5.0.0/rc2/cfe-5.0.0rc2.src.tar.xz
|
||||
wget http://prereleases.llvm.org/5.0.0/rc2/lld-5.0.0rc2.src.tar.xz
|
||||
|
||||
cd $SRC_DIR
|
||||
tar xvf llvm-5.0.0rc2.src.tar.xz
|
||||
cd llvm-5.0.0rc2.src
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_DIR -DCMAKE_PREFIX_PATH=$PREFIX_DIR
|
||||
make install
|
||||
|
||||
cd $SRC_DIR
|
||||
tar xvf lld-5.0.0rc2.src.tar.xz
|
||||
cd lld-5.0.0rc2.src
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_DIR -DCMAKE_PREFIX_PATH=$PREFIX_DIR
|
||||
make install
|
||||
|
||||
cd $SRC_DIR
|
||||
tar xvf cfe-5.0.0rc2.src.tar.xz
|
||||
cd cfe-5.0.0rc2.src
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_DIR -DCMAKE_PREFIX_PATH=$PREFIX_DIR
|
||||
make install
|
||||
|
||||
cd $SRC_DIR
|
14
ci/travis_osx_script
Executable file
14
ci/travis_osx_script
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
PREFIX_DIR=$(pwd)/local
|
||||
export CC=/usr/local/opt/gcc/bin/$(uname -m)-apple-darwin$(uname -r)-gcc-7
|
||||
export CXX=/usr/local/opt/gcc/bin/$(uname -m)-apple-darwin$(uname -r)-g++-7
|
||||
|
||||
echo $PATH
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_PREFIX_PATH=$PREFIX_DIR -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print-file-name=crt1.o)) -DZIG_LIBC_INCLUDE_DIR=$(echo -n | $CC -E -x c - -v 2>&1 | grep -B1 "End of search list." | head -n1 | cut -c 2- | sed "s/ .*//") -DZIG_LIBC_STATIC_LIB_DIR=$(dirname $($CC -print-file-name=crtbegin.o))
|
||||
make VERBOSE=1
|
||||
make install
|
||||
# TODO get tests passing on macos
|
||||
# ./zig build --build-file ../build.zig test
|
Loading…
Reference in New Issue
Block a user