forked from larsimmisch/homebrew-avr
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathavr-binutils.rb
63 lines (49 loc) · 1.61 KB
/
avr-binutils.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
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.830/avr/avr-patches.tar.gz'
homepage 'http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORLINUX.aspx'
sha1 '08208bdc9ddb6b4b328c1b4c94a2b81f1d750289'
end
class AvrBinutils < Formula
url 'http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2'
homepage 'http://www.gnu.org/software/binutils/binutils.html'
md5 'ee0f10756c84979622b992a4a61ea3f5'
depends_on 'autoconf264'
depends_on :automake
def patches
mkdir buildpath/'patches'
AtmelPatches.new.brew { cp Dir['binutils/*'], buildpath/'patches' }
{ :p0 => Dir[buildpath/'patches/*'] }
end
def install
ENV['CPPFLAGS'] = "-I#{include}"
args = ["--prefix=#{prefix}",
"--infodir=#{info}",
"--mandir=#{man}",
"--disable-werror",
"--disable-nls",
"--enable-install-libiberty",
"--enable-install-libbfd"]
# brew's build environment is in our way
ENV.delete 'CFLAGS'
ENV.delete 'CXXFLAGS'
ENV.delete 'LD'
ENV.delete 'CC'
ENV.delete 'CXX'
if MacOS.lion?
ENV['CC'] = 'clang'
end
# Pick up any autotools changes.
ENV['AUTOCONF'] = '/usr/local/bin/autoconf264'
ENV['AUTOM4TE'] = '/usr/local/bin/autom4te264'
system "autoconf"
system "autoreconf", "ld"
system "./configure", "--target=avr", *args
system "make", "all-bfd", "TARGET-bfd=headers"
rm 'bfd/Makefile'
system "make", "configure-host"
system "make"
system "make install"
end
end