aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/platypus.rb
blob: 30846aea81ffb9e48f1722821e3d60948100b964 (plain)
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
require 'formula'

class Platypus < Formula
  url 'http://www.sveinbjorn.org/files/software/platypus.src.zip'
  version '4.4'
  homepage 'http://www.sveinbjorn.org/platypus'
  md5 'e6fe23f7037a873394b70bcc62843940'

  def install
    # Fix paths
    inreplace ["CommonDefs.h", "CommandLineTool/platypus.1"] do |s|
      s.gsub! "/usr/local", prefix
    end

    # Build main command-line binary, we don't care about the App
    system "xcodebuild", "-target", "platypus", "-configuration", "Deployment", "ONLY_ACTIVE_ARCH=YES", "SYMROOT=build", "SDKROOT=", "MACOSX_DEPLOYMENT_TARGET="

    # Build application sub-binary needed by command-line utility
    system "xcodebuild", "-target", "ScriptExec", "-configuration", "Deployment", "ONLY_ACTIVE_ARCH=YES", "SYMROOT=build", "SDKROOT=", "MACOSX_DEPLOYMENT_TARGET="

    # Install binary and man page
    bin.install "build/Deployment/platypus"
    Dir.chdir('CommandLineTool') do
      man1.install "platypus.1"
    end
    # Install sub-binary parts to share
    Dir.chdir('build/Deployment/ScriptExec.app/Contents') do
      (share + 'platypus').install "MacOS/ScriptExec"
      (share + 'platypus/MainMenu.nib').install "Resources/English.lproj/MainMenu.nib/keyedobjects.nib"
    end

    # Install icons to share
    (share + 'platypus').install 'Icons/PlatypusDefault.icns'

    # Write version info to share
    (share + 'platypus/Version').write version
  end
end