PageRenderTime 79ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/Library/Formula/gd.rb

https://bitbucket.org/bathtub/tigerbrew
Ruby | 58 lines | 46 code | 9 blank | 3 comment | 2 complexity | 48d68838aa4df0adb44038e47b521e7b 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. option :universal
  11. depends_on :libpng => :recommended
  12. depends_on 'jpeg' => :recommended
  13. depends_on 'giflib' => :optional
  14. depends_on :freetype => :optional
  15. fails_with :llvm do
  16. build 2326
  17. cause "Undefined symbols when linking"
  18. end
  19. def install
  20. ENV.universal_binary if build.universal?
  21. args = ["--prefix=#{prefix}"]
  22. args << "--without-freetype" unless build.with? 'freetype'
  23. system "./configure", *args
  24. system "make install"
  25. (lib+'pkgconfig/gdlib.pc').write pc_file
  26. end
  27. def pc_file; <<-EOS.undent
  28. prefix=#{opt_prefix}
  29. exec_prefix=${prefix}
  30. libdir=/${exec_prefix}/lib
  31. includedir=/${prefix}/include
  32. bindir=/${prefix}/bin
  33. ldflags= -L/${prefix}/lib
  34. Name: gd
  35. Description: A graphics library for quick creation of PNG or JPEG images
  36. Version: #{version}
  37. Requires:
  38. Libs: -L${libdir} -lgd
  39. Libs.private: -ljpeg -lpng12 -lz -lm
  40. Cflags: -I${includedir}
  41. EOS
  42. end
  43. test do
  44. system "#{bin}/pngtogd", \
  45. "/System/Library/Frameworks/SecurityInterface.framework/Versions/A/Resources/Key_Large.png", \
  46. "gd_test.gd"
  47. system "#{bin}/gdtopng", "gd_test.gd", "gd_test.png"
  48. end
  49. end