You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- hdf5 - Hierarchical Data Format 5 for data storage
37
39
- open-mpi - Message Passing Interface for parallel computing
38
40
- openblas - Optimized BLAS library
41
+
-[email protected] - Python 3.12 (used for build scripts and runtime virtual environment)
42
+
43
+
Python package dependencies (installed in virtual environment):
44
+
- cantera==3.1.0 - Chemical kinetics library (required for MFC build and runtime)
45
+
- MFC toolchain package - Python utilities for MFC operations (installed in editable mode)
46
+
47
+
### Virtual Environment Setup
48
+
49
+
Before building, the formula creates a Python virtual environment to isolate MFC's Python dependencies:
50
+
51
+
1. Creates a new virtual environment in `libexec/venv` using Python 3.12
52
+
2. Upgrades pip, setuptools, and wheel to latest versions
53
+
3. Installs Cantera 3.1.0 from PyPI (required dependency for MFC)
54
+
4. Installs the MFC toolchain package in editable mode (`-e`) to avoid RECORD file issues
55
+
5. Creates a symlink from `build/venv` to the venv so `mfc.sh` can find it during build
56
+
57
+
This virtual environment persists after installation and is used by the wrapper script at runtime.
39
58
40
59
### Build Process
41
60
42
61
The formula executes the following steps during installation:
43
62
44
-
1. Runs `./mfc.sh build` to compile all three binaries
45
-
2. Installs binaries to Homebrew's bin directory
46
-
3. Installs mfc.sh to libexec for script execution
47
-
4. Installs Python toolchain (required for mfc.sh functionality)
48
-
5. Installs examples to share directory
49
-
6. Creates a wrapper script that sets up the environment
63
+
1.**Virtual Environment Setup** (see section above)
64
+
2. Sets `VIRTUAL_ENV` environment variable so `mfc.sh` uses the pre-configured venv
65
+
3. Runs `./mfc.sh build -t pre_process simulation post_process -j <cores>` to compile all three binaries
66
+
4. Installs binaries from `build/install/*/bin/*` to Homebrew's bin directory
67
+
5. Installs `mfc.sh` to `libexec/` for script execution
68
+
6. Installs Python toolchain directory to `prefix/toolchain/` (required for mfc.sh functionality)
69
+
7. Installs examples directory to `prefix/examples/`
70
+
8. Creates and installs the `mfc` wrapper script that handles runtime environment setup
50
71
51
72
### Environment Configuration
52
73
@@ -57,7 +78,18 @@ The formula relies on Homebrew's automatic environment setup:
57
78
58
79
### Wrapper Script
59
80
60
-
The installed `mfc` wrapper provides the complete MFC interface. It automatically configures the environment and delegates to the main `mfc.sh` script. Users can run any MFC command through this wrapper:
81
+
The installed `mfc` wrapper provides the complete MFC interface. Due to Homebrew's read-only Cellar structure, the wrapper implements a sophisticated workaround:
82
+
83
+
**Key Features:**
84
+
1.**Temporary Working Directory**: Creates a temporary directory since the Cellar is read-only and `mfc.sh` may need to write build artifacts
85
+
2.**Environment Setup**: Copies `mfc.sh`, toolchain, examples, and the virtual environment to the temp directory
86
+
3.**Toolchain Patching**: Dynamically patches the toolchain Python code to:
87
+
- Use pre-installed binaries from Homebrew's bin directory instead of building new ones
88
+
- Skip building main targets (`pre_process`, `simulation`, `post_process`, `syscheck`) since they're already installed
89
+
4.**Build Optimization**: Automatically adds `--no-build` flag to `mfc run` commands to skip unnecessary compilation
90
+
5.**Cleanup**: Automatically removes the temporary directory when the command completes
91
+
92
+
Users can run any MFC command through this wrapper:
61
93
62
94
```bash
63
95
mfc build
@@ -66,6 +98,8 @@ mfc test
66
98
mfc clean
67
99
```
68
100
101
+
The wrapper ensures all MFC functionality works correctly while respecting Homebrew's installation constraints.
102
+
69
103
## Installation Methods
70
104
71
105
### Standard Installation
@@ -89,9 +123,11 @@ This clones from the master branch instead of using a release tarball.
89
123
## Testing
90
124
91
125
The formula includes automated tests that verify:
92
-
- All three binary files exist after installation
93
-
- The mfc wrapper script is functional
94
-
- The help command executes without errors
126
+
- All three binary files exist after installation and are executable
127
+
- The Python toolchain directory is installed correctly
128
+
- The virtual environment exists and contains an executable Python interpreter
129
+
- The examples directory is installed
130
+
- The mfc wrapper script is functional and responds to `--help`
95
131
96
132
These tests run automatically during `brew install` and can be run manually with `brew test mfc`.
97
133
@@ -108,8 +144,14 @@ After installation completes, Homebrew displays usage information including:
108
144
Once installed, users can immediately start using MFC:
mfc run /usr/local/share/mfc/examples/1D_sodshocktube/case.py
151
+
mfc run case.py
152
+
153
+
# Or run directly from the installed examples directory
154
+
mfc run $(brew --prefix mfc)/examples/1D_sodshocktube/case.py
113
155
114
156
# Run just preprocessing
115
157
pre_process -i input.dat
@@ -121,6 +163,8 @@ simulation -i input.dat
121
163
post_process -i input.dat
122
164
```
123
165
166
+
Note: The `brew --prefix mfc` command returns the installation prefix (e.g., `/usr/local/Cellar/mfc/VERSION` or `/opt/homebrew/Cellar/mfc/VERSION`), making examples work on both Intel and Apple Silicon systems.
167
+
124
168
## Distribution
125
169
126
170
The formula can be distributed in two ways:
@@ -183,8 +227,10 @@ The formula uses all available CPU cores for building (`ENV.make_jobs`) to minim
183
227
### Installation Prefix
184
228
Files install to the standard Homebrew prefix:
185
229
- Binaries: `/usr/local/bin/` (Intel) or `/opt/homebrew/bin/` (Apple Silicon)
186
-
- Data: `/usr/local/share/mfc/` or `/opt/homebrew/share/mfc/`
187
-
- Toolchain: `/usr/local/Cellar/mfc/VERSION/` or `/opt/homebrew/Cellar/mfc/VERSION/`
230
+
- Main script: `/usr/local/Cellar/mfc/VERSION/libexec/mfc.sh` or `/opt/homebrew/Cellar/mfc/VERSION/libexec/mfc.sh`
231
+
- Toolchain: `/usr/local/Cellar/mfc/VERSION/toolchain/` or `/opt/homebrew/Cellar/mfc/VERSION/toolchain/`
232
+
- Virtual environment: `/usr/local/Cellar/mfc/VERSION/libexec/venv/` or `/opt/homebrew/Cellar/mfc/VERSION/libexec/venv/`
233
+
- Examples: `/usr/local/Cellar/mfc/VERSION/examples/` or `/opt/homebrew/Cellar/mfc/VERSION/examples/`
0 commit comments