mrklein / openfoam-os-x

Patches for OpenFOAM(R) to build it on OS X
93 stars 33 forks source link

macports use #41

Closed jjstickel closed 6 years ago

jjstickel commented 6 years ago

After a 2 year break, I'm back to using OpenFOAM again on my mac using Macports for dependencies (openmpi, etc.). I'm happy to report that your patch (version 5.0) worked! No edits were needed. Thanks much for continuing to provide these patches.

I do have one question. I spent some time double checking that things would link properly to my macports libraries. I edited etc/config.sh/mac/functions so that line 71 is version="port installed $pkg | grep '(active)' | awk -F '[@|_]' '{print $2}'" but I can't tell if it is doing anything. In fact, everything built and seems to work with or without making this edit (I can run decomposePar with scotchCoeffs in either case). Do you think this edit is helpful? Should I provide a pull request?

mrklein commented 6 years ago

Hi,

Thank you for the report.

In fact _foamGetPackageVersion function is used just for reporting of versions and does not influence much compilation process. It would be more valuable to have _foamGetPackageArchPath, which deals correctly with MacPorts, since result of this function do influence compilation.

Theres is no need in pull request, I just include the line, you have provided, in the next version of patch-set, if you do not have objections. I will add attribution in the beginning of mac/functions file.

jjstickel commented 6 years ago

Sure, please do make that edit in your next version.

From what I can tell, _foamGetPackageArchPath results in the parent directory for macports, usually /opt/local. Considering that macports installs files into /opt/local similarly to linux/unix systems, i.e., into the subdirectories bin/, include/, lib/, etc., this seems OK to me. Is this what you envisioned?

As an aside, how can I check the outputs of the functions in etc/config.sh/mac/functions? Is the file sourced when etc/bashrc is sourced?

mrklein commented 6 years ago

Yes, for default installation it is easy, we take port path, remove extra items, and get prefix of all packages. And in fact, this way it is implemented now. Yet I do not know if it is possible to have Macports binaries/libraries installed in one place and packages in another. Homebrew has flag --prefix to query for package installation path, do you know if there is something similar in Macports?

Yes, etc/config.sh/mac/function is sourced in bashrc (line 149).

jjstickel commented 6 years ago

Macports contains packages as tarballs and then unzips them into their place. For standard libraries like scotch and metis, that is directly into $prefix (/opt/local). So I think things are good as you have it. Feel free to close this issue.

As an aside, Python goes into a python-frameworks folder tree (also in /opt/local), and packages that are apple applications go into /Applications/MacPorts.

mrklein commented 6 years ago

Thank you for reply. Will close the issue after committing new version of patches.