From 9ee8d3a42898ad26790e0d3d9e12ce21bb8676d9 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Tue, 3 Apr 2018 14:49:26 +0800 Subject: [PATCH] Add homebrew files for macOS --- macOS-env/README.md | 11 +++++++++++ macOS-env/grub.rb | 31 +++++++++++++++++++++++++++++++ macOS-env/objconv.rb | 23 +++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 macOS-env/README.md create mode 100644 macOS-env/grub.rb create mode 100644 macOS-env/objconv.rb diff --git a/macOS-env/README.md b/macOS-env/README.md new file mode 100644 index 0000000..658c902 --- /dev/null +++ b/macOS-env/README.md @@ -0,0 +1,11 @@ +# MacOS environment + +* x86_64_elf_*: + + +* grub.rb: + + +* objconv.rb: + + Change SHA256 \ No newline at end of file diff --git a/macOS-env/grub.rb b/macOS-env/grub.rb new file mode 100644 index 0000000..fec68c6 --- /dev/null +++ b/macOS-env/grub.rb @@ -0,0 +1,31 @@ +class Grub < Formula + desc "GNU GRUB 2 targetting i386-elf" + homepage "https://www.gnu.org/software/grub/" + url "https://ftp.gnu.org/gnu/grub/grub-2.02.tar.xz" + version "2.02" + sha256 "810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f" + + depends_on "i386-elf-gcc" + + def install + mkdir "grub-build" do + system "../configure", + "--disable-nls", + "--disable-werror", + "--disable-efiemu", + "--target=i386-elf", + "--prefix=#{prefix}", + "TARGET_CC=i386-elf-gcc", + "TARGET_NM=i386-elf-nm", + "TARGET_OBJCOPY=i386-elf-objcopy", + "TARGET_RANLIB=i386-elf-ranlib", + "TARGET_STRIP=i386-elf-strip" + + system "make", "install" + end + end + + test do + system "grub-shell", "--version" + end +end \ No newline at end of file diff --git a/macOS-env/objconv.rb b/macOS-env/objconv.rb new file mode 100644 index 0000000..517b266 --- /dev/null +++ b/macOS-env/objconv.rb @@ -0,0 +1,23 @@ +class Objconv < Formula + desc "Object file converter and disassembler" + homepage "http://www.agner.org/optimize/#objconv" + url "http://www.agner.org/optimize/objconv.zip" + version "2.44" + sha256 "f2c0c4cd6ff227e76ffed5796953cd9ae9eb228847ca9a14dba6392c573bb7a4" + def install + system "unzip", "source.zip", + "-dsrc" + # objconv doesn't have a Makefile, so we have to call + # the C++ compiler ourselves + system ENV.cxx, "-o", "objconv", + "-O2", + *Dir["src/*.cpp"], + "--prefix=#{prefix}" + bin.install "objconv" + end + + test do + system "#{bin}/objconv", "-h" + # TODO: write better tests + end +end