summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorUniversebenzene2018-12-29 10:24:02 +0800
committerUniversebenzene2018-12-29 10:24:02 +0800
commit554dd64c6e0441f94ef2516bca42a3c108fa3682 (patch)
treef93e3f89b15535b7405644447df160b39f06efa3
parent3b45543e2bf5b2c150fdd141c9100b773f641149 (diff)
downloadaur-554dd64c6e0441f94ef2516bca42a3c108fa3682.tar.gz
Enable support for HDF, HDF5 and GraphicsMagick
-rw-r--r--.SRCINFO9
-rw-r--r--PKGBUILD67
-rw-r--r--gdl-python3.patch182
3 files changed, 229 insertions, 29 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 60103bb201d..ac822d020d8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,9 @@
# Generated by mksrcinfo v8
-# Sun Dec 16 05:53:07 UTC 2018
+# Sat Dec 29 02:04:02 UTC 2018
pkgbase = gnudatalanguage
pkgdesc = An IDL (Interactive Data Language) compatible incremental compiler (ie. runs IDL programs)
pkgver = 0.9.8
- pkgrel = 3
+ pkgrel = 4
url = http://gnudatalanguage.sourceforge.net/
arch = i686
arch = x86_64
@@ -11,20 +11,21 @@ pkgbase = gnudatalanguage
makedepends = cmake
depends = python2
depends = python2-numpy
- depends = plplot510
+ depends = plplot
depends = gsl
depends = readline
+ depends = hdf4
depends = hdf5
depends = netcdf
depends = netcdf-cxx
depends = wxgtk
depends = fftw
- depends = udunits
depends = pslib
depends = grib_api
depends = udunits
depends = eigen3
depends = libtirpc
+ depends = graphicsmagick
options = !makeflags
source = http://downloads.sourceforge.net/gnudatalanguage/gdl-0.9.8.tgz
source = gdl-tirpc.patch
diff --git a/PKGBUILD b/PKGBUILD
index 24e469d677d..eafe2c07705 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,47 +5,64 @@
pkgname=gnudatalanguage
pkgver=0.9.8
-pkgrel=3
+pkgrel=4
pkgdesc="An IDL (Interactive Data Language) compatible incremental compiler (ie. runs IDL programs)"
arch=('i686' 'x86_64')
url="http://gnudatalanguage.sourceforge.net/"
license=('GPL')
-depends=('python2' 'python2-numpy' 'plplot510' 'gsl' 'readline' 'hdf5' 'netcdf' \
- 'netcdf-cxx' 'wxgtk' 'fftw' 'udunits' 'pslib' 'grib_api' 'udunits' 'eigen3' \
- 'libtirpc')
+depends=('python2'
+ 'python2-numpy'
+ 'plplot'
+ 'gsl'
+ 'readline'
+ 'hdf4'
+ 'hdf5'
+ 'netcdf'
+ 'netcdf-cxx'
+ 'wxgtk'
+ 'fftw'
+ 'pslib'
+ 'grib_api'
+ 'udunits'
+ 'eigen3'
+ 'libtirpc'
+ 'graphicsmagick')
makedepends=('cmake')
options=('!makeflags')
-source=(http://downloads.sourceforge.net/gnudatalanguage/gdl-${pkgver}.tgz \
- gdl-tirpc.patch \
- gdl.profile)
+source=("http://downloads.sourceforge.net/gnudatalanguage/gdl-${pkgver}.tgz"
+ 'gdl-tirpc.patch'
+# 'gdl-python3.patch'
+ 'gdl.profile')
md5sums=('451532f1263bbaa8745a4ca8978533c0'
'cad6430a812e906ee7f1e15b4589dcac'
+# '9f85693d9fc9e838cba1fe03ae45f7cb'
'40aa5fd8278cd8e80425c62a577563cc')
prepare() {
- cd $srcdir/gdl-${pkgver}/
- patch -p1 < ../gdl-tirpc.patch
+ cd ${srcdir}/gdl-${pkgver}
+
+ patch -p1 < ../gdl-tirpc.patch
+# patch -Np1 -i "${srcdir}/gdl-python3.patch"
}
build() {
- cd $srcdir/gdl-${pkgver}
- if [[ -d build ]]; then
- rm -r build
- fi
- mkdir build
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=/usr -DPYTHON=YES -DPYTHONVERSION=2.7 \
- -DPYTHON_EXECUTABLE=/usr/bin/python2.7 \
- -DMAGICK=NO -DFFTW=YES -DHDF5=NO -DHDF=NO -DGRIB=YES -DUDUNITS=YES \
- -DCMAKE_C_FLAGS="-I/usr/include/ImageMagick \
- -I/usr/include/python2.7 \
- -I/usr/lib/python2.7/site-packages/numpy/core/include" ..
- make
+ cd ${srcdir}/gdl-${pkgver}
+ if [[ -d build ]]; then
+ rm -r build
+ fi
+ mkdir build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX=/usr -DPYTHON=YES -DPYTHONVERSION=2.7 \
+ -DPYTHON_EXECUTABLE=/usr/bin/python2.7 -DGRAPHICSMAGICK=ON -DMAGICK=OFF \
+ -DFFTW=ON -DHDF=ON -DHDFDIR=/opt/hdf4 -DHDF5=ON -DGRIB=ON -DUDUNITS=ON ..
+
+ make
}
package() {
- cd $srcdir/gdl-${pkgver}/build
- make DESTDIR=$pkgdir install
+ cd ${srcdir}/gdl-${pkgver}/build
+ make DESTDIR=${pkgdir} install
- install -D -m755 ../../gdl.profile $pkgdir/etc/profile.d/gdl.sh
+ install -D -m755 ../../gdl.profile "${pkgdir}/etc/profile.d/gdl.sh"
+ install -D -m644 -t "${pkgdir}/usr/share/doc/${pkgname}" ../{AUTHORS,ChangeLog,HACKING,NEWS,README}
}
diff --git a/gdl-python3.patch b/gdl-python3.patch
new file mode 100644
index 00000000000..8327f6bee2f
--- /dev/null
+++ b/gdl-python3.patch
@@ -0,0 +1,182 @@
+diff --git a/src/datatypes.cpp b/src/datatypes.cpp
+index 1a8d126..e8b08a1 100644
+--- a/src/datatypes.cpp
++++ b/src/datatypes.cpp
+@@ -18,6 +18,7 @@
+ #include "includefirst.hpp"
+
+ #if defined(USE_PYTHON) || defined(PYTHON_MODULE)
++#include <patchlevel.h>
+ #include <numpy/arrayobject.h>
+ #endif
+
+diff --git a/src/gdlpython.cpp b/src/gdlpython.cpp
+index 7835ec9..dd17598 100644
+--- a/src/gdlpython.cpp
++++ b/src/gdlpython.cpp
+@@ -32,18 +32,32 @@
+
+ using namespace std;
+
++#if PY_MAJOR_VERSION >= 3
++int PythonInit()
++{
++ if( Py_IsInitialized()) return NULL;
++#else
+ void PythonInit()
+ {
+ if( Py_IsInitialized()) return;
++#endif
+ Py_Initialize(); // signal handlers?
+
+ static int argc = 1;
++#if PY_MAJOR_VERSION >= 3
++ static wchar_t* arg0 = Py_DecodeLocale("./py/python.exe",NULL);
++ static wchar_t* argv[] = {arg0};
++#else
+ static char* arg0 = (char*)"./py/python.exe";
+ static char* argv[] = {arg0};
++#endif
+ PySys_SetArgv(argc, argv);
+
+ // http://docs.scipy.org/doc/numpy/reference/c-api.array.html#miscellaneous
+ import_array();
++#if PY_MAJOR_VERSION >= 3
++ return NULL;
++#endif
+ }
+
+ void PythonEnd()
+@@ -71,6 +85,12 @@ BaseGDL* FromPython( PyObject* pyObj)
+ {
+ if( !PyArray_Check( pyObj))
+ {
++#if PY_MAJOR_VERSION >= 3
++ if( PyUnicode_Check( pyObj))
++ {
++ return new DStringGDL( PyUnicode_AsUTF8( pyObj));
++ }
++#else
+ if( PyString_Check( pyObj))
+ {
+ return new DStringGDL( PyString_AsString( pyObj));
+@@ -79,6 +99,7 @@ BaseGDL* FromPython( PyObject* pyObj)
+ {
+ return new DLongGDL( PyInt_AsLong( pyObj));
+ }
++#endif
+ if( PyLong_Check( pyObj))
+ {
+ return new DLongGDL( PyLong_AsLong( pyObj));
+@@ -174,11 +195,19 @@ namespace lib {
+ e->Throw( "ARGV keyword must be of type STRING.");
+
+ int argc = argvS->N_Elements();
++#if PY_MAJOR_VERSION >= 3
++ wchar_t** argv = new wchar_t*[ argc];
++#else
+ char** argv = new char*[ argc];
++#endif
+
+- // pyhton copies the value -> threats it as const
++ // python copies the value -> treats it as const
+ for( int i=0; i<argc; ++i)
++#if PY_MAJOR_VERSION >= 3
++ argv[i] = Py_DecodeLocale(const_cast<char*>((*argvS)[ i].c_str()), NULL);
++#else
+ argv[i] = const_cast<char*>((*argvS)[ i].c_str());
++#endif
+
+ PySys_SetArgv(argc, argv);
+ delete[] argv;
+diff --git a/src/gdlpython.hpp b/src/gdlpython.hpp
+index 45ef436..cb53bd7 100644
+--- a/src/gdlpython.hpp
++++ b/src/gdlpython.hpp
+@@ -18,7 +18,11 @@
+ #ifndef GDLPYTHON_HPP_
+ #define GDLPYTHON_HPP_
+
++#if PY_MAJOR_VERSION >= 3
++int PythonInit();
++#else
+ void PythonInit();
++#endif
+ void PythonEnd();
+ BaseGDL* FromPython( PyObject* pyObj);
+
+diff --git a/src/pythongdl.cpp b/src/pythongdl.cpp
+index a3b5afd..e541ba5 100644
+--- a/src/pythongdl.cpp
++++ b/src/pythongdl.cpp
+@@ -191,14 +191,22 @@ bool CopyArgFromPython( vector<BaseGDL*>& parRef,
+ for( SizeT k=0; k<nKW; ++k)
+ {
+ PyDict_Next( kwDict, &dictPos, &key, &value);
++#if PY_MAJOR_VERSION >= 3
++ int keyIsString = PyUnicode_Check( key);
++#else
+ int keyIsString = PyString_Check( key);
++#endif
+ if( !keyIsString)
+ {
+ PyErr_SetString( gdlError,
+ "Keywords must be of type string");
+ return false;
+ }
++#if PY_MAJOR_VERSION >= 3
++ const char* keyChar = PyUnicode_AsUTF8( key);
++#else
+ const char* keyChar = PyString_AsString( key);
++#endif
+ string keyString = StrUpCase( keyChar);
+ int kwIx = e.GetPro()->FindKey( keyString);
+ if( kwIx == -1)
+@@ -523,6 +531,35 @@ extern "C" {
+ {NULL, NULL, 0, NULL} // Sentinel
+ };
+
++#if PY_MAJOR_VERSION >= 3
++ struct module_state {
++ PyObject *error;
++ };
++
++ #define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
++
++ static int GDL_traverse(PyObject *m, visitproc visit, void *arg) {
++ Py_VISIT(GETSTATE(m)->error);
++ return 0;
++ }
++
++ static int GDL_clear(PyObject *m) {
++ Py_CLEAR(GETSTATE(m)->error);
++ return 0;
++ }
++
++ static struct PyModuleDef moduledef = {
++ PyModuleDef_HEAD_INIT,
++ "GDL",
++ NULL,
++ sizeof(struct module_state),
++ GDLMethods,
++ NULL,
++ GDL_traverse,
++ GDL_clear,
++ NULL
++ };
++#endif
+
+ // python GDL module init function
+ PyMODINIT_FUNC initGDL()
+@@ -552,7 +589,11 @@ extern "C" {
+ }
+ SysVar::SetGDLPath( gdlPath);
+
++#if PY_MAJOR_VERSION >= 3
++ PyObject* m = PyModule_Create(&moduledef);
++#else
+ PyObject* m = Py_InitModule("GDL", GDLMethods);
++#endif
+
+ gdlError = PyErr_NewException((char*)"GDL.error", NULL, NULL);
+ Py_INCREF(gdlError);