aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libnfc.rb
diff options
context:
space:
mode:
authorMatt Oakes2012-12-26 18:03:21 +0000
committerAdam Vandenberg2013-01-14 06:55:38 -0800
commit3e9fb745d3039165c09a15c6d9c26b3ad33effe6 (patch)
treefc82bc2c6f1c95a21e0813d52cbc06cc49dd5dea /Library/Formula/libnfc.rb
parent8361c218c8b4a6b955fd142adc7f0b33c76f2dfa (diff)
downloadhomebrew-3e9fb745d3039165c09a15c6d9c26b3ad33effe6.tar.bz2
libnfc: add patch for OS X
Closes #16758. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/libnfc.rb')
-rw-r--r--Library/Formula/libnfc.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/Library/Formula/libnfc.rb b/Library/Formula/libnfc.rb
index bd9906a33..7d412cc70 100644
--- a/Library/Formula/libnfc.rb
+++ b/Library/Formula/libnfc.rb
@@ -5,9 +5,17 @@ class Libnfc < Formula
url 'http://libnfc.googlecode.com/files/libnfc-1.6.0-rc1.tar.gz'
sha1 'bbff76269120c3a531eb96b7ceb96fd36c0071a1'
+ option 'with-pn532_uart', 'Enable PN532 UART support'
+
+ depends_on 'pkg-config' => :build
depends_on 'libusb-compat'
- option 'with-pn532_uart', 'Enable PN532 UART support'
+ # Fixes the lack of MIN macro in sys/param.h on OS X which causes the formula not to compile
+ # Reported upstream:
+ # https://groups.google.com/forum/?fromgroups=#!topic/libnfc-devel/K0cwIdPuqJg
+ def patches
+ DATA
+ end
def install
args = %W[
@@ -25,3 +33,25 @@ class Libnfc < Formula
system "make install"
end
end
+
+__END__
+diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h
+index ec9e2fc..41797b2 100644
+--- a/libnfc/nfc-internal.h
++++ b/libnfc/nfc-internal.h
+@@ -33,6 +33,15 @@
+
+ #include "log.h"
+
++// Patch to compile on OS X
++// Tested on OS X Mountain Lion
++#ifndef MAX
++#define MAX(a,b) (((a) > (b)) ? (a) : (b))
++#endif
++#ifndef MIN
++#define MIN(a,b) (((a) < (b)) ? (a) : (b))
++#endif
++
+ /**
+ * @macro HAL
+ * @brief Execute corresponding driver function if exists.