Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions recipes/eon/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2010--present, eOn Development Team
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 changes: 57 additions & 0 deletions recipes/eon/build.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
let host_prefix_expanded = ($env.PREFIX | path expand)
# Create the "native.ini" file to explicitly tell Meson which Python to use.
# This hard-codes the path to the correct Python from the conda host environment.
let python_path = ($env.PREFIX | path join 'bin/python')
let content = $"[binaries]\npython = '($python_path)'\n"
$content | save native.ini

# --- Configure ---
let configure_args = [
$"--prefix=($host_prefix_expanded)",
"--libdir=lib",
"--buildtype=release",
"-Dpython.install_env=prefix",
# Needed to pin the right Python file
"--native-file", "native.ini",
# Handling conditionals
# Always build metatomic support here
"-Dwith_metatomic=True",
"-Dpip_metatomic=False"
$"-Dtorch_path=($host_prefix_expanded)"
]

print $"INFO: Running meson setup with ($configure_args | str join ' ')"
# External commands will get LIBS, CPPFLAGS, CXXFLAGS as space-separated strings
# due to the to_string closure in ENV_CONVERSIONS.
if ($env.target_platform | str starts-with "osx") {
(CXXFLAGS=$"($env.CXXFLAGS) -D_LIBCPP_DISABLE_AVAILABILITY"
meson setup bbdir ...$configure_args)
meson install -C bbdir
} else {
meson setup bbdir ...$configure_args
meson install -C bbdir
}


# --- Post-Install Linking Fix for macOS ---
# Delete all existing rpaths, and then add back a single correct one.
if ($env.target_platform | str starts-with "osx") {
print "INFO: Running post-install rpath fix for macOS..."
let eonclient_path = $"($host_prefix_expanded)/bin/eonclient"

# Get a list of all current rpaths in the executable
let current_rpaths = (otool -l $eonclient_path | grep LC_RPATH -A 2 | lines | where $it =~ 'path' | parse --regex `path\s+(?<path>\S+)` | get path)

# Delete each existing rpath
for rpath in $current_rpaths {
print $"INFO: Deleting existing rpath: ($rpath)"
install_name_tool -delete_rpath $rpath $eonclient_path
}

# Add a single, correct rpath
print "INFO: Adding correct rpath: @loader_path/../lib"
install_name_tool -add_rpath "@loader_path/../lib" $eonclient_path

print "INFO: Rpath fix applied. Verifying with otool:"
otool -l $eonclient_path | grep LC_RPATH -A 2
}
109 changes: 109 additions & 0 deletions recipes/eon/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
context:
version: "2.8.0"
build_num: 0

package:
name: eon
version: ${{ version }}

source:
url: https://github.com/TheochemUI/eOn/archive/refs/tags/v${{ version }}.tar.gz
sha256: ab2c30c69c699242233458a923205fff5464aca711310e31d9acb39472976a11

build:
number: ${{ build_num }}
skip:
- win
dynamic_linking:
binary_relocation:
- if: osx
then: false
script:
file: build.nu
requirements:
build:
- ninja
- meson
- sccache
- cmake
- nushell
- git
- if: (build_platform != target_platform)
then:
- python
- cross-python_${{ target_platform }}
- if: osx
then: llvm-openmp
host:
- python
- pip
- numpy
- pyyaml
- setuptools
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
- ${{ compiler('fortran') }}
- if: osx # xref: https://github.com/scipy/scipy/issues/23361
then: gfortran_impl_osx-64 >14
- ${{ stdlib('c') }}
- if: true # metatomic_enabled
then:
# always build against the CPU version of libtorch, we can still pick
# the cuda one at runtime [1]
- libtorch >=2.7,<2.8 cpu*
- libmetatomic-torch >=0.1.2,<0.2
- libmetatensor-torch
- eigen >=3.4,<3.5
- libblas
- libcblas
- liblapack
- liblapacke
- fmt
- spdlog
- if: osx
then: llvm-openmp
run:
- python
- pyyaml
- numpy
- eigen
- fmt
- spdlog
- if: true # metatomic_enabled
then:
- libtorch >=2.7,<2.8 cpu*
- libmetatomic-torch >=0.1.2,<0.2
- libmetatensor-torch
- if: osx
then: llvm-openmp

tests:
- python:
imports:
- eon.server
- script:
- eonclient -h
- conda inspect linkages -p $PREFIX $PKG_NAME
- if: osx
then:
- conda inspect objects -p $PREFIX $PKG_NAME
requirements:
run:
- conda-build

about:
homepage: https://eondocs.org/
license: BSD-3-Clause
license_family: BSD
license_file: LICENSE
summary: "Algorithms for long time scales and potential energy surface exploration"
description: |
The EON software package contains algorithms used primarily to model the
evolution of atomic scale systems over long time scales. This version is
instrumented for working with Metatensor.
documentation: https://eondocs.org/index.html
repository: https://github.com/TheochemUI/eOn

extra:
recipe-maintainers:
- HaoZeke
9 changes: 9 additions & 0 deletions recipes/eon/variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
c_stdlib_version:
- if: osx and x86_64
then: '11.0'
MACOSX_SDK_VERSION:
- if: osx and x86_64
then: '11.0'
MACOSX_DEPLOYMENT_TARGET:
- if: osx and x86_64
then: '11.0'