Merge pull request #633 from mmicko/master
[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 remote -v
33 git branch -v
34 if [ x"$(git show-ref -s HEAD)" = x"$TRAVIS_COMMIT" ]; then
35 echo "Checked out at $TRAVIS_COMMIT"
36 else
37 if [ z"$TRAVIS_PULL_REQUEST_SLUG" != z ]; then
38 git fetch source $TRAVIS_COMMIT || echo "Unable to fetch $TRAVIS_COMMIT from source"
39 fi
40 git fetch origin $TRAVIS_COMMIT || echo "Unable to fetch $TRAVIS_COMMIT from origin"
41 fi
42 git branch -D $TRAVIS_BRANCH || true
43 git checkout $TRAVIS_COMMIT -b $TRAVIS_BRANCH
44 git branch -v
45 fi
46
47 # Output status information.
48 git status
49 git describe --tags
50 git log -n 5 --graph
51 echo
52 echo -en 'travis_fold:end:before_install.git\\r'
53 echo
54
55 ##########################################################################
56
57 # Mac OS X specific setup.
58 if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
59 (
60 echo
61 echo 'Setting up brew...' && echo -en 'travis_fold:start:before_install.brew\\r'
62 echo
63 brew update
64 brew tap Homebrew/bundle
65 brew bundle
66 brew install ccache
67 brew install gcc@7
68 echo
69 echo -en 'travis_fold:end:before_install.brew\\r'
70 echo
71 )
72 fi
73
74 ##########################################################################
75
76 # Install iverilog
77 (
78 if [ ! -e ~/.local-bin/bin/iverilog ]; then
79 echo
80 echo 'Building iverilog...' && echo -en 'travis_fold:start:before_install.iverilog\\r'
81 echo
82 mkdir -p ~/.local-src
83 mkdir -p ~/.local-bin
84 cd ~/.local-src
85 git clone git://github.com/steveicarus/iverilog.git
86 cd iverilog
87 autoconf
88 ./configure --prefix=$HOME/.local-bin
89 make
90 make install
91 echo
92 echo -en 'travis_fold:end:before_install.iverilog\\r'
93 echo
94 fi
95 )
96
97 ##########################################################################