From ce31455b6707055e6da21a9ce6d950bb2925992b Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Wed, 13 Nov 2024 14:01:31 +0100 Subject: [PATCH] Move Wasm targets instructions into extension-ci-tools --- makefiles/duckdb_extension_c_api.Makefile | 33 ++++++++++++++++------- makefiles/duckdb_extension_rs.Makefile | 8 +++--- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/makefiles/duckdb_extension_c_api.Makefile b/makefiles/duckdb_extension_c_api.Makefile index 0e757f4..8f4c652 100644 --- a/makefiles/duckdb_extension_c_api.Makefile +++ b/makefiles/duckdb_extension_c_api.Makefile @@ -10,7 +10,7 @@ # LINUX_CI_IN_DOCKER : indicates that the build is being run in/out of Docker in the linux CI # SKIP_TESTS : makes the test targets turn into NOPs -.PHONY: platform extension_version test_extension_release test_extension_debug test_extension_release_internal test_extension_debug_internal tests_skipped clean_build clean_configure nop set_duckdb_tag set_duckdb_version output_distribution_matrix venv configure_ci check_configure +.PHONY: platform extension_version test_extension_release test_extension_debug test_extension_release_internal test_extension_debug_internal tests_skipped clean_build clean_configure nop set_duckdb_tag set_duckdb_version output_distribution_matrix venv configure_ci check_configure move_wasm_extension ############################################# ### Platform dependent config @@ -171,10 +171,10 @@ output_distribution_matrix: ifneq ($(DUCKDB_WASM_PLATFORM),) link_wasm_debug: - emcc build/debug/$(EXTENSION_LIB_FILENAME) -o build/debug/$(EXTENSION_FILENAME_NO_METADATA) -O3 -g -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS="_$(EXTENSION_NAME)_init_c_api" + emcc build/$(DUCKDB_WASM_PLATFORM)/debug/$(EXTENSION_LIB_FILENAME) -o build/$(DUCKDB_WASM_PLATFORM)/debug/$(EXTENSION_FILENAME_NO_METADATA) -O3 -g -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS="_$(EXTENSION_NAME)_init_c_api" link_wasm_release: - emcc build/release/$(EXTENSION_LIB_FILENAME) -o build/release/$(EXTENSION_FILENAME_NO_METADATA) -O3 -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS="_$(EXTENSION_NAME)_init_c_api" + emcc build/$(DUCKDB_WASM_PLATFORM)/release/$(EXTENSION_LIB_FILENAME) -o build/$(DUCKDB_WASM_PLATFORM)/release/$(EXTENSION_FILENAME_NO_METADATA) -O3 -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS="_$(EXTENSION_NAME)_init_c_api" else link_wasm_debug: @@ -187,23 +187,23 @@ endif ############################################# build_extension_with_metadata_debug: check_configure link_wasm_debug $(PYTHON_VENV_BIN) extension-ci-tools/scripts/append_extension_metadata.py \ - -l build/debug/$(EXTENSION_FILENAME_NO_METADATA) \ - -o build/debug/$(EXTENSION_FILENAME) \ + -l build/$(DUCKDB_WASM_PLATFORM)/debug/$(EXTENSION_FILENAME_NO_METADATA) \ + -o build/$(DUCKDB_WASM_PLATFORM)/debug/$(EXTENSION_FILENAME) \ -n $(EXTENSION_NAME) \ -dv $(MINIMUM_DUCKDB_VERSION) \ -evf configure/extension_version.txt \ -pf configure/platform.txt - $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('build/debug/$(EXTENSION_FILENAME)', 'build/debug/extension/$(EXTENSION_NAME)/$(EXTENSION_FILENAME)')" + $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('build/$(DUCKDB_WASM_PLATFORM)/debug/$(EXTENSION_FILENAME)', 'build/$(DUCKDB_WASM_PLATFORM)/debug/extension/$(EXTENSION_NAME)/$(EXTENSION_FILENAME)')" build_extension_with_metadata_release: check_configure link_wasm_release $(PYTHON_VENV_BIN) extension-ci-tools/scripts/append_extension_metadata.py \ - -l build/release/$(EXTENSION_FILENAME_NO_METADATA) \ - -o build/release/$(EXTENSION_FILENAME) \ + -l build/$(DUCKDB_WASM_PLATFORM)/release/$(EXTENSION_FILENAME_NO_METADATA) \ + -o build/$(DUCKDB_WASM_PLATFORM)/release/$(EXTENSION_FILENAME) \ -n $(EXTENSION_NAME) \ -dv $(MINIMUM_DUCKDB_VERSION) \ -evf configure/extension_version.txt \ -pf configure/platform.txt - $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('build/release/$(EXTENSION_FILENAME)', 'build/release/extension/$(EXTENSION_NAME)/$(EXTENSION_FILENAME)')" + $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('build/$(DUCKDB_WASM_PLATFORM)/release/$(EXTENSION_FILENAME)', 'build/$(DUCKDB_WASM_PLATFORM)/release/extension/$(EXTENSION_NAME)/$(EXTENSION_FILENAME)')" ############################################# ### Python @@ -234,4 +234,17 @@ configure_ci: $(CONFIGURE_CI_STEP) # Because the configure_ci may differ from configure, we don't automatically run configure on make build, this makes the error a bit nicer check_configure: @$(PYTHON_BIN) -c "import os; assert os.path.exists('configure/platform.txt'), 'The configure step appears to not be run. Please try running make configure'" - @$(PYTHON_BIN) -c "import os; assert os.path.exists('configure/venv'), 'The configure step appears to not be run. Please try running make configure'" \ No newline at end of file + @$(PYTHON_BIN) -c "import os; assert os.path.exists('configure/venv'), 'The configure step appears to not be run. Please try running make configure'" + +move_wasm_extension: + $(PYTHON_VENV_BIN) -c "from pathlib import Path;Path('./build/$(DUCKDB_WASM_PLATFORM)/extension/$(EXTENSION_NAME)').mkdir(parents=True, exist_ok=True)" + $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('build/$(DUCKDB_WASM_PLATFORM)/release/extension/$(EXTENSION_NAME)/$(EXTENSION_FILENAME)', 'build/$(DUCKDB_WASM_PLATFORM)/extension/$(EXTENSION_NAME)/$(EXTENSION_FILENAME)')" + +wasm_mvp: + DUCKDB_PLATFORM=wasm_mvp make configure release move_wasm_extension + +wasm_eh: + DUCKDB_PLATFORM=wasm_eh make configure release move_wasm_extension + +wasm_threads: + DUCKDB_PLATFORM=wasm_coi make configure release move_wasm_extension diff --git a/makefiles/duckdb_extension_rs.Makefile b/makefiles/duckdb_extension_rs.Makefile index ffa817d..7e01edb 100644 --- a/makefiles/duckdb_extension_rs.Makefile +++ b/makefiles/duckdb_extension_rs.Makefile @@ -31,13 +31,13 @@ endif build_extension_library_debug: check_configure DUCKDB_EXTENSION_NAME=$(EXTENSION_NAME) DUCKDB_EXTENSION_MIN_DUCKDB_VERSION=$(MINIMUM_DUCKDB_VERSION) cargo build $(CARGO_OVERRIDE_DUCKDB_RS_FLAG) $(TARGET_INFO) - $(PYTHON_VENV_BIN) -c "from pathlib import Path;Path('./build/debug/extension/$(EXTENSION_NAME)').mkdir(parents=True, exist_ok=True)" - $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('target/$(TARGET)/debug/$(IS_EXAMPLE)/$(EXTENSION_LIB_FILENAME)', 'build/debug/$(EXTENSION_LIB_FILENAME)')" + $(PYTHON_VENV_BIN) -c "from pathlib import Path;Path('./build/$(DUCKDB_WASM_PLATFORM)/debug/extension/$(EXTENSION_NAME)').mkdir(parents=True, exist_ok=True)" + $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('target/$(TARGET)/debug/$(IS_EXAMPLE)/$(EXTENSION_LIB_FILENAME)', 'build/$(DUCKDB_WASM_PLATFORM)/debug/$(EXTENSION_LIB_FILENAME)')" build_extension_library_release: check_configure DUCKDB_EXTENSION_NAME=$(EXTENSION_NAME) DUCKDB_EXTENSION_MIN_DUCKDB_VERSION=$(MINIMUM_DUCKDB_VERSION) cargo build $(CARGO_OVERRIDE_DUCKDB_RS_FLAG) --release $(TARGET_INFO) - $(PYTHON_VENV_BIN) -c "from pathlib import Path;Path('./build/release/extension/$(EXTENSION_NAME)').mkdir(parents=True, exist_ok=True)" - $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('target/$(TARGET)/release/$(IS_EXAMPLE)/$(EXTENSION_LIB_FILENAME)', 'build/release/$(EXTENSION_LIB_FILENAME)')" + $(PYTHON_VENV_BIN) -c "from pathlib import Path;Path('./build/$(DUCKDB_WASM_PLATFORM)/release/extension/$(EXTENSION_NAME)').mkdir(parents=True, exist_ok=True)" + $(PYTHON_VENV_BIN) -c "import shutil;shutil.copyfile('target/$(TARGET)/release/$(IS_EXAMPLE)/$(EXTENSION_LIB_FILENAME)', 'build/$(DUCKDB_WASM_PLATFORM)/release/$(EXTENSION_LIB_FILENAME)')" ############################################# ### Misc