Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.58 KB | None | 0 0
  1. require 'formula'
  2.  
  3. def complete?
  4. build.include? "complete"
  5. end
  6.  
  7. def postgres?
  8. build.include? "with-postgres"
  9. end
  10.  
  11. def mysql?
  12. build.include? "with-mysql"
  13. end
  14.  
  15. def no_python?
  16. build.include? "without-python"
  17. end
  18.  
  19. def which_python
  20. "python" + `python -c 'import sys;print(sys.version[:3])'`.strip
  21. end
  22.  
  23. def opencl?
  24. build.include? "enable-opencl"
  25. end
  26.  
  27. def armadillo?
  28. build.include? "enable-armadillo"
  29. end
  30.  
  31.  
  32. class Gdal < Formula
  33. homepage 'http://www.gdal.org/'
  34. url 'http://download.osgeo.org/gdal/gdal-1.9.2.tar.gz'
  35. sha1 '7eda6a4d735b8d6903740e0acdd702b43515e351'
  36.  
  37. head 'https://svn.osgeo.org/gdal/trunk/gdal'
  38.  
  39. option 'complete', 'Use additional Homebrew libraries to provide more drivers.'
  40. option 'with-postgres', 'Specify PostgreSQL as a dependency.'
  41. option 'with-mysql', 'Specify MySQL as a dependency.'
  42. option 'without-python', 'Build without Python support (disables a lot of tools).'
  43. option 'enable-opencl', 'Build with OpenCL acceleration.'
  44. option 'enable-armadillo', 'Build with Armadillo accelerated TPS transforms.'
  45. option 'enable-unsupported', "Allow configure to drag in any library it can find. Invoke this at your own risk."
  46.  
  47. # For creating up to date man pages.
  48. depends_on 'doxygen' => :build if build.head?
  49.  
  50. depends_on :libpng
  51.  
  52. depends_on 'jpeg'
  53. depends_on 'giflib'
  54. depends_on 'proj'
  55. depends_on 'geos'
  56. depends_on 'libtiff'
  57. depends_on 'libgeotiff'
  58. depends_on 'sqlite' # To ensure compatibility with SpatiaLite.
  59. depends_on 'freexl'
  60. depends_on 'libspatialite'
  61.  
  62. depends_on "postgresql" if postgres?
  63. depends_on "mysql" if mysql?
  64.  
  65. # Without Numpy, the Python bindings can't deal with raster data.
  66. depends_on 'numpy' => :python unless no_python?
  67.  
  68. depends_on 'armadillo' if armadillo?
  69.  
  70. if complete?
  71. # Raster libraries
  72. depends_on "netcdf" # Also brings in HDF5
  73. depends_on "jasper"
  74. depends_on "poppler"
  75. depends_on "webp"
  76. depends_on "cfitsio"
  77. depends_on "epsilon"
  78. depends_on "libdap"
  79. # Fix a bug in LibDAP detection and patch FileGDB support
  80. def patches; DATA; end unless build.head?
  81.  
  82. # Vector libraries
  83. depends_on "unixodbc" # OS X version is not complete enough
  84. depends_on "xerces-c"
  85.  
  86. # Other libraries
  87. depends_on "xz" # get liblzma compression algorithm library from XZutils
  88. end
  89.  
  90. def options
  91. [
  92. ['--complete', 'Use additional Homebrew libraries to provide more drivers.'],
  93. ['--with-postgres', 'Specify PostgreSQL as a dependency.'],
  94. ['--with-mysql', 'Specify MySQL as a dependency.'],
  95. ['--without-python', 'Build without Python support (disables a lot of tools).'],
  96. ['--enable-opencl', 'Build with OpenCL acceleration.'],
  97. ['--enable-armadillo', 'Build with Armadillo accelerated TPS transforms.']
  98. ]
  99. end
  100.  
  101. def get_configure_args
  102. args = [
  103. # Base configuration.
  104. "--prefix=#{prefix}",
  105. "--mandir=#{man}",
  106. "--disable-debug",
  107. "--with-local=#{prefix}",
  108. "--with-threads",
  109. "--with-libtool",
  110.  
  111. # GDAL native backends.
  112. "--with-pcraster=internal",
  113. "--with-pcidsk=internal",
  114. "--with-bsb",
  115. "--with-grib",
  116. "--with-pam",
  117.  
  118. # Backends supported by OS X.
  119. "--with-libiconv-prefix=/usr",
  120. "--with-libz=/usr",
  121. "--with-png=#{(MacOS.version >= :mountain_lion) ? HOMEBREW_PREFIX : MacOS::X11.prefix}",
  122. "--with-expat=/usr",
  123. "--with-curl=/usr/bin/curl-config",
  124.  
  125. # Default Homebrew backends.
  126. "--with-jpeg=#{HOMEBREW_PREFIX}",
  127. "--with-jpeg12",
  128. "--with-libtiff=#{HOMEBREW_PREFIX}",
  129. "--with-geotiff=#{HOMEBREW_PREFIX}",
  130. "--with-gif=#{HOMEBREW_PREFIX}",
  131. "--with-sqlite3=#{HOMEBREW_PREFIX}",
  132. "--with-freexl=#{HOMEBREW_PREFIX}",
  133. "--with-spatialite=#{HOMEBREW_PREFIX}",
  134. "--with-geos=#{HOMEBREW_PREFIX}/bin/geos-config",
  135.  
  136. # GRASS backend explicitly disabled. Creates a chicken-and-egg problem.
  137. # Should be installed separately after GRASS installation using the
  138. # official GDAL GRASS plugin.
  139. "--without-grass",
  140. "--without-libgrass"
  141. ]
  142.  
  143. # Optional Homebrew packages supporting additional formats.
  144. supported_backends = %w[
  145. liblzma
  146. fgdb
  147. cfitsio
  148. hdf5
  149. netcdf
  150. jasper
  151. xerces
  152. odbc
  153. dods-root
  154. epsilon
  155. webp
  156. libkml
  157. poppler
  158. ]
  159. if complete?
  160. supported_backends.delete 'liblzma'
  161. supported_backends.delete 'fgdb'
  162. args << '--with-liblzma=yes'
  163. args << '--with-fgdb=/Users/jctull/sources/FileGDB_API'
  164. args.concat supported_backends.map {|b| '--with-' + b + '=' + HOMEBREW_PREFIX}
  165. else
  166. args.concat supported_backends.map {|b| '--without-' + b} unless build.include? 'enable-unsupported'
  167. end
  168.  
  169. # The following libraries are either proprietary, not available for public
  170. # download or have no stable version in the Homebrew core that is
  171. # compatible with GDAL. Interested users will have to install such software
  172. # manually and most likely have to tweak the install routine.
  173. #
  174. # Podofo is disabled because Poppler provides the same functionality and
  175. # then some.
  176. unsupported_backends = %w[
  177. gta
  178. ogdi
  179. fme
  180. hdf4
  181. openjpeg
  182. ecw
  183. kakadu
  184. mrsid
  185. jp2mrsid
  186. mrsid_lidar
  187. msg
  188. oci
  189. ingres
  190. dwgdirect
  191. idb
  192. sde
  193. podofo
  194. rasdaman
  195. ]
  196. args.concat unsupported_backends.map {|b| '--without-' + b} unless build.include? 'enable-unsupported'
  197.  
  198. # Database support.
  199. args << (postgres? ? "--with-pg=#{HOMEBREW_PREFIX}/bin/pg_config" : '--without-pg')
  200. args << (mysql? ? "--with-mysql=#{HOMEBREW_PREFIX}/bin/mysql_config" : '--without-mysql')
  201.  
  202. # Python is installed manually to ensure everything is properly sandboxed.
  203. args << '--without-python'
  204.  
  205. # Scripting APIs that have not been re-worked to respect Homebrew prefixes.
  206. #
  207. # Currently disabled as they install willy-nilly into locations outside of
  208. # the Homebrew prefix. Enable if you feel like it, but uninstallation may be
  209. # a manual affair.
  210. #
  211. # TODO: Fix installation of script bindings so they install into the
  212. # Homebrew prefix.
  213. args << "--without-perl"
  214. args << "--without-php"
  215. args << "--without-ruby"
  216.  
  217. args << (opencl? ? '--with-opencl' : '--without-opencl')
  218. args << (armadillo? ? '--with-armadillo=yes' : '--with-armadillo=no')
  219.  
  220. return args
  221. end
  222.  
  223. def install
  224. # Linking flags for SQLite are not added at a critical moment when the GDAL
  225. # library is being assembled. This causes the build to fail due to missing
  226. # symbols.
  227. #
  228. # Fortunately, this can be remedied using LDFLAGS.
  229. ENV.append 'LDFLAGS', '-lsqlite3'
  230. # Needed by libdap.
  231. ENV.append 'CPPFLAGS', '-I/usr/include/libxml2' if complete?
  232.  
  233. # Reset ARCHFLAGS to match how we build.
  234. if MacOS.prefer_64_bit?
  235. ENV['ARCHFLAGS'] = "-arch x86_64"
  236. else
  237. ENV['ARCHFLAGS'] = "-arch i386"
  238. end
  239.  
  240. system "echo 'It is necessary to use --env=std.'" unless build.head?
  241. system "./autogen.sh" unless build.head?
  242. system "./configure", *get_configure_args
  243. system "make"
  244. system "make install"
  245.  
  246. unless no_python?
  247. # If setuptools happens to be installed, setup.py will cowardly refuse to
  248. # install to anywhere that is not on the PYTHONPATH.
  249. #
  250. # Really setuptools, we're all consenting adults here...
  251. python_lib = lib + which_python + 'site-packages'
  252. ENV.append 'PYTHONPATH', python_lib
  253.  
  254. # setuptools is also apparently incapable of making the directory it's
  255. # self
  256. python_lib.mkpath
  257.  
  258. # `python-config` may try to talk us into building bindings for more
  259. # architectures than we really should.
  260. if MacOS.prefer_64_bit?
  261. ENV.append_to_cflags '-arch x86_64'
  262. else
  263. ENV.append_to_cflags '-arch i386'
  264. end
  265.  
  266. cd 'swig/python' do
  267. system "python", "setup.py", "install_lib", "--install-dir=#{python_lib}"
  268. bin.install Dir['scripts/*']
  269. end
  270. end
  271.  
  272. system 'make', 'man' if build.head?
  273. system 'make', 'install-man'
  274. # Clean up any stray doxygen files.
  275. Dir[bin + '*.dox'].each { |p| rm p }
  276. end
  277.  
  278. unless no_python?
  279. def caveats
  280. <<-EOS
  281. This version of GDAL was built with Python support. In addition to providing
  282. modules that makes GDAL functions available to Python scripts, the Python
  283. binding provides ~18 additional command line tools.
  284.  
  285. Unless you are using Homebrew's Python, both the bindings and the
  286. additional tools will be unusable unless the following directory is added to
  287. the PYTHONPATH:
  288.  
  289. #{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages
  290. EOS
  291. end
  292. end
  293. end
  294.  
  295. __END__
  296. Fix test for LibDAP >= 3.10.
  297.  
  298.  
  299. diff --git a/configure b/configure
  300. index 997bbbf..a1928d5 100755
  301. --- a/configure
  302. +++ b/configure
  303. @@ -24197,7 +24197,7 @@ else
  304. rm -f islibdappost310.*
  305. echo '#include "Connect.h"' > islibdappost310.cpp
  306. echo 'int main(int argc, char** argv) { return 0; } ' >> islibdappost310.cpp
  307. -if test -z "`${CXX} islibdappost310.cpp -c ${DODS_INC} 2>&1`" ; then
  308. +if test -z "`${CXX} islibdappost310.cpp -c ${DODS_INC} ${CPPFLAGS} 2>&1`" ; then
  309. DODS_INC="$DODS_INC -DLIBDAP_310 -DLIBDAP_39"
  310. { $as_echo "$as_me:${as_lineno-$LINENO}: result: libdap >= 3.10" >&5
  311. $as_echo "libdap >= 3.10" >&6; }
  312.  
  313. diff --git a/configure.in b/configure.in
  314. index a3ca3a1..6c6205e 100644
  315. --- a/configure.in
  316. +++ b/configure.in
  317. @@ -1649,14 +1649,14 @@ else
  318.  
  319. HAVE_OPENJPEG=yes
  320. LIBS="-L$with_openjpeg -L$with_openjpeg/lib -lopenjpeg $LIBS"
  321. - if test -r $with_openjpeg/include/openjpeg-2.0/openjpeg.h ; then
  322. - EXTRA_INCLUDES="-I$with_openjpeg/include/openjpeg-2.0 $EXTRA_INCLUDES"
  323. + if test -r $with_openjpeg/include/openjpeg-1.99/openjpeg.h ; then
  324. + EXTRA_INCLUDES="-I$with_openjpeg/include/openjpeg-1.99 $EXTRA_INCLUDES"
  325. elif test -r $with_openjpeg/include/openjpeg.h ; then
  326. EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
  327. elif test -r $with_openjpeg/openjpeg.h ; then
  328. EXTRA_INCLUDES="-I$with_openjpeg $EXTRA_INCLUDES"
  329. else
  330. - AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include or $with_openjpeg/include/openjpeg-2.0])
  331. + AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include or $with_openjpeg/include/openjpeg-1.99])
  332. fi
  333.  
  334. AC_CHECK_LIB(openjpeg,opj_decode_tile_data,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
  335. @@ -1710,15 +1710,39 @@ elif test "$with_fgdb" = "yes" -o "$with_fgdb" = "" ; then
  336. rm -f testfgdb
  337.  
  338. else
  339. + case "${host_os}" in
  340. + *darwin*)
  341. + AC_MSG_CHECKING([for libFileGDBAPI.dylib in in $with_fgdb/lib])
  342. + FGDB_ENABLED=yes
  343. + if test -r $with_fgdb/lib/libFileGDBAPI.dylib ; then
  344. + AC_MSG_RESULT([found.])
  345.  
  346. - AC_MSG_CHECKING([for libFileGDBAPI.so in in $with_fgdb/lib])
  347. - FGDB_ENABLED=yes
  348. - if test -r $with_fgdb/lib/libFileGDBAPI.so ; then
  349. - AC_MSG_RESULT([found.])
  350. - FGDB_LIB="-L$with_fgdb/lib -lFileGDBAPI"
  351. - else
  352. - AC_MSG_ERROR([not found.])
  353. - fi
  354. + FGDB_LIB="-L$with_fgdb/lib -lFileGDBAPI -lfgdbunixrtl"
  355. + else
  356. + AC_MSG_ERROR([not found.])
  357. + fi
  358. + ;;
  359. +
  360. + *)
  361. + AC_MSG_CHECKING([for libFileGDBAPI.so in in $with_fgdb/lib])
  362. + FGDB_ENABLED=yes
  363. + if test -r $with_fgdb/lib/libFileGDBAPI.so ; then
  364. + AC_MSG_RESULT([found.])
  365. + FGDB_LIB="-L$with_fgdb/lib -lFileGDBAPI -lfgdblinuxrtl"
  366. + else
  367. + AC_MSG_ERROR([not found.])
  368. + fi
  369. + ;;
  370. + esac
  371. +
  372. + #AC_MSG_CHECKING([for libFileGDBAPI.so in in $with_fgdb/lib])
  373. + #FGDB_ENABLED=yes
  374. + #if test -r $with_fgdb/lib/libFileGDBAPI.so ; then
  375. + #AC_MSG_RESULT([found.])
  376. + #FGDB_LIB="-L$with_fgdb/lib -lFileGDBAPI"
  377. + #else
  378. + #AC_MSG_ERROR([not found.])
  379. + #fi
  380.  
  381. AC_MSG_CHECKING([for FileGDBAPI.h in $with_fgdb/include])
  382. if test -r $with_fgdb/include/FileGDBAPI.h ; then
  383. @@ -3415,6 +3453,10 @@ dnl RHEL6
  384. elif test -d /usr/lib/jvm/java-openjdk; then
  385. with_java="/usr/lib/jvm/java-openjdk"
  386.  
  387. +dnl OS X and possibly others
  388. + elif test -d `/usr/libexec/java_home`; then
  389. + with_java=`/usr/libexec/java_home`
  390. +
  391. dnl elif test -d /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers; then
  392. dnl JAVA_INC="-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"
  393.  
  394. @@ -3447,6 +3489,10 @@ elif test "x$with_java" != "x" -a "x$with_java" != "xno"; then
  395. JAVA_HOME="$with_java"
  396. JAVA_INC="-I$JAVA_HOME/include -I$JAVA_HOME/include/freebsd"
  397. AC_MSG_RESULT([yes])
  398. + elif test -d "$with_java/include"; then
  399. + JAVA_HOME="$with_java"
  400. + JAVA_INC="-I$JAVA_HOME/include"
  401. + AC_MSG_RESULT([yes])
  402. else
  403. AC_MSG_ERROR("Cannot find $with_java/include/linux or solaris or freebsd directory.")
  404. fi
  405. @@ -3483,10 +3529,27 @@ if test "$with_mdb" = "yes" ; then
  406.  
  407. if test "x$with_jvm_lib" != "x"; then
  408. if test -d "$with_jvm_lib"; then
  409. - saved_LDFLAGS="$LDFLAGS"
  410. - LDFLAGS="$LDFLAGS -L$with_jvm_lib"
  411. - AC_CHECK_LIB(jvm,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,)
  412. - LDFLAGS="$saved_LDFLAGS"
  413. +
  414. + dnl OS X needs a check against the JavaVM.framework
  415. + if test -d /Library/Java/JavaVirtualMachines; then
  416. + saved_CFLAGS="$CFLAGS"
  417. + CFLAGS="$CFLAGS $ABI_FLAGS $JAVA_INC"
  418. + LIBS="$LIBS -framework JavaVM"
  419. + AC_CACHE_CHECK([for JNI_CreateJavaVM in JavaVM framework],
  420. + [HAS_LIB_JVM],
  421. + [AC_TRY_LINK([#include <jni.h>],
  422. + [JNI_CreateJavaVM(0, 0, 0);],
  423. + HAS_LIB_JVM=yes,
  424. + HAS_LIB_JVM=no)])
  425. +
  426. + CFLAGS="$saved_CFLAGS"
  427. + elif test "x$OS_TYPE" = "xUNIX" ; then
  428. + saved_LDFLAGS="$LDFLAGS"
  429. + LDFLAGS="$LDFLAGS -L$with_jvm_lib"
  430. + AC_CHECK_LIB(jvm,JNI_CreateJavaVM,HAS_LIB_JVM=yes,HAS_LIB_JVM=no,)
  431. + LDFLAGS="$saved_LDFLAGS"
  432. + fi
  433. +
  434. if test "$HAS_LIB_JVM" = "yes"; then
  435. JVM_LIB="-L$with_jvm_lib -ljvm"
  436. if test "x$with_jvm_lib_add_rpath" = "xyes"; then
  437. @@ -3718,4 +3781,3 @@ LOC_MSG([ enable pthread support: ${PTHREAD_ENABLED}])
  438. LOC_MSG([ enable POSIX iconv support:${am_cv_func_iconv}])
  439. LOC_MSG([ hide internal symbols: ${HAVE_HIDE_INTERNAL_SYMBOLS}])
  440. LOC_MSG()
  441. -
  442. diff --git a/frmts/dods/dodsdataset2.cpp b/frmts/dods/dodsdataset2.cpp
  443. index 0efa1bb..6f63874 100644
  444. --- a/frmts/dods/dodsdataset2.cpp
  445. +++ b/frmts/dods/dodsdataset2.cpp
  446. @@ -50,13 +50,9 @@
  447. #include <Sequence.h>
  448. #include <Grid.h>
  449.  
  450. -#ifdef LIBDAP_310
  451. /* AISConnect.h/AISConnect class was renamed to Connect.h/Connect in libdap 3.10 */
  452. #include <Connect.h>
  453. #define AISConnect Connect
  454. -#else
  455. -#include <AISConnect.h>
  456. -#endif
  457.  
  458. #include <DDS.h>
  459. #include <DAS.h>
  460. diff --git a/ogr/ogrsf_frmts/dods/ogr_dods.h b/ogr/ogrsf_frmts/dods/ogr_dods.h
  461. index 99f269e..ba114a0 100644
  462. --- a/ogr/ogrsf_frmts/dods/ogr_dods.h
  463. +++ b/ogr/ogrsf_frmts/dods/ogr_dods.h
  464. @@ -61,13 +61,9 @@
  465. #include <Sequence.h>
  466. #include <Grid.h>
  467.  
  468. -#ifdef LIBDAP_310
  469. /* AISConnect.h/AISConnect class was renamed to Connect.h/Connect in libdap 3.10 */
  470. #include <Connect.h>
  471. #define AISConnect Connect
  472. -#else
  473. -#include <AISConnect.h>
  474. -#endif
  475.  
  476. #include <DDS.h>
  477. #include <DAS.h>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement