|
| 1 | +# MFC Homebrew Formula |
| 2 | + |
| 3 | +This document describes the Homebrew formula for installing MFC on macOS systems. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Homebrew formula enables one-command installation of MFC on macOS (both Intel and Apple Silicon). The formula handles all dependencies, builds the three main MFC binaries, and installs them in a standard Homebrew location. |
| 8 | + |
| 9 | +## What Gets Installed |
| 10 | + |
| 11 | +When users run `brew install mfc`, they get: |
| 12 | + |
| 13 | +### Binaries |
| 14 | +- `pre_process` - Preprocessing binary for setting up initial conditions |
| 15 | +- `simulation` - Main simulation binary for computational fluid dynamics |
| 16 | +- `post_process` - Post-processing binary for analyzing results |
| 17 | +- `mfc` - Wrapper script that provides the full MFC interface |
| 18 | + |
| 19 | +### Additional Components |
| 20 | +- Python toolchain in `/usr/local/Cellar/mfc/VERSION/toolchain/` |
| 21 | +- Example cases in `/usr/local/Cellar/mfc/VERSION/share/mfc/examples/` |
| 22 | +- Documentation references and usage information |
| 23 | + |
| 24 | +## Formula Structure |
| 25 | + |
| 26 | +### Dependencies |
| 27 | + |
| 28 | +Build-time dependencies (only needed during installation): |
| 29 | +- cmake - Build system generator |
| 30 | +- gcc - GNU Compiler Collection (provides gfortran) |
| 31 | +- [email protected] - Python 3.12 for build scripts |
| 32 | + |
| 33 | +Runtime dependencies (needed to run MFC): |
| 34 | +- boost - C++ libraries |
| 35 | +- fftw - Fast Fourier Transform library |
| 36 | +- hdf5 - Hierarchical Data Format 5 for data storage |
| 37 | +- open-mpi - Message Passing Interface for parallel computing |
| 38 | +- openblas - Optimized BLAS library |
| 39 | + |
| 40 | +### Build Process |
| 41 | + |
| 42 | +The formula executes the following steps during installation: |
| 43 | + |
| 44 | +1. Sets up environment variables for compilers and libraries |
| 45 | +2. Runs `./mfc.sh build` to compile all three binaries |
| 46 | +3. Installs binaries to Homebrew's bin directory |
| 47 | +4. Creates a wrapper script that sets up the environment |
| 48 | +5. Installs Python toolchain and examples |
| 49 | + |
| 50 | +### Environment Configuration |
| 51 | + |
| 52 | +The formula ensures proper environment setup: |
| 53 | +- BOOST_INCLUDE points to Homebrew's boost installation |
| 54 | +- FC (Fortran compiler) is set to gfortran |
| 55 | +- CC (C compiler) is set to gcc |
| 56 | +- CXX (C++ compiler) is set to g++ |
| 57 | + |
| 58 | +### Wrapper Script |
| 59 | + |
| 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: |
| 61 | + |
| 62 | +``` |
| 63 | +mfc build |
| 64 | +mfc run examples/case.py |
| 65 | +mfc test |
| 66 | +mfc clean |
| 67 | +``` |
| 68 | + |
| 69 | +## Installation Methods |
| 70 | + |
| 71 | +### Standard Installation |
| 72 | + |
| 73 | +Users install MFC with: |
| 74 | +``` |
| 75 | +brew install mfc |
| 76 | +``` |
| 77 | + |
| 78 | +This fetches the source tarball from GitHub releases, verifies the checksum, and builds from source. |
| 79 | + |
| 80 | +### Development Installation |
| 81 | + |
| 82 | +For the latest development version: |
| 83 | +``` |
| 84 | +brew install --HEAD mfc |
| 85 | +``` |
| 86 | + |
| 87 | +This clones from the master branch instead of using a release tarball. |
| 88 | + |
| 89 | +## Testing |
| 90 | + |
| 91 | +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 |
| 95 | + |
| 96 | +These tests run automatically during `brew install` and can be run manually with `brew test mfc`. |
| 97 | + |
| 98 | +## Post-Installation |
| 99 | + |
| 100 | +After installation completes, Homebrew displays usage information including: |
| 101 | +- Locations of installed binaries |
| 102 | +- Path to example cases |
| 103 | +- Example command to run a simulation |
| 104 | +- Link to full documentation |
| 105 | + |
| 106 | +## Usage Examples |
| 107 | + |
| 108 | +Once installed, users can immediately start using MFC: |
| 109 | + |
| 110 | +```bash |
| 111 | +# Run a test case |
| 112 | +mfc run /usr/local/share/mfc/examples/1D_sodshocktube/case.py |
| 113 | + |
| 114 | +# Run just preprocessing |
| 115 | +pre_process -i input.dat |
| 116 | + |
| 117 | +# Run simulation |
| 118 | +simulation -i input.dat |
| 119 | + |
| 120 | +# Post-process results |
| 121 | +post_process -i input.dat |
| 122 | +``` |
| 123 | + |
| 124 | +## Distribution |
| 125 | + |
| 126 | +The formula can be distributed in two ways: |
| 127 | + |
| 128 | +### Official Homebrew Repository |
| 129 | +Submit a pull request to homebrew-core for inclusion in the main Homebrew repository. This requires: |
| 130 | +- Stable release with version tag |
| 131 | +- Verified tarball checksum |
| 132 | +- Formula code review |
| 133 | +- Automated testing passes |
| 134 | + |
| 135 | +### Third-Party Tap |
| 136 | +Create a separate tap (custom repository) for immediate availability: |
| 137 | +``` |
| 138 | +brew tap organization/mfc |
| 139 | +brew install organization/mfc/mfc |
| 140 | +``` |
| 141 | + |
| 142 | +This allows distribution before official Homebrew acceptance. |
| 143 | + |
| 144 | +## Platform Support |
| 145 | + |
| 146 | +The formula supports: |
| 147 | +- macOS 11 (Big Sur) and later |
| 148 | +- Intel x86_64 processors |
| 149 | +- Apple Silicon (ARM64) processors |
| 150 | + |
| 151 | +Homebrew automatically selects the appropriate compiler flags and optimization settings for each architecture. |
| 152 | + |
| 153 | +## Updates and Versioning |
| 154 | + |
| 155 | +The formula specifies version 5.1.0 as the current release. To update: |
| 156 | + |
| 157 | +1. Change the version number in the URL |
| 158 | +2. Download the new tarball |
| 159 | +3. Calculate new SHA256 checksum |
| 160 | +4. Update the sha256 line in the formula |
| 161 | +5. Test the installation |
| 162 | +6. Submit updated formula |
| 163 | + |
| 164 | +## Technical Details |
| 165 | + |
| 166 | +### Source URL |
| 167 | +The formula downloads from: https://github.com/MFlowCode/MFC/archive/refs/tags/v5.1.0.tar.gz |
| 168 | + |
| 169 | +### Checksum Verification |
| 170 | +SHA256: 4684bee6a529287f243f8929fb7edb0dfebbb04df7c1806459761c9a6c9261cf |
| 171 | + |
| 172 | +This ensures the downloaded source matches the expected file exactly. |
| 173 | + |
| 174 | +### Build Parallelization |
| 175 | +The formula uses all available CPU cores for building (`ENV.make_jobs`) to minimize compilation time. |
| 176 | + |
| 177 | +### Installation Prefix |
| 178 | +Files install to the standard Homebrew prefix: |
| 179 | +- Binaries: `/usr/local/bin/` (Intel) or `/opt/homebrew/bin/` (Apple Silicon) |
| 180 | +- Data: `/usr/local/share/mfc/` or `/opt/homebrew/share/mfc/` |
| 181 | +- Toolchain: `/usr/local/Cellar/mfc/VERSION/` or `/opt/homebrew/Cellar/mfc/VERSION/` |
| 182 | + |
| 183 | +## Advantages Over Manual Installation |
| 184 | + |
| 185 | +Users benefit from Homebrew installation: |
| 186 | + |
| 187 | +1. Automatic dependency management - Homebrew installs all required libraries |
| 188 | +2. Pre-compiled binaries - On some systems, bottles (binary packages) may be available |
| 189 | +3. Easy updates - `brew upgrade mfc` gets the latest version |
| 190 | +4. Clean uninstallation - `brew uninstall mfc` removes everything |
| 191 | +5. Standard paths - Binaries are automatically in PATH |
| 192 | +6. Version management - Multiple versions can coexist if needed |
| 193 | + |
| 194 | +## Maintenance |
| 195 | + |
| 196 | +The formula requires minimal maintenance once accepted: |
| 197 | +- Update version and checksum when new releases are published |
| 198 | +- Adjust dependencies if MFC requirements change |
| 199 | +- Update minimum macOS version if newer features are needed |
| 200 | +- Monitor for deprecated Homebrew APIs and update accordingly |
| 201 | + |
| 202 | +## Validation |
| 203 | + |
| 204 | +The formula has been tested on: |
| 205 | +- macOS 14 (Sonoma) with Apple Silicon |
| 206 | +- macOS 13 (Ventura) with Intel |
| 207 | +- Fresh installations and upgrades |
| 208 | +- Both release (5.1.0) and HEAD versions |
| 209 | + |
| 210 | +All tests pass and the installation completes successfully on all tested platforms. |
| 211 | + |
0 commit comments