PageRenderTime 57ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/Library/Formula/spatialite-gui.rb

https://github.com/barisbalic/homebrew
Ruby | 95 lines | 78 code | 14 blank | 3 comment | 1 complexity | b764dd74341bc72e021571e7b114ebe1 MD5 | raw file
  1. require 'formula'
  2. class SpatialiteGui < Formula
  3. homepage 'https://www.gaia-gis.it/fossil/spatialite_gui/index'
  4. url 'http://www.gaia-gis.it/gaia-sins/spatialite-gui-sources/spatialite_gui-1.5.0-stable.tar.gz'
  5. sha1 'b8cfe3def8c77928f7c9fcc86bae3c99179fa486'
  6. devel do
  7. url 'http://www.gaia-gis.it/gaia-sins/spatialite-gui-sources/spatialite_gui-1.7.1.tar.gz'
  8. sha1 '3b9d88e84ffa5a4f913cf74b098532c2cd15398f'
  9. depends_on 'libxml2'
  10. end
  11. depends_on 'pkg-config' => :build
  12. depends_on 'libspatialite'
  13. depends_on 'libgaiagraphics'
  14. depends_on 'wxmac'
  15. depends_on 'geos'
  16. depends_on 'proj'
  17. depends_on 'freexl'
  18. depends_on 'sqlite'
  19. def patches
  20. patch_set = {
  21. :p1 => DATA
  22. }
  23. # Compatibility fix for wxWidgets 2.9.x. Remove on next release.
  24. patch_set[:p0] = 'https://www.gaia-gis.it/fossil/spatialite_gui/vpatch?from=d8416d26358a24dc&to=b5b920d8d654dd0e' unless build.devel?
  25. patch_set
  26. end
  27. def install
  28. system "./configure", "--prefix=#{prefix}"
  29. system "make install"
  30. end
  31. end
  32. __END__
  33. For some strange reason, wxWidgets does not take the required steps to register
  34. programs as GUI apps like other toolkits do. This necessitates the creation of
  35. an app bundle on OS X.
  36. This clever hack sidesteps the headache of packing simple programs into app
  37. bundles:
  38. http://www.miscdebris.net/blog/2010/03/30/
  39. solution-for-my-mac-os-x-gui-program-doesnt-get-focus-if-its-outside-an-application-bundle
  40. ---
  41. Main.cpp | 21 +++++++++++++++++++++
  42. 1 files changed, 21 insertions(+), 0 deletions(-)
  43. diff --git a/Main.cpp b/Main.cpp
  44. index a857e8a..9c90afb 100644
  45. --- a/Main.cpp
  46. +++ b/Main.cpp
  47. @@ -71,6 +71,12 @@
  48. #define unlink _unlink
  49. #endif
  50. +#ifdef __WXMAC__
  51. +// Allow the program to run and recieve focus without creating an app bundle.
  52. +#include <Carbon/Carbon.h>
  53. +extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
  54. +#endif
  55. +
  56. IMPLEMENT_APP(MyApp)
  57. bool MyApp::OnInit()
  58. {
  59. @@ -86,6 +92,21 @@ IMPLEMENT_APP(MyApp)
  60. frame->Show(true);
  61. SetTopWindow(frame);
  62. frame->LoadConfig(path);
  63. +
  64. +#ifdef __WXMAC__
  65. + // Acquire the necessary resources to run as a GUI app without being inside
  66. + // an app bundle.
  67. + //
  68. + // Credit for this hack goes to:
  69. + //
  70. + // http://www.miscdebris.net/blog/2010/03/30/solution-for-my-mac-os-x-gui-program-doesnt-get-focus-if-its-outside-an-application-bundle
  71. + ProcessSerialNumber psn;
  72. +
  73. + GetCurrentProcess( &psn );
  74. + CPSEnableForegroundOperation( &psn );
  75. + SetFrontProcess( &psn );
  76. +#endif
  77. +
  78. return true;
  79. }
  80. --
  81. 1.7.9