This repository has been archived by the owner on Sep 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
binutils-msp430.rb
60 lines (52 loc) · 1.92 KB
/
binutils-msp430.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
class BinutilsMsp430 < Formula
desc "GNU assembler, linker, and binaru utilities for MSP430 MCUs"
homepage "https://sourceforge.net/projects/mspgcc/"
url "https://ftpmirror.gnu.org/binutils/binutils-2.22.tar.gz"
sha256 "12c26349fc7bb738f84b9826c61e103203187ca2d46f08b82e61e21fcbc6e3e6"
version "2.22-20120911"
revision 4
patch do
url "https://downloads.sourceforge.net/project/mspgcc/Patches/binutils-2.22/msp430-binutils-2.22-20120911.patch"
sha256 "1dc3cfb0eac093b5f016f4264b811b4352515e8a3519c91240c73bacd256a667"
end
depends_on "[email protected]" => :build if OS.linux?
resource "config" do
url "https://git.savannah.gnu.org/git/config.git"
end
def install
# Update config.guess and config.sub to be able to handle newer
# architechture such as aarch64.
resource("config").stage do
buildpath.install "config.guess"
buildpath.install "config.sub"
end
ENV.prepend_path "PATH", Formula["[email protected]"].opt_prefix/"bin" if OS.linux?
target = "msp430"
mkdir "build" do
system "../configure",
"--target=#{target}",
"--program-prefix=#{target}-",
"--prefix=#{prefix}",
"--disable-static",
"--disable-nls",
"--disable-werror"
system "make"
system "make", "install"
end
# Remove unnecessary files.
(lib/"libiberty.a").delete
info.rmtree
# Create symlinks to no-prefix binaries as bin/target.
bin.install_symlink prefix/target/"bin" => target
# Create empty place holders for gcc-msp430 and libc-msp430
target_lib = HOMEBREW_PREFIX/"lib/#{target}/lib"
target_include = HOMEBREW_PREFIX/"include/#{target}/include"
target_lib.mkpath
target_include.mkpath
# Move target/lib to lib/target/lib
(lib/target).install prefix/target/"lib"
# Create symlink for msp430-ld to see linker scripts from
# headers-msp430.
(prefix/target).install_symlink target_lib
end
end