diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/avogadro |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/avogadro')
-rw-r--r-- | extra/avogadro/PKGBUILD | 45 | ||||
-rw-r--r-- | extra/avogadro/fix-pycapsule.patch | 23 | ||||
-rw-r--r-- | extra/avogadro/sip-4.11.patch | 34 |
3 files changed, 102 insertions, 0 deletions
diff --git a/extra/avogadro/PKGBUILD b/extra/avogadro/PKGBUILD new file mode 100644 index 000000000..bd8023903 --- /dev/null +++ b/extra/avogadro/PKGBUILD @@ -0,0 +1,45 @@ +# $Id: PKGBUILD 111981 2011-03-02 21:41:10Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> +# Contributor: Nick B <Shirakawasuna at gmail _dot_com> + +pkgname=avogadro +pkgver=1.0.1 +pkgrel=8 +pkgdesc="An advanced molecular editor based on Qt" +arch=('i686' 'x86_64') +url="http://avogadro.openmolecules.net/wiki/Main_Page" +license=('GPL2') +depends=('eigen' 'openbabel' 'python2-qt' 'boost-libs' 'glew' 'python2-numpy') +makedepends=('cmake' 'boost') +source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2" + 'sip-4.11.patch' + 'fix-pycapsule.patch') +md5sums=('0d5c391197101f0aab7be6b59f81e6fd' + 'e78c3f96d0dc702947f75de1c094f580' + '45b0f3be5913575311e92b74a5520966') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + patch -Np1 -i ${srcdir}/sip-4.11.patch + patch -Np1 -i ${srcdir}/fix-pycapsule.patch + + cd ${srcdir} + mkdir build + cd build + + # use the cmake module in system to enable python 2.7 support + rm ../${pkgname}-${pkgver}/cmake/modules/FindPythonLibs.cmake + + cmake ../${pkgname}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +package() { + cd ${srcdir}/build + make DESTDIR=${pkgdir} install + + install -Dm644 ${srcdir}/${pkgname}-${pkgver}/cmake/modules/FindAvogadro.cmake \ + ${pkgdir}/usr/share/cmake-2.8/Modules/FindAvogadro.cmake +} diff --git a/extra/avogadro/fix-pycapsule.patch b/extra/avogadro/fix-pycapsule.patch new file mode 100644 index 000000000..de4e2ca75 --- /dev/null +++ b/extra/avogadro/fix-pycapsule.patch @@ -0,0 +1,23 @@ +--- avogadro-1.0.1/libavogadro/src/python/sip.cpp 2010-05-02 17:31:22.000000000 +0100 ++++ avogadro-1.0.1-pycapsule/libavogadro/src/python/sip.cpp 2010-11-23 19:00:09.000000000 +0000 +@@ -62,12 +62,20 @@ bool init_sip_api() + return false; + } + ++#ifdef SIP_USE_PYCAPSULE ++ if (!PyCapsule_IsValid(sip_capi_obj.ptr(), "sip._C_API")) { ++#else + if (!PyCObject_Check(sip_capi_obj.ptr())) { ++#endif + std::cout << "The _C_API object in the sip python module is invalid." << std::endl; + return false; + } + ++#ifdef SIP_USE_PYCAPSULE ++ sip_API = reinterpret_cast<const sipAPIDef*>(PyCapsule_GetPointer(sip_capi_obj.ptr(), "sip._C_API")); ++#else + sip_API = reinterpret_cast<const sipAPIDef*>(PyCObject_AsVoidPtr(sip_capi_obj.ptr())); ++#endif + + return true; + } diff --git a/extra/avogadro/sip-4.11.patch b/extra/avogadro/sip-4.11.patch new file mode 100644 index 000000000..0cd1e5b94 --- /dev/null +++ b/extra/avogadro/sip-4.11.patch @@ -0,0 +1,34 @@ +diff -ur avogadro-1.0.1/cmake/modules/PythonDeps.cmake avogadro-1.0.1-sip411/cmake/modules/PythonDeps.cmake +--- avogadro-1.0.1/cmake/modules/PythonDeps.cmake 2010-05-02 18:31:22.000000000 +0200 ++++ avogadro-1.0.1-sip411/cmake/modules/PythonDeps.cmake 2010-09-14 19:11:50.000000000 +0200 +@@ -59,10 +59,13 @@ + if (EXISTS ${PYTHON_INCLUDE_PATH}/sip.h) + message(STATUS "Found sip.h header...") + execute_process(COMMAND sip -V OUTPUT_VARIABLE SIP_VERSION) +- if (${SIP_VERSION} VERSION_GREATER "4.8") ++ if (NOT ${SIP_VERSION} VERSION_LESS "4.11") ++ message(STATUS "using sip version 4.11 or above...") ++ add_definitions( -DSIP_4_11 -DSIP_4_8 ) ++ elseif (NOT ${SIP_VERSION} VERSION_LESS "4.8") + message(STATUS "using sip version 4.8 or above...") + add_definitions( -DSIP_4_8 ) +- endif (${SIP_VERSION} VERSION_GREATER "4.8") ++ endif (NOT ${SIP_VERSION} VERSION_LESS "4.11") + else (EXISTS ${PYTHON_INCLUDE_PATH}/sip.h) + message(STATUS "sip.h header NOT found - Python support disabled") + # message(STATUS "debian/ubuntu: install the python-sip4-dev package.") +diff -ur avogadro-1.0.1/libavogadro/src/python/sip.cpp avogadro-1.0.1-sip411/libavogadro/src/python/sip.cpp +--- avogadro-1.0.1/libavogadro/src/python/sip.cpp 2010-05-02 18:31:22.000000000 +0200 ++++ avogadro-1.0.1-sip411/libavogadro/src/python/sip.cpp 2010-09-14 19:13:31.000000000 +0200 +@@ -204,7 +204,11 @@ + sipWrapper *wrapper = reinterpret_cast<sipWrapper*>(obj_ptr); + #endif + // return the C++ pointer ++#ifdef SIP_4_11 ++ return sip_API->api_get_address(wrapper); ++#else + return wrapper->u.cppPtr; ++#endif + } + + QClass_converters() |