Permalink
Browse files

New Formula: pev v0.50

pev is a toolkit designed for PE analysis and has no dependencies.
  • Loading branch information...
1 parent 1c8c936 commit 2b8cfaf9d3e57ddd19c3066b793ad82f9f47e100 @farproc committed Jul 7, 2012
Showing with 36 additions and 0 deletions.
  1. +36 −0 Library/Formula/pev.rb
View
@@ -0,0 +1,36 @@
+require 'formula'
+
+class Pev < Formula
+ homepage 'http://pev.sourceforge.net/'
+ url 'https://github.com/merces/pev/tarball/v0.50'
+ sha1 '03ca75ac004946b463a37837870e43809113bf8a'
+
+ def install
+ # Fix:
+ # hardcoded gcc
+ # build dylibs instead
+ # don't put symlinks in ./lib/
+ inreplace 'configure' do |f|
+ f.gsub! "new_cc=\'gcc\'", "new_cc='#{ENV.cc}'"
+ f.gsub! "replace \"s/^CC=.*/CC=$new_cc/\" \"$makef_libpe\"", "replace \"s!^CC=.*!CC=$new_cc!\" \"$makef_libpe\""
+ f.gsub! "replace \"s/^CC=.*/CC=$new_cc/\" \"$makef_pev\"", "replace \"s!^CC=.*!CC=$new_cc!\" \"$makef_pev\""
+ f.gsub! "new_libpe='-shared -Wl,-install_name,$(LIBNAME).so.1 -o $(LIBNAME).so $(LIBNAME).o'", "new_libpe='-dynamiclib -Wl,-install_name,$(LIBNAME).dylib -o $(LIBNAME).dylib $(LIBNAME).o'"
+ end
+
+ inreplace 'lib/libpe/Makefile' do |f|
+ f.gsub! "$(LN) $(DEST)/$(LIBNAME).so.$(VERSION) $(DEST)/$(LIBNAME).so.1", "# no more symlink"
+ f.gsub! "$(LN) $(DEST)/$(LIBNAME).so.$(VERSION) $(DEST)/$(LIBNAME).so", "# no more symlink"
+ f.gsub! "$(INSTALL) $(LIBNAME).so $(DEST)/$(LIBNAME).so.$(VERSION)", "$(INSTALL) $(LIBNAME).so $(DEST)/$(LIBNAME).so"
+ f.gsub! "$(LIBNAME).so","$(LIBNAME).dylib"
+ f.gsub! "$(RM) $(LIBNAME).*o*", "$(RM) $(LIBNAME).*o* $(LIBNAME).dylib"
+ end
+
+ system "./configure", "--prefix=#{prefix}"
+ system "make"
+ system "make install"
+ end
+
+ def test
+ system "#{bin}/pescan -v"
+ end
+end

0 comments on commit 2b8cfaf

Please sign in to comment.