Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

New Formula: SPIM - A MIPS32 Simulator #22721

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Library/Formula/spim.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require 'stringio'

require 'formula'

class Spim < Formula
homepage 'http://spimsimulator.sourceforge.net/'
# No source code tarball exists
url 'http://svn.code.sf.net/p/spimsimulator/code', :revision => 606
version '9.1.9'

def install
bin.mkpath
system 'cd spim && make'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to enter the directory twice; you can:

cd 'spim' do
  system 'make'
  system 'make install'
end

system 'cd spim && make install'
end

def patches
# modify Makefile so files install to proper HomeBrew directories
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are all make variables, you can pass them as arguments to make without needing a patch:

system "make", "install", "BIN_DIR=#{bin}", "EXCEPTION_DIR=#{share}", "MAN_DIR=#{man1}"

data = DATA.read
data.gsub!('$(bin)', bin)
data.gsub!('$(share)', share)
data.gsub!('$(man1)', man1)

StringIO.new(data)
end

end
__END__
diff --git a/spim/Makefile b/spim/Makefile
index be676a0..a8eded2 100755
--- a/spim/Makefile
+++ b/spim/Makefile
@@ -66,13 +66,13 @@ DOC_DIR = ../Documentation


# Full path for the directory that will hold the executable files:
-BIN_DIR = $(DESTDIR)/usr/bin
+BIN_DIR = $(bin)

# Full path for the directory that will hold the exception handler:
-EXCEPTION_DIR = $(DESTDIR)/usr/share/spim
+EXCEPTION_DIR = $(share)

# Full path for the directory that will hold the man files:
-MAN_DIR = $(DESTDIR)/usr/share/man/man1
+MAN_DIR = $(man1)


# If you have flex, use it instead of lex. If you use flex, define this