From d1abc701c7bf4b5ed0de91b5f7600f1f051babd3 Mon Sep 17 00:00:00 2001 From: Adam Beckmeyer Date: Wed, 13 Jun 2018 21:23:22 -0400 Subject: [PATCH] New package: olm-2.2.2 --- srcpkgs/olm-devel | 1 + srcpkgs/olm-python | 1 + srcpkgs/olm-python3 | 1 + srcpkgs/olm/patches/python-find-olm.patch | 19 ++++++++ srcpkgs/olm/template | 58 +++++++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 120000 srcpkgs/olm-devel create mode 120000 srcpkgs/olm-python create mode 120000 srcpkgs/olm-python3 create mode 100644 srcpkgs/olm/patches/python-find-olm.patch create mode 100644 srcpkgs/olm/template diff --git a/srcpkgs/olm-devel b/srcpkgs/olm-devel new file mode 120000 index 00000000000..38ebca23ad7 --- /dev/null +++ b/srcpkgs/olm-devel @@ -0,0 +1 @@ +olm \ No newline at end of file diff --git a/srcpkgs/olm-python b/srcpkgs/olm-python new file mode 120000 index 00000000000..38ebca23ad7 --- /dev/null +++ b/srcpkgs/olm-python @@ -0,0 +1 @@ +olm \ No newline at end of file diff --git a/srcpkgs/olm-python3 b/srcpkgs/olm-python3 new file mode 120000 index 00000000000..38ebca23ad7 --- /dev/null +++ b/srcpkgs/olm-python3 @@ -0,0 +1 @@ +olm \ No newline at end of file diff --git a/srcpkgs/olm/patches/python-find-olm.patch b/srcpkgs/olm/patches/python-find-olm.patch new file mode 100644 index 00000000000..a13f04fb3ad --- /dev/null +++ b/srcpkgs/olm/patches/python-find-olm.patch @@ -0,0 +1,19 @@ +--- python/olm/_base.py ++++ python/olm/_base.py +@@ -1,14 +1,13 @@ + import os.path + + from ctypes import * ++from ctypes import util + + def read_random(n): + with open("/dev/urandom", "rb") as f: + return f.read(n) + +-lib = cdll.LoadLibrary(os.path.join( +- os.path.dirname(__file__), "..", "..", "build", "libolm.so.2") +-) ++lib = cdll.LoadLibrary(util.find_library("olm")) + + lib.olm_error.argtypes = [] + lib.olm_error.restypes = c_size_t diff --git a/srcpkgs/olm/template b/srcpkgs/olm/template new file mode 100644 index 00000000000..0aef7d179aa --- /dev/null +++ b/srcpkgs/olm/template @@ -0,0 +1,58 @@ +# Template file for 'olm' +pkgname=olm +version=2.2.2 +revision=1 +build_style=gnu-makefile +make_check_target=test +hostmakedepends="python-devel python3-devel" +makedepends="python-devel python3-devel" +short_desc="An implementation of the Double Ratchet cryptographic ratchet" +maintainer="Adam Beckmeyer " +license="Apache-2.0" +homepage="https://git.matrix.org/git/olm/about/" +distfiles="https://git.matrix.org/git/olm/snapshot/${pkgname}-${version}.tar.gz" +checksum=0c00127e6c4fcb4ec2cb3f78805a9218551b878f75441a1bc282b94c9fdd7b9a + +post_configure() { + # -O0 prevents _FORTIFY_SOURCE working + for _f in $(find ${wrksrc} -name Makefile); do + sed -i $_f -e "s; -O0;;" + done +} + +do_install() { + make DESTDIR=${DESTDIR} PREFIX=/usr install + for pysl in $py2_sitelib $py3_sitelib; do + mkdir -p ${DESTDIR}${pysl} + cp -r ${wrksrc}/python/olm ${DESTDIR}${pysl} + done +} + +olm-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/lib/*.so + } +} + +olm-python_package() { + noarch=yes + short_desc+=" - python bindings" + depends="${sourcepkg}>=${version}_${revision} python" + pycompile_module=olm + pkg_install() { + vmove ${py2_sitelib} + } +} + +olm-python3_package() { + noarch=yes + short_desc+=" - python3 bindings" + depends="${sourcepkg}>=${version}_${revision} python3" + pycompile_module=olm + pkg_install() { + vmove ${py3_sitelib} + } +}