From 5cfe6c3dbddd1b32047150bd1708e0ce58ac3b5c Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Thu, 27 Apr 2023 17:19:53 -0400 Subject: [PATCH] more packaging improvements --- Makefile | 3 +-- README.md | 5 +++-- python/packaging.diff | 12 ++++++++++-- python/pyproject.toml | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 python/pyproject.toml diff --git a/Makefile b/Makefile index a1ea744..a4c22a7 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ RELEASE_OPTIMIZE_FLAGS ?= -O3 DEBUG_OPTIMIZE_FLAGS ?= -g -O0 -U_FORTIFY_SOURCE JS_OPTIMIZE_FLAGS ?= -O3 FUZZER_OPTIMIZE_FLAGS ?= -O3 -CC = gcc EMCC = emcc EMAR = emar AR = ar @@ -31,7 +30,7 @@ JS_ASMJS_TARGET := javascript/olm_legacy.js WASM_TARGET := $(BUILD_DIR)/wasm/libolm.a JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json -JS_EXPORTED_RUNTIME_METHODS := [ALLOC_STACK,writeAsciiToMemory,intArrayFromString] +JS_EXPORTED_RUNTIME_METHODS := [ALLOC_STACK,writeAsciiToMemory,intArrayFromString,UTF8ToString,StringToUTF8] JS_EXTERNS := javascript/externs.js PUBLIC_HEADERS := include/olm/olm.h include/olm/outbound_group_session.h include/olm/inbound_group_session.h include/olm/pk.h include/olm/sas.h include/olm/error.h include/olm/olm_export.h diff --git a/README.md b/README.md index 52d42d2..0eecc5b 100644 --- a/README.md +++ b/README.md @@ -203,8 +203,9 @@ endorsed by the Matrix.org Foundation C.I.C. ## Release process First: bump version numbers in ``common.mk``, ``CMakeLists.txt``, -``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``, -``Package.swift``, and ``android/gradle.properties``. +``javascript/package.json``, ``python/olm/__version__.py``, +``python/pyproject.toml``, ``OLMKit.podspec``, ``Package.swift``, and +``android/gradle.properties``. Also, ensure the changelog is up to date, and that everything is committed to git. diff --git a/python/packaging.diff b/python/packaging.diff index d0af5e0..bb1740c 100644 --- a/python/packaging.diff +++ b/python/packaging.diff @@ -12,7 +12,7 @@ +recursive-include libolm/tests * --- a/olm_build.py +++ b/olm_build.py -@@ -25,14 +25,23 @@ +@@ -25,13 +25,30 @@ DEVELOP = os.environ.get("DEVELOP") @@ -26,6 +26,7 @@ -headers_build = subprocess.Popen("make headers", shell=True) -headers_build.wait() ++# Try to build with cmake first, fall back to GNU make +try: + subprocess.run( + ["cmake", ".", "-Bbuild", "-DBUILD_SHARED_LIBS=NO"], @@ -36,6 +37,13 @@ + cwd="libolm", check=True, + ) +except FileNotFoundError: -+ subprocess.run(["make", "static"], cwd="libolm", check=True) ++ try: ++ # try "gmake" first because some systems have a non-GNU make ++ # installed as "make" ++ subprocess.run(["gmake", "static"], cwd="libolm", check=True) ++ except FileNotFoundError: ++ # some systems have GNU make installed without the leading "g" ++ # so give that a try (though this may fail if it isn't GNU make) ++ subprocess.run(["make", "static"], cwd="libolm", check=True) ffibuilder.set_source( diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 0000000..a28e551 --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,14 @@ +[project] +name = "python-olm" +version = "3.2.14" +description = "python CFFI bindings for the olm cryptographic ratchet library" +authors = [{name = "Damir Jelić", email = "poljar@termina.org.uk"}] +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Topic :: Communications", +] +dependencies = ["cffi>=1.0.0"] + +[build-system] +requires = ["setuptools", "cffi>=1.0.0"] +build-backend = "setuptools.build_meta"