-
Notifications
You must be signed in to change notification settings - Fork 431
/
Copy pathc.rb
54 lines (46 loc) · 1.13 KB
/
c.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Travis
module Build
class Script
class C < Script
DEFAULTS = {
default: { compiler: 'gcc' },
freebsd: { compiler: 'cc' },
}
def export
super
sh.export 'TRAVIS_COMPILER', compiler
sh.export 'CC', "${CC:-#{compiler}}"
sh.export 'CC_FOR_BUILD', "${CC_FOR_BUILD:-#{compiler}}"
if data.cache?(:ccache)
sh.export 'PATH', "/usr/lib/ccache:$PATH"
end
end
def announce
super
sh.cmd "#{compiler} --version"
end
def script
sh.cmd './configure && make && make test'
end
def cache_slug
super << '--compiler-' << compiler
end
def setup_cache
if data.cache?(:ccache)
sh.fold 'cache.ccache' do
sh.newline
directory_cache.add('~/.ccache')
end
end
end
def use_directory_cache?
super || data.cache?(:ccache)
end
private
def compiler
config[:compiler].to_s
end
end
end
end
end