forked from larsimmisch/homebrew-avr
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathavr-libc.rb
65 lines (51 loc) · 1.81 KB
/
avr-libc.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
require 'formula'
# Atmel distributes a complete tarball of patches.
class AtmelPatches < Formula
url 'http://distribute.atmel.no/tools/opensource/Atmel-AVR-Toolchain-3.4.1/avr/avr-patches.tar.gz'
homepage 'http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORLINUX.aspx'
sha1 '59a139a42c8dada06fa5e3ebbd3d37f8d16b0d11'
end
class AtmelHeaders < Formula
url 'http://distribute.atmel.no/tools/opensource/Atmel-AVR-Toolchain-3.4.1.830/avr/avr-headers-6.1.0.1157.zip'
sha1 '633d7e8c93d54579b21bb3a76721b1d88572d677'
end
class AvrLibc < Formula
url 'http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.8.0.tar.bz2'
homepage 'http://www.nongnu.org/avr-libc/'
md5 '54c71798f24c96bab206be098062344f'
depends_on 'avr-gcc'
def patches
mkdir buildpath/'patches'
AtmelPatches.new.brew { cp Dir['avr-libc/*'], buildpath/'patches' }
{ :p0 => Dir[buildpath/'patches/*'] }
end
def install
# brew's build environment is in our way
ENV.delete 'CFLAGS'
ENV.delete 'CXXFLAGS'
ENV.delete 'LD'
ENV.delete 'CC'
ENV.delete 'CXX'
# Pull in the latest Atmel headers.
AtmelHeaders.new.brew do
cp Dir['io[0-9a-zA-Z]*.h'], buildpath/'include/avr/'
end
# Run the bootstrap script to pull in any changes.
system "./bootstrap"
args = [
"--host=avr",
"--prefix=#{prefix}",
"--libdir=#{prefix}/lib",
"--datadir=#{prefix}"
]
system "./configure", *args
system "make", "install"
# copy include and lib files where avr-gcc searches for them
# this wouldn't be necessary with a standard prefix
# XXX There's got to be a better way, maybe symlinks?
avr = File.join prefix, 'avr'
avr_gcc = Formula.factory('avr-gcc')
ohai "copying #{avr} -> #{avr_gcc.prefix}"
cp_r avr, avr_gcc.prefix
end
end