f6e80bdea2
New `depends_on :python` Dependency. New `depends_on :python3` Dependency. To avoid having multiple formulae with endings -py2 and -py3, we will handle support for different pythons (2.x vs. 3.x) in the same formula. Further brewed vs. external python will be transparently supported. The formula also gets a new object `python`, which is false if no Python is available or the user has disabled it. Otherwise it is defined and provides several support methods: python.site_packages # the site-packages in the formula's Cellar python.global_site_packages python.binary # the full path to the python binary python.prefix python.version python.version.major python.version.minor python.xy # => e.g. "python2.7" python.incdir # includes of python python.libdir # the python dylib library python.pkg_config_path # used internally by brew python.from_osx? python.framework? python.universal? python.pypy? python.standard_caveats # Text to set PYTHONPATH for python.from_osx? python.if3then3 # => "" for 2.x and to "3" for 3.x. Further, to avoid code duplication, `python` takes an optional block that is run twice if the formula defines depends_on :python AND :python3. python do system python, 'setup.py', "--prefix=#{prefix}" end Read more in the Homebrew wiki.
67 lines
1.9 KiB
Ruby
67 lines
1.9 KiB
Ruby
require 'formula'
|
|
|
|
class PythonWithoutPPC < Requirement
|
|
fatal true
|
|
satisfy(:build_env => false) { not archs_for_command("python").ppc? }
|
|
|
|
def message
|
|
"This software will not compile if your default Python is built with PPC support."
|
|
end
|
|
end
|
|
|
|
class Distcc < Formula
|
|
homepage 'http://code.google.com/p/distcc/'
|
|
url 'http://distcc.googlecode.com/files/distcc-3.2rc1.tar.gz'
|
|
sha1 '7cd46fe0926a3a859a516274e6ae59fa8ba0262d'
|
|
|
|
depends_on :python
|
|
depends_on PythonWithoutPPC
|
|
|
|
def install
|
|
python do
|
|
# Make sure python stuff is put into the Cellar.
|
|
# --root triggers a bug and installs into HOMEBREW_PREFIX/lib/python2.7/site-packages instead of the Cellar.
|
|
inreplace 'Makefile.in', '--root="$$DESTDIR"', ""
|
|
|
|
system "./configure", "--prefix=#{prefix}"
|
|
system "make install"
|
|
end
|
|
plist_path.write startup_plist
|
|
plist_path.chmod 0644
|
|
end
|
|
|
|
def startup_plist; <<-EOPLIST.undent
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{HOMEBREW_PREFIX}/bin/distccd</string>
|
|
<string>--daemon</string>
|
|
<string>--no-detach</string>
|
|
<string>--allow=192.168.0.1/24</string>
|
|
</array>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
</dict>
|
|
</plist>
|
|
EOPLIST
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
Use 'brew services start distcc' to start distccd automatically on login.
|
|
By default, it will allow access to all clients on 192.168.0.1/24.
|
|
EOS
|
|
end
|
|
|
|
def test
|
|
system "#{bin}/distcc"
|
|
end
|
|
end
|