Skip to content

Instantly share code, notes, and snippets.

@jasonrm
Created June 30, 2014 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jasonrm/5565bd14693389196b9a to your computer and use it in GitHub Desktop.
Save jasonrm/5565bd14693389196b9a to your computer and use it in GitHub Desktop.
require "formula"
class Globalplatform < Formula
homepage "http://sourceforge.net/p/globalplatform/wiki/Home/"
url "https://downloads.sourceforge.net/project/globalplatform/GlobalPlatform%20Library/GlobalPlatform%20Library%206.0.0/globalplatform-6.0.0.tar.gz"
sha1 "5a08bec4cbcc8caffa7c646a35600712f468553c"
resource "gppcscconnectionplugin" do
url "https://downloads.sourceforge.net/project/globalplatform/GlobalPlatform%20Library/GlobalPlatform%20Library%206.0.0/gppcscconnectionplugin-1.1.0.tar.gz"
sha1 "38eb3d739f1b75ba954f09a928a6e9db0178ea53"
end
resource "gpshell" do
url "https://downloads.sourceforge.net/project/globalplatform/GPShell/GPShell-1.4.4/gpshell-1.4.4.tar.gz"
sha1 "3efeb92263e881ff0886e73a7b790051a317df61"
end
option "with-shell", "Install gpshell"
option "with-pcsc-plugin", "Install pcsc-plugin"
option "with-brewed-openssl", "Build with Homebrew OpenSSL instead of the system version"
depends_on "pkg-config" => :build
depends_on "openssl" if build.with? "brewed-openssl"
def install
globalplatform_include = "#{include}/globalplatform"
globalplatform_lib = "#{lib}/libglobalplatform.dylib"
ENV.append "PCSCLITE_CFLAGS", "-I#{MacOS.sdk_path}/System/Library/Frameworks/PCSC.framework/Versions/A/Headers/"
args = [ "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}" ]
system "./configure", *args
system "make", "install"
resource("gppcscconnectionplugin").stage do
ENV.append "CFLAGS", "-I#{include} -I#{MacOS.sdk_path}/System/Library/Frameworks/PCSC.framework/Versions/A/Headers/"
ENV.append "GLOBALPLATFORM_CFLAGS", "-I#{globalplatform_include}"
ENV.append "GLOBALPLATFORM_LIBS", globalplatform_lib
ENV.append "DYLD_LIBRARY_PATH", lib
ENV.append "LD_LIBRARY_PATH", lib
ENV.append "LDFLAGS", "-I#{Formula.factory('openssl').include}/openssl -I#{MacOS.sdk_path}/System/Library/Frameworks/PCSC.framework/Versions/A/Headers/ -L#{lib}"
ENV.append "CPPFLAGS", "-L#{Formula.factory('openssl').lib} -L#{lib}"
system "./configure", *args
system "make", "install"
end if build.with? "pcsc-plugin" or build.with? "shell"
resource("gpshell").stage do
system "./configure", *args
system "make", "install"
end if build.with? "shell"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment