Merge pull request #446 from mithro/travis-rework
[yosys.git] / .travis / setup.sh
1 #! /bin/bash
2
3 set -e
4
5 source .travis/common.sh
6
7 ##########################################################################
8
9 # Fixing Travis's git clone
10 echo
11 echo 'Fixing git setup...' && echo -en 'travis_fold:start:before_install.git\\r'
12 echo
13 git fetch --unshallow && git fetch --tags
14
15 # For pull requests, we get more info about the git source.
16 if [ z"$TRAVIS_PULL_REQUEST_SLUG" != z ]; then
17 echo "- Fetching from pull request source"
18 git remote add source https://github.com/$TRAVIS_PULL_REQUEST_SLUG.git
19 git fetch source && git fetch --tags
20
21 echo "- Fetching the actual pull request"
22 git fetch origin pull/$TRAVIS_PULL_REQUEST/head:pull-$TRAVIS_PULL_REQUEST-head
23 git fetch origin pull/$TRAVIS_PULL_REQUEST/merge:pull-$TRAVIS_PULL_REQUEST-merge
24
25 git log -n 5 --graph pull-$TRAVIS_PULL_REQUEST-merge
26 fi
27
28 # For building branches we need to fix the "detached head" state.
29 if [ z"$TRAVIS_BRANCH" != z ]; then
30 TRAVIS_COMMIT_ACTUAL=$(git log --pretty=format:'%H' -n 1)
31 echo "- Fixing detached head (current $TRAVIS_COMMIT_ACTUAL -> $TRAVIS_COMMIT)"
32 git fetch origin $TRAVIS_COMMIT
33 git branch -v
34 git branch -D $TRAVIS_BRANCH || true
35 git checkout $TRAVIS_COMMIT -b $TRAVIS_BRANCH
36 git branch -v
37 fi
38
39 # Output status information.
40 git status
41 git describe --tags
42 git log -n 5 --graph
43 echo
44 echo -en 'travis_fold:end:before_install.git\\r'
45 echo
46
47 ##########################################################################
48
49 # Mac OS X specific setup.
50 if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
51 (
52 echo
53 echo 'Setting up brew...' && echo -en 'travis_fold:start:before_install.brew\\r'
54 echo
55 brew update
56 brew tap Homebrew/bundle
57 brew bundle
58 brew install ccache
59 brew install gcc
60 echo
61 echo -en 'travis_fold:end:before_install.brew\\r'
62 echo
63 )
64 fi
65
66 ##########################################################################
67
68 # Install iverilog
69 (
70 if [ ! -e ~/.local-bin/bin/iverilog ]; then
71 echo
72 echo 'Building iverilog...' && echo -en 'travis_fold:start:before_install.iverilog\\r'
73 echo
74 mkdir -p ~/.local-src
75 mkdir -p ~/.local-bin
76 cd ~/.local-src
77 git clone git://github.com/steveicarus/iverilog.git
78 cd iverilog
79 autoconf
80 ./configure --prefix=$HOME/.local-bin
81 make
82 make install
83 echo
84 echo -en 'travis_fold:end:before_install.iverilog\\r'
85 echo
86 fi
87 )
88
89 ##########################################################################