Skip to content

Commit

Permalink
radare2: Added signing option
Browse files Browse the repository at this point in the history
Added the option to sign the build, it uses the built in commands from
the radare2 Makefile. In order for it to succeed the org.radare.radare2
certificate must exist in the keychain. The process is defined in
https://github.com/radare/radare2/blob/master/doc/osx.md

Closes #3838.

Signed-off-by: Andrew Janke <janke@eilonwy.local>
  • Loading branch information
Alex Kornitzer authored and Andrew Janke committed Aug 23, 2016
1 parent e376a82 commit fd015ea
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Formula/radare2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
class CodesignRequirement < Requirement
include FileUtils
fatal true

satisfy(:build_env => false) do
mktemp do
cp "/usr/bin/false", "radare2_check"
quiet_system "/usr/bin/codesign", "-f", "-s", "org.radare.radare2", "--dryrun", "radare2_check"
end
end

def message
<<-EOS.undent
org.radare.radare2 identity must be available to build with automated signing.
See: https://github.com/radare/radare2/blob/master/doc/osx.md
EOS
end
end

class Radare2 < Formula
desc "Reverse engineering framework"
homepage "http://radare.org"
Expand Down Expand Up @@ -35,6 +54,8 @@ class Radare2 < Formula
end
end

option "with-code-signing", "Codesign executables to provide unprivileged process attachment"

depends_on "pkg-config" => :build
depends_on "valabind" => :build
depends_on "swig" => :build
Expand All @@ -46,10 +67,18 @@ class Radare2 < Formula
depends_on "openssl"
depends_on "yara"

depends_on CodesignRequirement if build.with? "code-signing"

def install
# Build Radare2 before bindings, otherwise compile = nope.
system "./configure", "--prefix=#{prefix}", "--with-openssl"
system "make", "CS_PATCHES=0"
if build.with? "code-signing"
# Brew changes the HOME directory which breaks codesign
home = `eval printf "~$USER"`
system "make", "HOME=#{home}", "-C", "binr/radare2", "osxsign"
system "make", "HOME=#{home}", "-C", "binr/radare2", "osx-sign-libs"
end
system "make", "install"

resource("extras").stage do
Expand Down

0 comments on commit fd015ea

Please sign in to comment.