Skip to content

Commit

Permalink
Use new Requirements in formulae
Browse files Browse the repository at this point in the history
  • Loading branch information
adamv committed Mar 10, 2012
1 parent d5f0cb3 commit 939a1bb
Show file tree
Hide file tree
Showing 11 changed files with 221 additions and 120 deletions.
28 changes: 18 additions & 10 deletions Library/Formula/asymptote.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
require 'formula'

class TexInstalled < Requirement
def message; <<-EOS.undent
A TeX/LaTeX installation is required to install.
You can obtain the TeX distribution for Mac OS X from:
http:https://www.tug.org/mactex/
EOS
end
def satisfied?
which 'latex'
end
def fatal?
true
end
end

class Asymptote < Formula
homepage 'http:https://asymptote.sourceforge.net/'
url 'http:https://downloads.sourceforge.net/asymptote/asymptote-2.15.src.tgz'
md5 '1adb969a4d7b17a3ae98728d1956bd77'

depends_on TexInstalled.new

depends_on 'readline'
depends_on 'bdw-gc'

def install
unless which 'latex'
onoe <<-EOS.undent
Asymptote requires a TeX/LaTeX installation; aborting now.
You can obtain the TeX distribution for Mac OS X from
http:https://www.tug.org/mactex/
EOS
exit 1
end

texmfhome = share + 'texmf'
texmfhome = share+'texmf'

# see: https://sourceforge.net/tracker/?func=detail&aid=3486838&group_id=120000&atid=685683
inreplace 'configure', '--no-var-tracking', '' if ENV.compiler == :clang
Expand Down
26 changes: 17 additions & 9 deletions Library/Formula/auctex.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
require 'formula'

class TexInstalled < Requirement
def message; <<-EOS.undent
A TeX/LaTeX installation is required to install.
You can obtain the TeX distribution for Mac OS X from:
http:https://www.tug.org/mactex/
EOS
end
def satisfied?
which 'latex'
end
def fatal?
true
end
end

class Auctex < Formula
homepage 'http:https://ftp.gnu.org/pub/gnu/auctex'
url 'http:https://ftpmirror.gnu.org/auctex/auctex-11.86.tar.gz'
mirror 'http:https://ftp.gnu.org/gnu/auctex/auctex-11.86.tar.gz'
md5 '6bc33a67b6ac59db1aa238f3693b36d2'

depends_on TexInstalled.new

def options
[['--with-emacs=</full/path/to/emacs>', "Force a different emacs"]]
end
Expand All @@ -21,15 +38,6 @@ def which_emacs
end

def install
unless which 'latex'
onoe <<-EOS.undent
AUCTeX requires a TeX/LaTeX installation; aborting now.
You can obtain the TeX distribution for Mac OS X from
http:https://www.tug.org/mactex/
EOS
exit 1
end

# configure fails if the texmf dir is not there yet
brew_texmf = share + 'texmf'
brew_texmf.mkpath
Expand Down
45 changes: 25 additions & 20 deletions Library/Formula/dbslayer.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
require 'formula'

class MySqlInstalled < Requirement
def message; <<-EOS.undent
MySQL is required to install.
You can install this with Homebrew using:
brew install mysql-connector-c
For MySQL client libraries only.
brew install mysql
For MySQL server.
Or you can use an official installer from:
http:https://dev.mysql.com/downloads/mysql/
EOS
end
def satisfied?
which 'mysql_config'
end
def fatal?
true
end
end

class Dbslayer < Formula
homepage 'http:https://code.nytimes.com/projects/dbslayer/wiki'
url 'http:https://code.nytimes.com/downloads/dbslayer-beta-12.tgz'
version '0.12.b'
md5 'a529ea503c244d723166f78c75df3bb3'

def install
unless which 'mysql_config'
opoo "No MySQL client library detected"
puts "This formula may fail to build, see caveats for more information."
end
depends_on MySqlInstalled.new

def install
system "./configure", "--prefix=#{prefix}"
system "make"
system "make install"
end

def caveats; <<-EOS.undent
DBSlayer depends on a MySQL client library.
You can install this with Homebrew using:
brew install mysql
For MySQL server.
brew install mysql-connector-c
For MySQL client libraries only.
We don't install these for you when you install this formula, as
we don't know which datasource you intend to use.
EOS
end
end
24 changes: 18 additions & 6 deletions Library/Formula/git-hg.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
require 'formula'

class HgInstalled < Requirement
def message; <<-EOS.undent
Mercurial is required to use this software.
You can install this with Homebrew using:
brew install mercurial
Or you can use an official installer from:
http:https://mercurial.selenic.com/
EOS
end
def satisfied?
which 'hg'
end
end

class GitHg < Formula
head 'https://github.com/offbytwo/git-hg.git'
homepage 'http:https://offbytwo.com/git-hg/'

def install
unless which 'hg'
puts "You may need to install Mercurial before using this software:"
puts " brew install mercurial"
end
depends_on HgInstalled.new

def install
prefix.install Dir['*']
end
end

26 changes: 15 additions & 11 deletions Library/Formula/jstalk.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
require 'formula'

class NeedsSnowLeopard < Requirement
def satisfied?
MacOS.snow_leopard?
end

def message
"jstalk requires Mac OS X 10.6 or newer"
end
end

class Jstalk < Formula
url 'https://github.com/ccgus/jstalk.git', :tag => "v1.0.1"
homepage 'http:https://jstalk.org/'
url 'https://github.com/ccgus/jstalk.git', :tag => "v1.0.1"
version '1.0.1'

def install
if MacOS.leopard?
onoe "jstalk requires Mac OS X 10.6+"
exit 1
end
depends_on NeedsSnowLeopard.new

args = ["-configuration", "Release", "ONLY_ACTIVE_ARCH=YES"]
targets = ["JSTalk Framework", "jstalk command line", "JSTalk Editor"]

targets.each do |target|
system "xcodebuild", "-target", target, *args
def install
["JSTalk Framework", "jstalk command line", "JSTalk Editor"].each do |t|
system "xcodebuild", "-target", t, "-configuration", "Release", "ONLY_ACTIVE_ARCH=YES"
end

cd 'build/Release' do
Expand Down
26 changes: 17 additions & 9 deletions Library/Formula/lilypond.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
require 'formula'

class TexInstalled < Requirement
def message; <<-EOS.undent
A TeX/LaTeX installation is required to install.
You can obtain the TeX distribution for Mac OS X from:
http:https://www.tug.org/mactex/
EOS
end
def satisfied?
which 'mpost'
end
def fatal?
true
end
end

class Lilypond < Formula
url 'http:https://download.linuxaudio.org/lilypond/sources/v2.14/lilypond-2.14.2.tar.gz'
homepage 'http:https://lilypond.org/'
url 'http:https://download.linuxaudio.org/lilypond/sources/v2.14/lilypond-2.14.2.tar.gz'
md5 '4053a19e03181021893981280feb9aaa'

depends_on TexInstalled.new
depends_on 'pkg-config' => :build
depends_on 'gettext'
depends_on 'pango'
Expand All @@ -17,8 +33,6 @@ class Lilypond < Formula
skip_clean :all

def install
abort caveats unless which "mpost"

gs = Formula.factory('ghostscript')
system "./configure", "--prefix=#{prefix}",
"--with-ncsb-dir=#{gs.share}/ghostscript/fonts/"
Expand All @@ -27,10 +41,4 @@ def install
system "make"
system "make install"
end

def caveats; <<-EOS.undent
Lilypond requires a version of TeX, such as TeX Live or MacTeX, prior to installing.
Available at: http:https://www.tug.org/mactex/
EOS
end
end
33 changes: 24 additions & 9 deletions Library/Formula/mydumper.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
require 'formula'

class MySqlInstalled < Requirement
def message; <<-EOS.undent
MySQL is required to install.
You can install this with Homebrew using:
brew install mysql-connector-c
For MySQL client libraries only.
brew install mysql
For MySQL server.
Or you can use an official installer from:
http:https://dev.mysql.com/downloads/mysql/
EOS
end
def satisfied?
which 'mysql_config'
end
def fatal?
true
end
end

class Mydumper < Formula
homepage 'http:https://www.mydumper.org/'
url 'http:https://launchpadlibrarian.net/77098505/mydumper-0.5.1.tar.gz'
md5 'b4df42dfe23f308ab13eb6ecb73a0d21'

depends_on MySqlInstalled.new
depends_on 'pkg-config' => :build
depends_on 'cmake' => :build
depends_on 'glib'
depends_on 'pcre'

def install
unless which 'mysql_config'
opoo "`mysql_config` was not found"
puts "This software requires the MySQL client libraries."
puts "You can install them via Homebrew with one of these:"
puts " brew install mysql-connector-c"
puts " brew install mysql [--client-only]"
puts "Without the client libraries, this formula will fail to compile."
end

system "cmake #{std_cmake_parameters} ."
system "make install"
end
Expand Down
33 changes: 24 additions & 9 deletions Library/Formula/mysql-proxy.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
require 'formula'

class MySqlInstalled < Requirement
def message; <<-EOS.undent
MySQL is required to install.
You can install this with Homebrew using:
brew install mysql-connector-c
For MySQL client libraries only.
brew install mysql
For MySQL server.
Or you can use an official installer from:
http:https://dev.mysql.com/downloads/mysql/
EOS
end
def satisfied?
which 'mysql_config'
end
def fatal?
true
end
end

class MysqlProxy < Formula
url 'http:https://launchpad.net/mysql-proxy/0.8/0.8.0/+download/mysql-proxy-0.8.0.tar.gz'
homepage 'https://launchpad.net/mysql-proxy'
md5 'b6a9748d72e8db7fe3789fbdd60ff451'

depends_on MySqlInstalled.new
depends_on 'pkg-config' => :build
depends_on 'glib'
depends_on 'libevent'
depends_on 'lua'

def install
unless which 'mysql_config'
opoo "`mysql_config` was not found"
puts "This software requires the MySQL client libraries."
puts "You can install them via Homebrew with one of these:"
puts " brew install mysql-connector-c"
puts " brew install mysql [--client-only]"
puts "Without the client libraries, this formula will fail to compile."
end

system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
# Ugh, don't dump these directly into /usr/local/include.
Expand Down
Loading

0 comments on commit 939a1bb

Please sign in to comment.