link_flags = '' for libname in libraries: link_flags += ' -l' + libname # check if we are doing a build from an existing DuckDB installation if 'DUCKDB_R_BINDIR' in os.environ and 'DUCKDB_R_CFLAGS' in os.environ and 'DUCKDB_R_LIBS' in os.environ: existing_duckdb_dir = os.environ['DUCKDB_R_BINDIR'] compile_flags = os.environ['DUCKDB_R_CFLAGS'].replace('\\', '').replace(' ', ' ') rlibs = [x for x in os.environ['DUCKDB_R_LIBS'].split(' ') if len(x) > 0] # use existing installation: set up Makevars with open_utf8(os.path.join('src', 'Makevars.in'), 'r') as f: text = f.read() compile_flags += package_build.include_flags(extensions) compile_flags += extension_list # find libraries result_libs = package_build.get_libraries(existing_duckdb_dir, rlibs, extensions) for rlib in result_libs: libdir = rlib[0] libname = rlib[1] if libdir != None: link_flags += ' -L' + libdir if libname != None: link_flags += ' -l' + libname text = text.replace('{{ SOURCES }}', '') text = text.replace('{{ INCLUDES }}', compile_flags.strip())
import subprocess sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'scripts')) import package_build # check if we are doing a build from an existing DuckDB installation if 'DUCKDB_R_BINDIR' in os.environ and 'DUCKDB_R_CFLAGS' in os.environ and 'DUCKDB_R_LIBS' in os.environ: existing_duckdb_dir = os.environ['DUCKDB_R_BINDIR'] compile_flags = os.environ['DUCKDB_R_CFLAGS'].replace('\\', '').replace(' ', ' ') libraries = [x for x in os.environ['DUCKDB_R_LIBS'].split(' ') if len(x) > 0] # use existing installation: set up Makevars with open(os.path.join('src', 'Makevars.in'), 'r') as f: text = f.read() compile_flags += package_build.include_flags() # find libraries result_libs = package_build.get_libraries(existing_duckdb_dir, libraries) link_flags = '' for rlib in result_libs: libdir = rlib[0] libname = rlib[1] if libdir != None: link_flags += ' -L' + libdir if libname != None: link_flags += ' -l' + libname text = text.replace('{{ SOURCES }}', '') text = text.replace('{{ INCLUDES }}', compile_flags.strip())