lbry-android-sdk/p4a/pythonforandroid/recipes/pyleveldb/bindings-only.patch

120 lines
3.9 KiB
Diff
Raw Normal View History

2022-12-02 21:15:34 +01:00
This patch force to only build the python bindings, and to do so, we modify
the setup.py file in oder that finds our compiled libraries (libleveldb.so and
libsnappy.so)
--- leveldb-0.194/setup.py.orig 2016-09-17 02:05:55.000000000 +0200
+++ leveldb-0.194/setup.py 2019-02-26 16:57:40.997435911 +0100
@@ -11,44 +11,25 @@ import platform
import sys
2017-08-13 03:24:00 +02:00
from setuptools import setup, Extension
2022-12-02 21:15:34 +01:00
+from os import environ
system, node, release, version, machine, processor = platform.uname()
2017-08-13 03:24:00 +02:00
-common_flags = [
2022-12-02 21:15:34 +01:00
- '-I./leveldb/include',
- '-I./leveldb',
- '-I./snappy',
2017-08-13 03:24:00 +02:00
+extra_compile_args = [
2022-12-02 21:15:34 +01:00
+ '-I{}/include'.format(environ.get('LEVELDB_BUILD_PATH')),
+ '-I{}'.format(environ.get('LEVELDB_BUILD_PATH')),
+ '-I{}'.format(environ.get('SNAPPY_BUILD_PATH')),
+ '-I.',
'-I.',
- '-fno-builtin-memcmp',
'-O2',
'-fPIC',
'-DNDEBUG',
'-DSNAPPY',
+ '-pthread',
+ '-Wall',
+ '-D_REENTRANT',
+ '-DOS_ANDROID',
]
2017-08-13 03:24:00 +02:00
-if system == 'Darwin':
2022-12-02 21:15:34 +01:00
- extra_compile_args = common_flags + [
- '-DOS_MACOSX',
- '-DLEVELDB_PLATFORM_POSIX',
- '-Wno-error=unused-command-line-argument-hard-error-in-future',
- ]
2017-08-13 03:24:00 +02:00
-elif system == 'Linux':
2022-12-02 21:15:34 +01:00
- extra_compile_args = common_flags + [
- '-pthread',
- '-Wall',
- '-DOS_LINUX',
- '-DLEVELDB_PLATFORM_POSIX',
- ]
-elif system == 'SunOS':
2017-08-13 03:24:00 +02:00
- extra_compile_args = common_flags + [
- '-pthread',
2022-12-02 21:15:34 +01:00
- '-Wall',
- '-DOS_SOLARIS',
2017-08-13 03:24:00 +02:00
- '-DLEVELDB_PLATFORM_POSIX',
- ]
-else:
2022-12-02 21:15:34 +01:00
- sys.stderr.write("Don't know how to compile leveldb for %s!\n" % system)
- sys.exit(1)
-
2017-08-13 03:24:00 +02:00
setup(
2022-12-02 21:15:34 +01:00
name = 'leveldb',
version = '0.194',
@@ -81,57 +62,11 @@ setup(
ext_modules = [
Extension('leveldb',
sources = [
- # snappy
- './snappy/snappy.cc',
- './snappy/snappy-stubs-internal.cc',
- './snappy/snappy-sinksource.cc',
- './snappy/snappy-c.cc',
2017-08-13 03:24:00 +02:00
-
2022-12-02 21:15:34 +01:00
- #leveldb
- 'leveldb/db/builder.cc',
- 'leveldb/db/c.cc',
- 'leveldb/db/db_impl.cc',
- 'leveldb/db/db_iter.cc',
- 'leveldb/db/dbformat.cc',
- 'leveldb/db/filename.cc',
- 'leveldb/db/log_reader.cc',
- 'leveldb/db/log_writer.cc',
- 'leveldb/db/memtable.cc',
- 'leveldb/db/repair.cc',
- 'leveldb/db/table_cache.cc',
- 'leveldb/db/version_edit.cc',
- 'leveldb/db/version_set.cc',
- 'leveldb/db/write_batch.cc',
- 'leveldb/table/block.cc',
- 'leveldb/table/block_builder.cc',
- 'leveldb/table/filter_block.cc',
- 'leveldb/table/format.cc',
- 'leveldb/table/iterator.cc',
- 'leveldb/table/merger.cc',
- 'leveldb/table/table.cc',
- 'leveldb/table/table_builder.cc',
- 'leveldb/table/two_level_iterator.cc',
- 'leveldb/util/arena.cc',
- 'leveldb/util/bloom.cc',
- 'leveldb/util/cache.cc',
- 'leveldb/util/coding.cc',
- 'leveldb/util/comparator.cc',
- 'leveldb/util/crc32c.cc',
- 'leveldb/util/env.cc',
- 'leveldb/util/env_posix.cc',
- 'leveldb/util/filter_policy.cc',
- 'leveldb/util/hash.cc',
- 'leveldb/util/histogram.cc',
- 'leveldb/util/logging.cc',
- 'leveldb/util/options.cc',
- 'leveldb/util/status.cc',
- 'leveldb/port/port_posix.cc',
2017-08-13 03:24:00 +02:00
-
2022-12-02 21:15:34 +01:00
# python stuff
'leveldb_ext.cc',
'leveldb_object.cc',
],
- libraries = ['stdc++'],
+ libraries = ['snappy', 'leveldb', 'stdc++', 'c++_shared'],
extra_compile_args = extra_compile_args,
)
]