forked from brettchien/homebrew-msp430
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsp430-elf-gcc.rb
89 lines (74 loc) · 2.38 KB
/
msp430-elf-gcc.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
require 'formula'
class Msp430ElfGcc < Formula
homepage 'http://gcc.gnu.org'
url 'http://ftpmirror.gnu.org/gcc/gcc-4.9.2/gcc-4.9.2.tar.bz2'
mirror 'ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2'
sha1 '79dbcb09f44232822460d80b033c962c0237c6d8'
head 'svn://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch'
depends_on 'msp430-elf-binutils'
fails_with :clang
fails_with :llvm
def install
target = 'msp430-elf'
binutils = Formula.factory "#{target}-binutils"
ENV['PATH'] += ":#{binutils.bin}:#{bin}"
languages = %w[c c++]
args = [
"--target=#{target}",
"--prefix=#{prefix}",
"--enable-languages=#{languages.join(',')}",
"--program-prefix=msp430-elf-",
"--disable-nls",
"--with-newlib",
"--with-as=#{binutils.bin}/#{target}-as",
"--with-ld=#{binutils.bin}/#{target}-ld",
"--enable-version-specific-runtime-libs",
]
mkdir 'build'
chdir 'build' do
system '../configure', *args
system 'make', 'all-host'
system 'make', 'install-host'
end
newlib = Formula.factory "#{target}-newlib"
newlib.brew do
system 'mkdir', '-p', "#{HOMEBREW_LOGS}/#{newlib.name}"
newlib_args = [
"--target=#{target}",
"--prefix=#{prefix}",
"--disable-newlib-supplied-syscalls",
"--enable-newlib-reent-small",
"--disable-newlib-fseek-optimization",
"--disable-newlib-wide-orient",
"--enable-newlib-nano-formatted-io",
"--disable-newlib-io-float",
"--enable-newlib-nano-malloc",
"--disable-newlib-unbuf-stream-opt",
"--enable-lite-exit",
"--enable-newlib-global-atexit",
"--disable-nls",
]
system "./configure", *newlib_args
system "make"
system 'make', 'installdirs'
system 'make', 'install-host'
system 'make', 'install-target-newlib'
system 'make', 'install-target-libgloss'
end
chdir 'build' do
system 'make', 'all-target'
system 'make', 'install-target'
end
info.rmtree
share.rmtree
def caveats; <<-EOS.unindent
Installing this package along side gcc has been known to result in linking errors.
The following is a workaround for dealing with those linking errors:
brew unlink gcc
mkdir /usr/local/lib/gcc
brew link gcc
brew link msp430-elf-gcc
EOS
end
end
end