diff --git a/conda_build/build.py b/conda_build/build.py index 1d66cf114f..108807b0bd 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -94,7 +94,7 @@ import conda_build.windows as windows if "bsd" in sys.platform: - shell_path = "/bin/sh" + shell_path = "/usr/local/bin/bash" elif utils.on_win: shell_path = "bash" else: @@ -3205,7 +3205,7 @@ def write_build_scripts(m, script, build_file): with open(work_file, "w") as bf: # bf.write('set -ex\n') bf.write("if [ -z ${CONDA_BUILD+x} ]; then\n") - bf.write(f" source {env_file}\n") + bf.write(f" . {env_file}\n") bf.write("fi\n") if script: bf.write(script) @@ -3231,7 +3231,7 @@ def _write_test_run_script( with open(test_run_script, "w") as tf: tf.write( '{source} "{test_env_script}"\n'.format( - source="call" if utils.on_win else "source", + source="call" if utils.on_win else ".", test_env_script=test_env_script, ) ) diff --git a/conda_build/environ.py b/conda_build/environ.py index 5afcf93c4d..f07ed6356d 100644 --- a/conda_build/environ.py +++ b/conda_build/environ.py @@ -581,7 +581,7 @@ def get_shlib_ext(host_platform): return ".dll" elif host_platform in ["osx", "darwin"]: return ".dylib" - elif host_platform.startswith("linux") or host_platform.endswith("-wasm32"): + elif host_platform.startswith(("linux", "freebsd")) or host_platform.endswith("-wasm32"): return ".so" elif host_platform == "noarch": # noarch packages should not contain shared libraries, use the system diff --git a/conda_build/metadata.py b/conda_build/metadata.py index d2d87912bf..66adb23328 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -125,7 +125,7 @@ def get_selectors(config: Config) -> dict[str, bool]: linux32=bool(plat == "linux-32"), linux64=bool(plat == "linux-64"), arm=plat.startswith("linux-arm"), - unix=plat.startswith(("linux-", "osx-", "emscripten-")), + unix=plat.startswith(("linux-", "osx-", "emscripten-", "freebsd-")), win32=bool(plat == "win-32"), win64=bool(plat == "win-64"), os=os, diff --git a/conda_build/post.py b/conda_build/post.py index 290779385d..1ff8901043 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -59,6 +59,7 @@ "win": ("DLLfile", "EXEfile"), "osx": ["machofile"], "linux": ["elffile"], + "freebsd": ["elffile"], } diff --git a/conda_build/source.py b/conda_build/source.py index c8d21a4c2e..fcc59ee499 100644 --- a/conda_build/source.py +++ b/conda_build/source.py @@ -934,7 +934,7 @@ def try_apply_patch(patch, patch_args, cwd, stdout, stderr): temp_name = os.path.join( tempfile.gettempdir(), next(tempfile._get_candidate_names()) ) - base_patch_args = ["--no-backup-if-mismatch", "--batch"] + patch_args + base_patch_args = ["--posix", "--batch"] + patch_args try: try_patch_args = base_patch_args[:] try_patch_args.append("--dry-run") diff --git a/conda_build/variants.py b/conda_build/variants.py index d7c6841238..ba968ba4cb 100644 --- a/conda_build/variants.py +++ b/conda_build/variants.py @@ -78,6 +78,11 @@ "cxx": "clangxx", "fortran": "gfortran", }, + "freebsd": { + "c": "clang", + "cxx": "clangxx", + "fortran": "gfortran", + }, } arch_name = subdir.rsplit("-", 1)[-1] diff --git a/docs/source/resources/define-metadata.rst b/docs/source/resources/define-metadata.rst index c9e1ddd32b..633ce55d36 100644 --- a/docs/source/resources/define-metadata.rst +++ b/docs/source/resources/define-metadata.rst @@ -1931,7 +1931,10 @@ variables are booleans. - True if the platform is either macOS or Windows and the Python architecture is arm64. * - unix - - True if the platform is either macOS or Linux or emscripten. + - True if the platform is either macOS or Linux or emscripten + or FreeBSD. + * - freebsd + - True if the platform is FreeBSD. * - win - True if the platform is Windows. * - win32 diff --git a/news/4872-add-freebsd-support b/news/4872-add-freebsd-support new file mode 100644 index 0000000000..27a9437ee6 --- /dev/null +++ b/news/4872-add-freebsd-support @@ -0,0 +1,19 @@ +### Enhancements + +* Add support for FreeBSD. (#4872) + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* + +### Other + +*