PageRenderTime 44ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Library/Formula/gd.rb

https://bitbucket.org/mgrimes/homebrew
Ruby | 55 lines | 44 code | 8 blank | 3 comment | 1 complexity | 817323a479292fb17e6a50566fa87298 MD5 | raw file
  1. require 'formula'
  2. class Gd < Formula
  3. homepage 'https://bitbucket.org/libgd/gd-libgd'
  4. # libgd doesn't have their latest (non-alpha) version.
  5. # When they do release a stable version, use that url.
  6. # Watch this space: http://libgd.bitbucket.org/pages/downloads.html
  7. url 'http://download.osgeo.org/mapserver/libgd/gd-2.0.36RC1.tar.gz'
  8. sha1 '21cf2ec93fd80836fc0cb4741201f7cc5440819a'
  9. head 'https://bitbucket.org/libgd/gd-libgd', :using => :hg
  10. depends_on :libpng => :recommended
  11. depends_on 'jpeg' => :recommended
  12. depends_on 'giflib' => :optional
  13. depends_on :freetype => :optional
  14. fails_with :llvm do
  15. build 2326
  16. cause "Undefined symbols when linking"
  17. end
  18. def install
  19. args = ["--prefix=#{prefix}"]
  20. args << "--without-freetype" unless build.with? 'freetype'
  21. system "./configure", *args
  22. system "make install"
  23. (lib+'pkgconfig/gdlib.pc').write pc_file
  24. end
  25. def pc_file; <<-EOS.undent
  26. prefix=#{opt_prefix}
  27. exec_prefix=${prefix}
  28. libdir=/${exec_prefix}/lib
  29. includedir=/${prefix}/include
  30. bindir=/${prefix}/bin
  31. ldflags= -L/${prefix}/lib
  32. Name: gd
  33. Description: A graphics library for quick creation of PNG or JPEG images
  34. Version: #{version}
  35. Requires:
  36. Libs: -L${libdir} -lgd
  37. Libs.private: -ljpeg -lpng12 -lz -lm
  38. Cflags: -I${includedir}
  39. EOS
  40. end
  41. test do
  42. system "#{bin}/pngtogd", \
  43. "/System/Library/Frameworks/SecurityInterface.framework/Versions/A/Resources/Key_Large.png", \
  44. "gd_test.gd"
  45. system "#{bin}/gdtopng", "gd_test.gd", "gd_test.png"
  46. end
  47. end