diff --git a/recipes/aimrocks/build.sh b/recipes/aimrocks/build.sh index c5a62312493b1..635817169021c 100644 --- a/recipes/aimrocks/build.sh +++ b/recipes/aimrocks/build.sh @@ -4,4 +4,7 @@ set -ex # NOTE(hadim): to locate rocksdb export AIM_DEP_DIR=$PREFIX +# Do not embed rocksdb in the package +export EMBED_ROCKSDB=0 + python -m pip install . -vv diff --git a/recipes/aimrocks/meta.yaml b/recipes/aimrocks/meta.yaml index 7022ee0a07ac8..9194ed85298a2 100644 --- a/recipes/aimrocks/meta.yaml +++ b/recipes/aimrocks/meta.yaml @@ -9,6 +9,9 @@ source: url: https://github.com/aimhubio/aimrocks/archive/refs/tags/v{{ version }}.tar.gz sha256: c30ff542ba95cd615616cec07061f33e8385ebd131801fc2cdaf83010241a469 + patches: + - setup_rocksdb.patch + build: number: 0 skip: true # [win] diff --git a/recipes/aimrocks/setup_rocksdb.patch b/recipes/aimrocks/setup_rocksdb.patch new file mode 100644 index 0000000000000..c08a9f1a62624 --- /dev/null +++ b/recipes/aimrocks/setup_rocksdb.patch @@ -0,0 +1,64 @@ +diff --git a/setup.py b/setup.py +index a6ba6e3..7fadf92 100644 +--- a/setup.py ++++ b/setup.py +@@ -40,9 +40,6 @@ third_party_install_dir = os.environ.get('AIM_DEP_DIR', '/usr/local') + third_party_deps = ['rocksdb'] + + third_party_lib_dir = os.path.join(third_party_install_dir, 'lib') +-third_party_libs = glob(os.path.join(third_party_lib_dir, 'librocksdb.*')) +- +-third_party_headers = [os.path.join(third_party_install_dir, 'include/rocksdb')] + + # We define a local include directory to store all the required public headers. + # The third party headers are copied into this directory to enable binding with +@@ -54,17 +51,25 @@ local_lib_dir = os.path.abspath( + os.path.join(os.path.dirname(__file__), 'src/aimrocks') + ) + +-print('third party libs detected:', third_party_libs) +-for source in third_party_libs: +- print('copying third party lib', source, local_lib_dir) +- copy_file(source, local_lib_dir) ++if os.environ.get("EMBED_ROCKSDB", "1") == "1": ++ ++ third_party_libs = glob(os.path.join(third_party_lib_dir, 'librocksdb.*')) + +-for source in third_party_headers: +- basename = os.path.basename(source) +- destination = os.path.join(local_include_dir, basename) +- copy_tree(source, destination, +- preserve_symlinks=False, update=True) ++ print('third party libs detected:', third_party_libs) ++ for source in third_party_libs: ++ print('copying third party lib', source, local_lib_dir) ++ copy_file(source, local_lib_dir) + ++ third_party_headers = [os.path.join(third_party_install_dir, 'include/rocksdb')] ++ for source in third_party_headers: ++ basename = os.path.basename(source) ++ destination = os.path.join(local_include_dir, basename) ++ copy_tree(source, destination, ++ preserve_symlinks=False, update=True) ++ ++# `include_dirs` is used to specify the include directories for the extension. ++# It contains the aimrocks local headers and the rocksdb ones. ++include_dirs = [os.path.join(third_party_install_dir, 'include/'), local_include_dir] + + exts = [ + Extension( +@@ -73,13 +78,12 @@ exts = [ + extra_compile_args=aimrocks_extra_compile_args, + extra_link_args=aimrocks_extra_link_args, + language='c++', +- include_dirs=[local_include_dir], ++ include_dirs=include_dirs, + library_dirs=[third_party_lib_dir], + libraries=['rocksdb'], + ) + ] + +- + setup( + name="aimrocks", + version='0.2.1',