From efc4ec32d7d2fd7358e8563011b1a48c8707ac12 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 28 Apr 2026 03:10:47 +0530 Subject: [PATCH 1/2] build: add recipes for installing fftpack --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- deps/checksums/pffft_1_1_0_tar_gz/sha256 | 1 + deps/test/fftpack/test_install.c | 36 +++++ tools/make/common.mk | 11 ++ tools/make/lib/install/Makefile | 7 +- tools/make/lib/install/fftpack.mk | 177 +++++++++++++++++++++++ tools/make/lib/test-fixtures/c.mk | 4 +- 6 files changed, 231 insertions(+), 5 deletions(-) create mode 100644 deps/checksums/pffft_1_1_0_tar_gz/sha256 create mode 100644 deps/test/fftpack/test_install.c create mode 100644 tools/make/lib/install/fftpack.mk diff --git a/deps/checksums/pffft_1_1_0_tar_gz/sha256 b/deps/checksums/pffft_1_1_0_tar_gz/sha256 new file mode 100644 index 000000000000..d04a825080df --- /dev/null +++ b/deps/checksums/pffft_1_1_0_tar_gz/sha256 @@ -0,0 +1 @@ +ea0701a6bc256405b03975908a6a92d0ffecdd18579e8484b8d789c8bd561787 diff --git a/deps/test/fftpack/test_install.c b/deps/test/fftpack/test_install.c new file mode 100644 index 000000000000..d4fabd16442b --- /dev/null +++ b/deps/test/fftpack/test_install.c @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include +#include + +extern void rffti( int n, double *wsave ); + +int main( void ) { + int n = 8; + double wsave[ 2*n + 15 ]; + int i; + + rffti( n, wsave ); + + printf( "rffti( %d, wsave )\n", n ); + for ( i = n; i < 2*n; i++ ) { + printf( "wsave[%2d] = %f\n", i, wsave[i] ); + } + printf( "\n" ); +} diff --git a/tools/make/common.mk b/tools/make/common.mk index e5f8e49ba41c..f570982f637e 100644 --- a/tools/make/common.mk +++ b/tools/make/common.mk @@ -688,3 +688,14 @@ DEPS_CPPCHECK_BUILD_OUT ?= $(DEPS_BUILD_DIR)/cppcheck_$(deps_cppcheck_version_sl # Host platform: DEPS_CPPCHECK_PLATFORM := $(shell command -v $(NODE) >/dev/null 2>&1 && $(NODE_HOST_PLATFORM)) + +# FFTPACK... + +# Define the PFFFT version: +DEPS_FFTPACK_VERSION ?= 1.1.0 + +# Generate a version slug: +deps_fftpack_version_slug := $(subst .,_,$(DEPS_FFTPACK_VERSION)) + +# Define the output path when building FFTPACK: +DEPS_FFTPACK_BUILD_OUT ?= $(DEPS_BUILD_DIR)/pffft-$(DEPS_FFTPACK_VERSION) diff --git a/tools/make/lib/install/Makefile b/tools/make/lib/install/Makefile index e66e2bc5aaf8..be8363f97b9a 100644 --- a/tools/make/lib/install/Makefile +++ b/tools/make/lib/install/Makefile @@ -39,6 +39,7 @@ include $(TOOLS_MAKE_LIB_DIR)/install/cephes.mk include $(TOOLS_MAKE_LIB_DIR)/install/cppcheck.mk include $(TOOLS_MAKE_LIB_DIR)/install/electron.mk include $(TOOLS_MAKE_LIB_DIR)/install/emsdk.mk +include $(TOOLS_MAKE_LIB_DIR)/install/fftpack.mk include $(TOOLS_MAKE_LIB_DIR)/install/llvm.mk include $(TOOLS_MAKE_LIB_DIR)/install/node.mk include $(TOOLS_MAKE_LIB_DIR)/install/openblas.mk @@ -157,7 +158,7 @@ clean-deps-tests: clean-deps-openblas-tests # @example # make install-deps-dev #/ -install-deps-dev: install-deps-boost install-deps-cephes install-deps-cppcheck install-deps-python install-deps-r install-deps-shellcheck +install-deps-dev: install-deps-boost install-deps-cephes install-deps-cppcheck install-deps-fftpack install-deps-python install-deps-r install-deps-shellcheck .PHONY: install-deps-dev @@ -167,7 +168,7 @@ install-deps-dev: install-deps-boost install-deps-cephes install-deps-cppcheck i # @example # make clean-deps-dev #/ -clean-deps-dev: clean-deps-boost clean-deps-cephes clean-deps-cppcheck clean-deps-python clean-deps-r clean-deps-shellcheck +clean-deps-dev: clean-deps-boost clean-deps-cephes clean-deps-cppcheck clean-deps-fftpack clean-deps-python clean-deps-r clean-deps-shellcheck .PHONY: clean-deps-dev @@ -177,7 +178,7 @@ clean-deps-dev: clean-deps-boost clean-deps-cephes clean-deps-cppcheck clean-dep # @example # make clean-deps-dev-tests #/ -clean-deps-dev-tests: clean-deps-boost-tests clean-deps-cephes-tests clean-deps-cppcheck-tests clean-deps-shellcheck-tests +clean-deps-dev-tests: clean-deps-boost-tests clean-deps-cephes-tests clean-deps-cppcheck-tests clean-deps-fftpack-tests clean-deps-shellcheck-tests .PHONY: clean-deps-dev-tests diff --git a/tools/make/lib/install/fftpack.mk b/tools/make/lib/install/fftpack.mk new file mode 100644 index 000000000000..b697b4a947d7 --- /dev/null +++ b/tools/make/lib/install/fftpack.mk @@ -0,0 +1,177 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +# Define the download URL: +DEPS_FFTPACK_URL ?= https://github.com/marton78/pffft/archive/refs/tags/v$(DEPS_FFTPACK_VERSION).tar.gz + +# Determine the basename for the download: +deps_fftpack_basename := pffft-$(DEPS_FFTPACK_VERSION).tar.gz + +# Define the path to the file containing a checksum to verify a download: +DEPS_FFTPACK_CHECKSUM ?= $(shell $(CAT) $(DEPS_CHECKSUMS_DIR)/$(subst .,_,$(subst -,_,$(deps_fftpack_basename)))/sha256) + +# Define the output path when downloading: +DEPS_FFTPACK_DOWNLOAD_OUT ?= $(DEPS_TMP_DIR)/$(deps_fftpack_basename) + +# Define a list of source files: +deps_fftpack_src := \ + src/fftpack.c + +# Resolve a list of source files to absolute filepaths: +DEPS_FFTPACK_SRC ?= $(addprefix $(DEPS_FFTPACK_BUILD_OUT)/,$(deps_fftpack_src)) + +# Define the path to the directory containing tests: +DEPS_FFTPACK_TEST_DIR ?= $(DEPS_DIR)/test/fftpack + +# Define the output directory path for compiled tests: +DEPS_FFTPACK_TEST_OUT ?= $(DEPS_FFTPACK_TEST_DIR)/build + +# Define the path to a test file for checking an installation: +DEPS_FFTPACK_TEST_INSTALL ?= $(DEPS_FFTPACK_TEST_DIR)/test_install.c + +# Define the output path for a test file: +DEPS_FFTPACK_TEST_INSTALL_OUT ?= $(DEPS_FFTPACK_TEST_OUT)/test_install + + +# RULES # + +#/ +# Downloads an FFTPACK distribution. +# +# @private +#/ +$(DEPS_FFTPACK_DOWNLOAD_OUT): | $(DEPS_TMP_DIR) + $(QUIET) echo 'Downloading FFTPACK...' >&2 + $(QUIET) $(DEPS_DOWNLOAD_BIN) $(DEPS_FFTPACK_URL) $(DEPS_FFTPACK_DOWNLOAD_OUT) + +#/ +# Extracts an FFTPACK gzipped tar archive. +# +# @private +#/ +$(DEPS_FFTPACK_BUILD_OUT): $(DEPS_FFTPACK_DOWNLOAD_OUT) | $(DEPS_BUILD_DIR) + $(QUIET) echo 'Extracting FFTPACK...' >&2 + $(QUIET) $(TAR) -zxf $(DEPS_FFTPACK_DOWNLOAD_OUT) -C $(DEPS_BUILD_DIR) + +#/ +# Creates a directory for storing compiled tests. +# +# @private +#/ +$(DEPS_FFTPACK_TEST_OUT): + $(QUIET) $(MKDIR_RECURSIVE) $(DEPS_FFTPACK_TEST_OUT) + +#/ +# Compiles a test file for testing an FFTPACK installation. +# +# @private +#/ +$(DEPS_FFTPACK_TEST_INSTALL_OUT): $(DEPS_FFTPACK_BUILD_OUT) $(DEPS_FFTPACK_TEST_OUT) + $(QUIET) $(CC) -I $(DEPS_FFTPACK_BUILD_OUT) $(DEPS_FFTPACK_TEST_INSTALL) $(DEPS_FFTPACK_SRC) -o $(DEPS_FFTPACK_TEST_INSTALL_OUT) + +#/ +# Downloads an FFTPACK distribution. +# +# @private +# +# @example +# make deps-download-fftpack +#/ +deps-download-fftpack: $(DEPS_FFTPACK_DOWNLOAD_OUT) + +.PHONY: deps-download-fftpack + +#/ +# Verifies a downloaded FFTPACK distribution. +# +# @private +# +# @example +# make deps-verify-fftpack +#/ +deps-verify-fftpack: deps-download-fftpack + $(QUIET) echo 'Verifying download...' >&2 + $(QUIET) $(DEPS_CHECKSUM_BIN) $(DEPS_FFTPACK_DOWNLOAD_OUT) $(DEPS_FFTPACK_CHECKSUM) >&2 + +.PHONY: deps-verify-fftpack + +#/ +# Extracts a downloaded FFTPACK distribution. +# +# @private +# +# @example +# make deps-extract-fftpack +#/ +deps-extract-fftpack: $(DEPS_FFTPACK_BUILD_OUT) + +.PHONY: deps-extract-fftpack + +#/ +# Tests an installed FFTPACK distribution. +# +# @private +# +# @example +# make deps-test-fftpack +#/ +deps-test-fftpack: $(DEPS_FFTPACK_TEST_INSTALL_OUT) + $(QUIET) echo 'Running tests...' >&2 + $(QUIET) $(DEPS_FFTPACK_TEST_INSTALL_OUT) + $(QUIET) echo '' >&2 + $(QUIET) echo 'Success.' >&2 + +.PHONY: deps-test-fftpack + +#/ +# Installs FFTPACK. +# +# @example +# make install-deps-fftpack +#/ +install-deps-fftpack: deps-download-fftpack deps-verify-fftpack deps-extract-fftpack deps-test-fftpack + +.PHONY: install-deps-fftpack + +#/ +# Removes an installed FFTPACK distribution. +# +# ## Notes +# +# - The rule does **not** remove an FFTPACK download (if one exists). +# +# @example +# make clean-deps-fftpack +#/ +clean-deps-fftpack: clean-deps-fftpack-tests + $(QUIET) $(DELETE) $(DELETE_FLAGS) $(DEPS_FFTPACK_BUILD_OUT) + +.PHONY: clean-deps-fftpack + +#/ +# Removes compiled FFTPACK installation tests. +# +# @example +# make clean-deps-fftpack-tests +#/ +clean-deps-fftpack-tests: + $(QUIET) $(DELETE) $(DELETE_FLAGS) $(DEPS_FFTPACK_TEST_OUT) + +.PHONY: clean-deps-fftpack-tests diff --git a/tools/make/lib/test-fixtures/c.mk b/tools/make/lib/test-fixtures/c.mk index 835c780d8f77..f48c82935cb1 100644 --- a/tools/make/lib/test-fixtures/c.mk +++ b/tools/make/lib/test-fixtures/c.mk @@ -28,7 +28,7 @@ test-fixtures-c: echo "Generating test fixtures: $$file"; \ cd `dirname $$file` && \ $(MAKE) clean && \ - CEPHES="$(DEPS_CEPHES_BUILD_OUT)" CEPHES_SRC="$(DEPS_CEPHES_SRC)" $(MAKE) && \ + CEPHES="$(DEPS_CEPHES_BUILD_OUT)" CEPHES_SRC="$(DEPS_CEPHES_SRC)" FFTPACK_SRC="$(DEPS_FFTPACK_SRC)" $(MAKE) && \ $(MAKE) run || exit 1; \ done @@ -45,7 +45,7 @@ test-fixtures-c-files: echo "Generating test fixtures: $$file"; \ cd `dirname $$file` && \ $(MAKE) clean && \ - CEPHES="$(DEPS_CEPHES_BUILD_OUT)" CEPHES_SRC="$(DEPS_CEPHES_SRC)" $(MAKE) && \ + CEPHES="$(DEPS_CEPHES_BUILD_OUT)" CEPHES_SRC="$(DEPS_CEPHES_SRC)" FFTPACK_SRC="$(DEPS_FFTPACK_SRC)" $(MAKE) && \ $(MAKE) run || exit 1; \ done From 84ae615acdc7e15bb4421f49322efcc7c783e0e2 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 3 May 2026 18:36:00 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- deps/test/fftpack/test_install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/test/fftpack/test_install.c b/deps/test/fftpack/test_install.c index d4fabd16442b..356f0bbe334c 100644 --- a/deps/test/fftpack/test_install.c +++ b/deps/test/fftpack/test_install.c @@ -22,8 +22,8 @@ extern void rffti( int n, double *wsave ); int main( void ) { + double wsave[ 2*8 + 15 ]; // 2*n + 15 int n = 8; - double wsave[ 2*n + 15 ]; int i; rffti( n, wsave );