Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsbml 5.20.2 (new formula) #1672

Merged
merged 6 commits into from
May 6, 2024
Merged

libsbml 5.20.2 (new formula) #1672

merged 6 commits into from
May 6, 2024

Conversation

Waschina
Copy link
Contributor

libsbml is a library for handling text files in Systems Biology Markup Language (SBML).

A brief explanation for the additional configuration flags (-DENABLE_FBC=ON -DENABLE_GROUPS=ON):

These enable two optional extensions for the libsbml library, namely "fbc" and "groups". Both are relevant for the research community that uses linear programming to predict metabolic processes in living cells (i.e., flux balance analysis). apt and dnf linux builds also include these two extensions.

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source FORMULA, where FORMULA is the name of the formula you're submitting?
  • Does your build pass brew audit --strict FORMULA (after doing brew install FORMULA)?

This is my first formula. Any feedback is welcome.

libsbml is a library for handling text files in Systems Biology Markup Language (SBML).

Brief explanation for the additional configuration flags (-DENABLE_FBC=ON -DENABLE_GROUPS=ON):

These enable two optional extensions for the libsbml library, namely "fbc" and "groups". Both are relevant for the research community that uses linear programming to predict metabolic processes in living cells (i.e., flux balance analysis). apt and dnf linux builds also include these two extensions.
These updates address the errors from the CI's previous logs:

`Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR)`
`Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)`
@Waschina
Copy link
Contributor Author

Thank you for approving the CI workflows.

2024-04-25T01:11:02.0384350Z /opt/homebrew/share/cmake/Modules/FindZLIB.cmake -> /opt/homebrew/Cellar/cmake/3.29.2/share/cmake/Modules/FindZLIB.cmake

There seems to be a conflict with the cmake module FindZLIB. cmake itself provides a module under this name, and libSBML comes with its own module using the same name.

Does anyone know how to handle such a conflict in a formula?

@YoshitakaMo
Copy link
Contributor

YoshitakaMo commented Apr 28, 2024

Thank you for submitting a new formula!
Please test this:

  depends_on "check" => :build
  depends_on "cmake" => :build
  depends_on "pkg-config" => :build
  depends_on "swig" => :build

  uses_from_macos "bzip2"
  uses_from_macos "libxml2"
  uses_from_macos "zlib"

  def install
    # avoid an error "invalid conversion from ‘const xmlError*’"
    ENV.append_to_cflags "-fpermissive" if OS.linux?
    args = %w[
      -DWITH_SWIG=OFF
      -DWITH_ZLIB=OFF
      -DWITH_BZIP2=OFF
      -DENABLE_COMP=ON
      -DENABLE_FBC=ON
      -DENABLE_GROUPS=ON
      -DENABLE_L3V2EXTENDEDMATH=ON
      -DENABLE_LAYOUT=ON
      -DENABLE_MULTI=ON
      -DENABLE_QUAL=ON
      -DENABLE_RENDER=ON
    ]
    args << "-DLIBSBML_DEPENDENCY_DIR=#{HOMEBREW_PREFIX}"
    system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
    system "cmake", "--build", "build"
    system "cmake", "--install", "build"
  end
  • -DWITH_BZIP2=OFF and -DWITH_ZLIB=OFF are required to solve the conflict.
  • -DLIBSBML_DEPENDENCY_DIR=#{HOMEBREW_PREFIX} is required to use Homebrew's libxml2 (for Linux).
  • CFLAGS="-fpermissive" was required to compile on Linux.
  • If a formula dependency is required on all platforms but can be handled by a component that ships with macOS, specify it with uses_from_macos. On Linux it acts like depends_on, while on macOS it’s ignored unless the host system is older than the optional since: parameter.
  • Other arguments were copied from Bioconda's recipes

- Build without swig
- Build without zlib (Note: this was disabled intentionally due to a conflict between libsbml and cmake. The conflict is because both tools come with a cmake module called "FindZLIB". Unfortunately, diabling zlib in libsbml has the effect, that .zip or .gz-compressed SBML files cannot be read nor written.)
- Enables additional extensions of libsbml in case other users require these: "L3V2EXTENDEDMATH", "LAYOUT", "MULTI", "QUAL", "RENDER".

Thanks to @YoshitakaMo
@Waschina
Copy link
Contributor Author

Waschina commented May 3, 2024

Thank you, @YoshitakaMo, for the suggestion and for explaining the changes.

I made only minor modifications to your suggested formula:

  • re-included bzip2 since this dependency seems to be without conflict
  • removed uses_from_macos "zlib" since zlib is disabled as a dependency of libsbml with the -DWITH_ZLIB=OFF flag
  • removed swig as build dependency since it is turned off with -DWITH_SWIG=OFF.

@YoshitakaMo
Copy link
Contributor

I guess args << "-DLIBSBML_DEPENDENCY_DIR=#{HOMEBREW_PREFIX}" is required to pass the CI.

@Waschina
Copy link
Contributor Author

Waschina commented May 5, 2024

Sorry, that I missed that line. It's now committed

@YoshitakaMo YoshitakaMo merged commit 34f9b43 into brewsci:develop May 6, 2024
4 checks passed
@YoshitakaMo
Copy link
Contributor

Merged! Thank you for your PR!

@Waschina Waschina deleted the libsbml branch May 6, 2024 08:34
@Waschina
Copy link
Contributor Author

Waschina commented May 6, 2024

Awesome! Thank you for being so helpful @YoshitakaMo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants