diff options
author | Universebenzene | 2018-12-29 13:50:08 +0800 |
---|---|---|
committer | Universebenzene | 2018-12-29 13:50:08 +0800 |
commit | 9e71adde1dbc67662b3145564bdc35a35f2d7dba (patch) | |
tree | f85bf1bb1ba8643cb0a6bd91ad52019ee937fc86 | |
download | aur-9e71adde1dbc67662b3145564bdc35a35f2d7dba.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 22 | ||||
-rw-r--r-- | PKGBUILD | 56 | ||||
-rw-r--r-- | gdl-python3.patch | 182 | ||||
-rw-r--r-- | gdl-tirpc.patch | 83 | ||||
-rw-r--r-- | gdl.profile | 1 |
5 files changed, 344 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..fe5c72680003 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,22 @@ +# Generated by mksrcinfo v8 +# Sat Dec 29 05:48:10 UTC 2018 +pkgbase = python2-gdl + pkgdesc = Python interface for the GNU Data Language(GDL) + pkgver = 0.9.8 + pkgrel = 1 + url = http://gnudatalanguage.sourceforge.net/ + arch = i686 + arch = x86_64 + license = GPL + makedepends = cmake + depends = gnudatalanguage=0.9.8 + options = !makeflags + source = http://downloads.sourceforge.net/gnudatalanguage/gdl-0.9.8.tgz + source = gdl-tirpc.patch + source = gdl.profile + md5sums = 451532f1263bbaa8745a4ca8978533c0 + md5sums = cad6430a812e906ee7f1e15b4589dcac + md5sums = 40aa5fd8278cd8e80425c62a577563cc + +pkgname = python2-gdl + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..7493ab86c7da --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,56 @@ +# Maintainer: Astro Benzene <miguel@archlinux.net> +# Contributor: Miguel de Val-Borro <miguel@archlinux.net> +# Contributor: James Tappin <jtappinatgmaildotcom> +# Contributor: Orlando Garcia Feal <rodland at gmail dot com> +# Contributor: Jan Kohnert <kohni.jk at gmail dot com> + +pkgname=python2-gdl +pkgver=0.9.8 +pkgrel=1 +pkgdesc="Python interface for the GNU Data Language(GDL)" +arch=('i686' 'x86_64') +url="http://gnudatalanguage.sourceforge.net/" +license=('GPL') +depends=('gnudatalanguage=0.9.8') +makedepends=('cmake') +options=('!makeflags') +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 + # 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 -DPYTHON_MODULE=ON \ + -DGRAPHICSMAGICK=ON -DMAGICK=OFF -DFFTW=ON -DHDF=ON -DHDFDIR=/opt/hdf4 \ + -DHDF5=ON -DGRIB=ON -DUDUNITS=ON .. + + make +} + +package() { + cd ${srcdir}/gdl-${pkgver}/build + mkdir ../pkginstall + make DESTDIR=../pkginstall install + + install -D -m755 -t "${pkgdir}/usr/lib/python2.7/site-packages" ../pkginstall/usr/lib/site-python/GDL.so + install -m755 -t "${pkgdir}/usr/lib" ../pkginstall/usr/lib/libantlr.so + install -D -m644 -t "${pkgdir}/usr/share/doc/gnudatalanguage" ../PYTHON.txt +} diff --git a/gdl-python3.patch b/gdl-python3.patch new file mode 100644 index 000000000000..8327f6bee2f4 --- /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); diff --git a/gdl-tirpc.patch b/gdl-tirpc.patch new file mode 100644 index 000000000000..fbe0bcbfb7d5 --- /dev/null +++ b/gdl-tirpc.patch @@ -0,0 +1,83 @@ +diff -urN gdl-0.9.8_old/CMakeLists.txt gdl-0.9.8/CMakeLists.txt +--- gdl-0.9.8_old/CMakeLists.txt 2018-08-05 20:47:42.332868644 +0200 ++++ gdl-0.9.8/CMakeLists.txt 2018-08-05 20:52:35.440704154 +0200 +@@ -356,28 +356,42 @@ + "(suitable Fedora package: gsl-devel)") + endif(GSL_FOUND) + +-if(WIN32 AND NOT CYGWIN) +-set(CMAKE_PREFIX_PATH ${XDRDIR}) +-find_package(Xdr) +-set(HAVE_LIBXDR ${XDR_FOUND}) +-if(XDR_FOUND) +- set(LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES}) +- include_directories(${XDR_INCLUDE_DIR}) +-else(XDR_FOUND) +- message(FATAL_ERROR "bsd-xdr library is required but was not found.\n" +- "Use -DXDRDIR=DIR to specify the bsd-xdr directory tree.") +-endif(XDR_FOUND) ++if(UNIX) ++ set(CMAKE_PREFIX_PATH ${RPCDIR}) ++ find_package(RPC QUIET) ++ set(HAVE_RPC ${RPC_FOUND}) ++ if(RPC_FOUND) ++ set(LIBRARIES ${LIBRARIES} ${RPC_LIBRARIES}) ++ include_directories(${RPC_INCLUDE_DIR}) ++ else(RPC_FOUND) ++ message(FATAL_ERROR "RPC support is mandatory.\n" ++ "Note that SunRPC has been removed in glibc-2.26 and later, " ++ "while being optional in earlier versions. Consider using the " ++ "recommended and more modern libtirpc instead.\n" ++ "Use -DRPCDIR=DIR to specify the rpc directory tree.\n") ++ endif(RPC_FOUND) ++elseif(WIN32 AND NOT CYGWIN) ++ set(CMAKE_PREFIX_PATH ${XDRDIR}) ++ find_package(Xdr) ++ set(HAVE_LIBXDR ${XDR_FOUND}) ++ if(XDR_FOUND) ++ set(LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES}) ++ include_directories(${XDR_INCLUDE_DIR}) ++ else(XDR_FOUND) ++ message(FATAL_ERROR "bsd-xdr library is required but was not found.\n" ++ "Use -DXDRDIR=DIR to specify the bsd-xdr directory tree.") ++ endif(XDR_FOUND) + +-set(CMAKE_PREFIX_PATH ${PCREDIR}) +-find_package(PCRE) +-set(HAVE_LIBPCRE ${PCRE_FOUND}) +-if(PCRE_FOUND) +- set(LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES}) +- include_directories(${PCRE_INCLUDE_DIR}) +-else(PCRE_FOUND) +- message(FATAL_ERROR "pcre library is required but was not found.\n" +- "Use -DPCREDIR=DIR to specify the pcre directory tree.") +-endif(PCRE_FOUND) ++ set(CMAKE_PREFIX_PATH ${PCREDIR}) ++ find_package(PCRE) ++ set(HAVE_LIBPCRE ${PCRE_FOUND}) ++ if(PCRE_FOUND) ++ set(LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES}) ++ include_directories(${PCRE_INCLUDE_DIR}) ++ else(PCRE_FOUND) ++ message(FATAL_ERROR "pcre library is required but was not found.\n" ++ "Use -DPCREDIR=DIR to specify the pcre directory tree.") ++ endif(PCRE_FOUND) + LINK_LIBRARIES(shlwapi gnurx) + endif(WIN32 AND NOT CYGWIN) + +diff -urN gdl-0.9.8_old/CMakeModules/FindRPC.cmake gdl-0.9.8/CMakeModules/FindRPC.cmake +--- gdl-0.9.8_old/CMakeModules/FindRPC.cmake 1970-01-01 01:00:00.000000000 +0100 ++++ gdl-0.9.8/CMakeModules/FindRPC.cmake 2018-08-05 20:54:31.086701032 +0200 +@@ -0,0 +1,12 @@ ++ ++include(FindPackageHandleStandardArgs) ++find_path(RPC_INCLUDE_DIR NAMES "rpc/rpc.h" PATH_SUFFIXES "tirpc") ++ if(RPC_INCLUDE_DIR MATCHES "/tirpc/?$") ++ find_library(RPC_LIBRARY NAMES tirpc) ++ set(RPC_LIBRARIES ${RPC_LIBRARY}) ++ find_package_handle_standard_args(RPC DEFAULT_MSG RPC_INCLUDE_DIR RPC_LIBRARY RPC_LIBRARIES) ++else() ++ find_package_handle_standard_args(RPC DEFAULT_MSG RPC_INCLUDE_DIR) ++endif() ++ mark_as_advanced(RPC_INCLUDE_DIR RPC_LIBRARY RPC_LIBRARIES) ++ diff --git a/gdl.profile b/gdl.profile new file mode 100644 index 000000000000..3777162abcdf --- /dev/null +++ b/gdl.profile @@ -0,0 +1 @@ +export GDL_PATH=+/usr/share/gnudatalanguage/lib |