forked from xiw/homebrew-jos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathi386-elf-gcc.rb
55 lines (45 loc) · 1.39 KB
/
i386-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
class I386ElfGcc < Formula
desc "GNU compiler collection for i386-elf development"
homepage "https://gcc.gnu.org"
url "http://ftpmirror.gnu.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2"
mirror "https://ftp.gnu.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2"
sha256 "5f835b04b5f7dd4f4d2dc96190ec1621b8d89f2dc6f638f9f8bc1b1014ba8cad"
depends_on "gmp"
depends_on "libmpc"
depends_on "mpfr"
depends_on "i386-elf-binutils"
def install
languages = %w[c]
binutils = Formula.factory "i386-elf-binutils"
args = [
"--prefix=#{prefix}",
"--enable-languages=#{languages.join(",")}",
"--disable-werror",
"--disable-nls",
"--disable-libssp",
"--disable-libmudflap",
"--disable-multilib",
"--with-as=#{binutils.bin}/i386-elf-as",
"--with-ld=#{binutils.bin}/i386-elf-ld",
"--with-newlib",
"--without-headers",
"--target=i386-elf"
]
mkdir "build" do
system "../configure", *args
system "make", "all-gcc"
system "make", "install-gcc"
system "make", "all-target-libgcc"
system "make", "install-target-libgcc"
end
# Rename man7
Dir.glob(man7/"*.7") { |file| add_prefix file, "i386-elf" }
info.rmtree
end
def add_prefix(file, prefix)
dir = File.dirname(file)
ext = File.extname(file)
base = File.basename(file, ext)
File.rename file, "#{dir}/#{prefix}-#{base}#{ext}"
end
end