This commit is contained in:
zeppi 2022-12-09 14:47:05 -05:00
parent a712121c3c
commit 082db3a8be
495 changed files with 7931 additions and 123 deletions

View file

@ -2,7 +2,7 @@ name: Publish Assets
on:
push:
branches: [master]
branches: [master, upgrade_p4a]
jobs:
build_arm64_aar:
@ -16,20 +16,14 @@ jobs:
cp -r /root/.buildozer ~/.buildozer/
- name: setup
run: |
apt update
apt install libssl-dev zip unzip openjdk-11-jdk -y
export B_VERSION=$(cat $GITHUB_WORKSPACE/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
echo "NEXUS_SIGNING_KEYRING_FILE=$GITHUB_WORKSPACE/signing2.pgp" >> $GITHUB_ENV
echo "BUILD_VERSION=${B_VERSION}" >> $GITHUB_ENV
export PATH=/usr/bin:$PATH
wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
cp -f $GITHUB_WORKSPACE/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
cp -f $GITHUB_WORKSPACE/scripts/mangled-glibc-syscalls__arm64.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm64/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
cp -f $GITHUB_WORKSPACE/scripts/build-binary.mk ~/.buildozer/android/crystax-ndk-10.3.2/build/core/build-binary.mk
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
cp -Rf $GITHUB_WORKSPACE/scripts/crystax-sources/sqlite ~/.buildozer/android/crystax-ndk-10.3.2/sources/sqlite
rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
wget -q 'https://dl.google.com/android/repository/android-ndk-r25b-linux.zip' -P ~/.buildozer/android/
unzip ~/.buildozer/android/android-ndk-r25b-linux.zip -d ~/.buildozer/android/
mv buildozer.spec.arm64.ci buildozer.spec
chmod u+x ./build-release.sh
- name: build release
@ -77,6 +71,7 @@ jobs:
echo "NEXUS_SIGNING_KEYRING_FILE=$GITHUB_WORKSPACE/signing2.pgp" >> $GITHUB_ENV
export PATH=/usr/bin:$PATH
wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
unzip ~/
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9

0
MovedRecipes/__init__.py Normal file
View file

View file

@ -1,5 +1,96 @@
from pythonforandroid.recipe import CythonRecipe, IncludedFilesBehaviour
from pythonforandroid.util import current_directory
from pythonforandroid import logger
from os.path import join
class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
# name = 'android'
version = None
url = None
src_filename = 'src'
depends = [('sdl2', 'genericndkbuild'), 'pyjnius']
config_env = {}
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
env.update(self.config_env)
return env
def prebuild_arch(self, arch):
super().prebuild_arch(arch)
ctx_bootstrap = self.ctx.bootstrap.name
# define macros for Cython, C, Python
tpxi = 'DEF {} = {}\n'
th = '#define {} {}\n'
tpy = '{} = {}\n'
# make sure bootstrap name is in unicode
if isinstance(ctx_bootstrap, bytes):
ctx_bootstrap = ctx_bootstrap.decode('utf-8')
bootstrap = bootstrap_name = ctx_bootstrap
is_lbry = bootstrap_name in ('lbry',)
is_sdl2 = (bootstrap_name == "sdl2")
if bootstrap_name in ["sdl2", "webview", "service_only", "service_library", "lbry"]:
java_ns = u'org.kivy.android'
jni_ns = u'org/kivy/android'
else:
logger.error((
'unsupported bootstrap for android recipe: {}'
''.format(bootstrap_name)
))
exit(1)
config = {
'BOOTSTRAP': bootstrap,
'IS_SDL2': int(is_sdl2),
'PY2': 0,
'JAVA_NAMESPACE': java_ns,
'JNI_NAMESPACE': jni_ns,
'ACTIVITY_CLASS_NAME': self.ctx.activity_class_name,
'ACTIVITY_CLASS_NAMESPACE': self.ctx.activity_class_name.replace('.', '/'),
'SERVICE_CLASS_NAME': self.ctx.service_class_name,
}
# create config files for Cython, C and Python
with (
current_directory(self.get_build_dir(arch.arch))), (
open(join('android', 'config.pxi'), 'w')) as fpxi, (
open(join('android', 'config.h'), 'w')) as fh, (
open(join('android', 'config.py'), 'w')) as fpy:
for key, value in config.items():
fpxi.write(tpxi.format(key, repr(value)))
fpy.write(tpy.format(key, repr(value)))
fh.write(th.format(
key,
value if isinstance(value, int) else '"{}"'.format(value)
))
self.config_env[key] = str(value)
if is_sdl2:
fh.write('JNIEnv *SDL_AndroidGetJNIEnv(void);\n')
fh.write(
'#define SDL_ANDROID_GetJNIEnv SDL_AndroidGetJNIEnv\n'
)
else:
fh.write('JNIEnv *WebView_AndroidGetJNIEnv(void);\n')
fh.write(
'#define SDL_ANDROID_GetJNIEnv WebView_AndroidGetJNIEnv\n'
)
recipe = AndroidRecipe()
'''
from pythonforandroid.recipe import CythonRecipe, IncludedFilesBehaviour
from pythonforandroid.util import current_directory
from pythonforandroid.patching import will_build
from pythonforandroid import logger
@ -75,7 +166,7 @@ class AndroidRecipe(IncludedFilesBehaviour, CythonRecipe):
recipe = AndroidRecipe()
'''
'''
from pythonforandroid.recipe import CythonRecipe, Recipe, IncludedFilesBehaviour

View file

View file

@ -0,0 +1,120 @@
#include <jni.h>
#include <stdio.h>
#include <android/log.h>
#include <string.h>
#include <stdlib.h>
#include "config.h"
#define aassert(x) { if (!x) { __android_log_print(ANDROID_LOG_ERROR, "android_jni", "Assertion failed. %s:%d", __FILE__, __LINE__); abort(); }}
#define PUSH_FRAME { (*env)->PushLocalFrame(env, 16); }
#define POP_FRAME { (*env)->PopLocalFrame(env, NULL); }
void android_billing_service_start() {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, JNI_NAMESPACE "/PythonActivity");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "billingServiceStart", "()V");
aassert(mid);
}
PUSH_FRAME;
(*env)->CallStaticVoidMethod(env, cls, mid);
POP_FRAME;
}
void android_billing_service_stop() {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, JNI_NAMESPACE "/PythonActivity");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "billingServiceStop", "()V");
aassert(mid);
}
PUSH_FRAME;
(*env)->CallStaticVoidMethod(env, cls, mid);
POP_FRAME;
}
void android_billing_buy(char *sku) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, JNI_NAMESPACE "/PythonActivity");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "billingBuy", "(Ljava/lang/String;)V");
aassert(mid);
}
PUSH_FRAME;
(*env)->CallStaticVoidMethod(
env, cls, mid,
(*env)->NewStringUTF(env, sku)
);
POP_FRAME;
}
char *android_billing_get_purchased_items() {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
jobject jreading;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, JNI_NAMESPACE "/PythonActivity");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "billingGetPurchasedItems", "()Ljava/lang/String;");
aassert(mid);
}
PUSH_FRAME;
jreading = (*env)->CallStaticObjectMethod(env, cls, mid);
const char * reading = (*env)->GetStringUTFChars(env, jreading, 0);
POP_FRAME;
return reading;
}
char *android_billing_get_pending_message() {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
jobject jreading;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, JNI_NAMESPACE "/PythonActivity");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "billingGetPendingMessage", "()Ljava/lang/String;");
aassert(mid);
}
PUSH_FRAME;
jreading = (*env)->CallStaticObjectMethod(env, cls, mid);
const char * reading = (*env)->GetStringUTFChars(env, jreading, 0);
POP_FRAME;
return reading;
}

View file

@ -0,0 +1,125 @@
cdef extern void android_sound_queue(int, char *, char *, long long, long long)
cdef extern void android_sound_play(int, char *, char *, long long, long long)
cdef extern void android_sound_stop(int)
cdef extern void android_sound_seek(int, float)
cdef extern void android_sound_dequeue(int)
cdef extern void android_sound_playing_name(int, char *, int)
cdef extern void android_sound_pause(int)
cdef extern void android_sound_unpause(int)
cdef extern void android_sound_set_volume(int, float)
cdef extern void android_sound_set_secondary_volume(int, float)
cdef extern void android_sound_set_pan(int, float)
cdef extern int android_sound_queue_depth(int)
cdef extern int android_sound_get_pos(int)
cdef extern int android_sound_get_length(int)
channels = set()
volumes = { }
def queue(channel, file, name, fadein=0, tight=False):
channels.add(channel)
real_fn = file.name
base = getattr(file, "base", -1)
length = getattr(file, "length", -1)
android_sound_queue(channel, name, real_fn, base, length)
def play(channel, file, name, paused=False, fadein=0, tight=False):
channels.add(channel)
real_fn = file.name
base = getattr(file, "base", -1)
length = getattr(file, "length", -1)
android_sound_play(channel, name, real_fn, base, length)
def seek(channel, position):
android_sound_seek(channel, position)
def stop(channel):
android_sound_stop(channel)
def dequeue(channel, even_tight=False):
android_sound_dequeue(channel)
def queue_depth(channel):
return android_sound_queue_depth(channel)
def playing_name(channel):
cdef char buf[1024]
android_sound_playing_name(channel, buf, 1024)
rv = buf
if not len(rv):
return None
return rv
def pause(channel):
android_sound_pause(channel)
return
def unpause(channel):
android_sound_unpause(channel)
return
def unpause_all():
for i in channels:
unpause(i)
def pause_all():
for i in channels:
pause(i)
def fadeout(channel, ms):
stop(channel)
def busy(channel):
return playing_name(channel) != None
def get_pos(channel):
return android_sound_get_pos(channel)
def get_length(channel):
return android_sound_get_length(channel)
def set_volume(channel, volume):
android_sound_set_volume(channel, volume)
volumes[channel] = volume
def set_secondary_volume(channel, volume):
android_sound_set_secondary_volume(channel, volume)
def set_pan(channel, pan):
android_sound_set_pan(channel, pan)
def set_end_event(channel, event):
return
def get_volume(channel):
return volumes.get(channel, 1.0)
def init(freq, stereo, samples, status=False):
return
def quit():
for i in channels:
stop(i)
def periodic():
return
def alloc_event(surf):
return
def refresh_event():
return
def check_version(version):
return

View file

@ -0,0 +1,308 @@
#include <jni.h>
#include <stdio.h>
#include <android/log.h>
#include <string.h>
JNIEnv *SDL_ANDROID_GetJNIEnv();
#define aassert(x) { if (!x) { __android_log_print(ANDROID_LOG_ERROR, "android_sound_jni", "Assertion failed. %s:%d", __FILE__, __LINE__); abort(); }}
#define PUSH_FRAME { (*env)->PushLocalFrame(env, 16); }
#define POP_FRAME { (*env)->PopLocalFrame(env, NULL); }
void android_sound_queue(int channel, char *filename, char *real_fn, long long base, long long length) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "queue", "(ILjava/lang/String;Ljava/lang/String;JJ)V");
aassert(mid);
}
PUSH_FRAME;
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel,
(*env)->NewStringUTF(env, filename),
(*env)->NewStringUTF(env, real_fn),
(jlong) base,
(jlong) length);
POP_FRAME;
}
void android_sound_play(int channel, char *filename, char *real_fn, long long base, long long length) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "play", "(ILjava/lang/String;Ljava/lang/String;JJ)V");
aassert(mid);
}
PUSH_FRAME;
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel,
(*env)->NewStringUTF(env, filename),
(*env)->NewStringUTF(env, real_fn),
(jlong) base,
(jlong) length);
POP_FRAME;
}
void android_sound_seek(int channel, float position){
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "seek", "(IF)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel,
(jfloat) position);
}
void android_sound_stop(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "stop", "(I)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel);
}
void android_sound_dequeue(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "dequeue", "(I)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel);
}
int android_sound_queue_depth(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "queue_depth", "(I)I");
aassert(mid);
}
(*env)->CallStaticIntMethod(
env, cls, mid,
channel);
}
void android_sound_playing_name(int channel, char *buf, int buflen) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
jobject s = NULL;
char *jbuf;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "playing_name", "(I)Ljava/lang/String;");
aassert(mid);
}
PUSH_FRAME;
s = (*env)->CallStaticObjectMethod(
env, cls, mid,
channel);
jbuf = (*env)->GetStringUTFChars(env, s, NULL);
strncpy(buf, jbuf, buflen);
(*env)->ReleaseStringUTFChars(env, s, jbuf);
POP_FRAME;
}
void android_sound_set_volume(int channel, float value) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "set_volume", "(IF)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel,
(jfloat) value);
}
void android_sound_set_secondary_volume(int channel, float value) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "set_secondary_volume", "(IF)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel,
(jfloat) value);
}
void android_sound_set_pan(int channel, float value) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "set_pan", "(IF)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel,
(jfloat) value);
}
void android_sound_pause(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "pause", "(I)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel);
}
void android_sound_unpause(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "unpause", "(I)V");
aassert(mid);
}
(*env)->CallStaticVoidMethod(
env, cls, mid,
channel);
}
int android_sound_get_pos(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "get_pos", "(I)I");
aassert(mid);
}
return (*env)->CallStaticIntMethod(
env, cls, mid,
channel);
}
int android_sound_get_length(int channel) {
static JNIEnv *env = NULL;
static jclass *cls = NULL;
static jmethodID mid = NULL;
if (env == NULL) {
env = SDL_ANDROID_GetJNIEnv();
aassert(env);
cls = (*env)->FindClass(env, "org/renpy/android/RenPySound");
aassert(cls);
mid = (*env)->GetStaticMethodID(env, cls, "get_length", "(I)I");
aassert(mid);
}
return (*env)->CallStaticIntMethod(
env, cls, mid,
channel);
}

View file

@ -8,7 +8,7 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
version = '1.14.6'
url = 'https://pypi.python.org/packages/source/c/cffi/cffi-{version}.tar.gz'
depends = [('python2', 'python3crystax'), 'setuptools', 'pycparser', 'libffi']
depends = [('python2', 'python3'), 'setuptools', 'pycparser', 'libffi']
patches = ['disable-pkg-config.patch']
@ -43,16 +43,16 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
self.ctx.get_site_packages_dir(),
env['BUILDLIB_PATH'],
])
if self.ctx.ndk == 'crystax':
# only keeps major.minor (discards patch)
python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
return env
# if self.ctx.ndk == 'crystax':
# # only keeps major.minor (discards patch)
# python_version = self.ctx.python_recipe.version[0:3]
# ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
# env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# # until `pythonforandroid/archs.py` gets merged upstream:
# # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
# env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
# return env
recipe = CffiRecipe()

View file

@ -0,0 +1,74 @@
import os
from pythonforandroid.recipe import PythonRecipe, CompiledComponentsPythonRecipe
class CoincurveRecipe(CompiledComponentsPythonRecipe):
# version = '15.0.0'
# url = 'https://github.com/ofek/coincurve/archive/{version}.tar.gz'
# call_hostpython_via_targetpython = False
# depends = ['setuptools',
# 'libffi', 'cffi', 'libsecp256k1']
# patches = [
# "cross_compile.patch", "drop_setup_requires.patch",
# "find_lib.patch", "no-download.patch", "setup.py.patch"]
#
# def get_recipe_env(self, arch=None, with_flags_in_cc=True):
# env = super().get_recipe_env(arch, with_flags_in_cc)
# # sets linker to use the correct gcc (cross compiler)
# env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
# libsecp256k1 = self.get_recipe('libsecp256k1', self.ctx)
# libsecp256k1_dir = libsecp256k1.get_build_dir(arch.arch)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(libsecp256k1_dir, '.libs'))
# env['CFLAGS'] += ' -I' + os.path.join(libsecp256k1_dir, 'include')
# # only keeps major.minor (discards patch)
# python_version = self.ctx.python_recipe.version[0:3]
# # required additional library and path for Crystax
# if self.ctx.ndk == 'crystax':
# ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
# env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# # until `pythonforandroid/archs.py` gets merged upstream:
# # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
# env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
# else:
# env['PYTHON_ROOT'] = self.ctx.get_python_install_dir(arch.arch)
# env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python{}'.format(python_version)
# env['LDFLAGS'] += " -lpython{}".format(python_version)
# env['LDFLAGS'] += " -lsecp256k1"
# return env
version = 'v15.0.1'
url = 'https://github.com/ofek/coincurve/archive/refs/tags/v15.0.1.tar.gz'
call_hostpython_via_targetpython = False
depends = [('python2', 'python3'), 'setuptools',
'libffi', 'cffi', 'libsecp256k1']
patches = [
"cross_compile.patch", "drop_setup_requires.patch",
"find_lib.patch", "no-download.patch", "setup.py.patch"]
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
env = super().get_recipe_env(arch, with_flags_in_cc)
# sets linker to use the correct gcc (cross compiler)
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
libsecp256k1 = self.get_recipe('libsecp256k1', self.ctx)
libsecp256k1_dir = libsecp256k1.get_build_dir(arch.arch)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(libsecp256k1_dir, '.libs'))
env['CFLAGS'] += ' -I' + os.path.join(libsecp256k1_dir, 'include')
# only keeps major.minor (discards patch)
python_version = self.ctx.python_recipe.version[0:3]
# required additional library and path for Crystax
# if self.ctx.ndk == 'crystax':
# ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
# env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
# env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
# # until `pythonforandroid/archs.py` gets merged upstream:
# # https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
# env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)
# else:
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir(arch.arch)
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python{}'.format(python_version)
env['LDFLAGS'] += " -lpython{}".format(python_version)
env['LDFLAGS'] += " -lsecp256k1"
return env
recipe = CoincurveRecipe()

View file

@ -0,0 +1,12 @@
diff --git a/setup.py b/setup.py
index c224fb2..bf925bd 100644
--- a/setup.py
+++ b/setup.py
@@ -182,6 +182,7 @@ class build_clib(_build_clib):
'--disable-dependency-tracking',
'--with-pic',
'--enable-module-recovery',
+ "--host=%s" % os.environ['TOOLCHAIN_PREFIX'],
'--disable-jni',
'--prefix',
os.path.abspath(self.build_clib),

View file

@ -0,0 +1,12 @@
diff --git a/setup.py b/setup.py
index c224fb2..466e789 100644
--- a/setup.py
+++ b/setup.py
@@ -250,7 +250,6 @@ else:
def has_c_libraries(self):
return not has_system_lib()
setup_kwargs = dict(
- setup_requires=['cffi>=1.3.0', 'pytest-runner>=2.6.2'],
ext_package='coincurve',
cffi_modules=['_cffi_build/build.py:ffi'],
cmdclass={

View file

@ -0,0 +1,13 @@
diff --git a/setup_support.py b/setup_support.py
index e7a4f2e..72f0c4d 100644
--- a/setup_support.py
+++ b/setup_support.py
@@ -68,6 +69,8 @@ def build_flags(library, type_, path):
def _find_lib():
+ # we're picking up the recipe one
+ return True
from cffi import FFI
ffi = FFI()
try:

View file

@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index c224fb2..d5f6d1a 100644
--- a/setup.py
+++ b/setup.py
@@ -51,6 +51,8 @@ if [int(i) for i in setuptools_version.split('.', 2)[:2]] < [3, 3]:
def download_library(command):
+ # we will use the custom libsecp256k1 recipe
+ return
if command.dry_run:
return
libdir = absolute('libsecp256k1')

Some files were not shown because too many files have changed in this diff Show more