SFML community forums

Help => General => Topic started by: Anonymouseable on July 02, 2013, 05:15:26 pm

Title: Role of extlibs in build
Post by: Anonymouseable on July 02, 2013, 05:15:26 pm
Hi,

I've been working on writing a homebrew (http://brew.sh/) formula for SFML, and am slightly perplexed as to why/how the extlibs are necessary. Why not install them separately?

Anyway, in this scenario, I see 2 options:
Which of these would be preferable, or can anyone propose another alternative?

Thanks in advance.

EDIT:
Quote from: Homebrew website
Homebrew won’t install files outside its prefix, and you can place a Homebrew installation wherever you like.
I can't break this convention if I want the formula to get included in the main Homebrew repository, so seeing as Mac OS doesn't search /usr/local/ for frameworks (right? correct me if I'm wrong) installing frameworks from a homebrew formula isn't really a possibility/desirable functionality.
Title: Re: Role of extlibs in build
Post by: eXpl0it3r on July 02, 2013, 05:42:15 pm
I'm not experienced with OS X at all, but it applies to all the different OS.
The short answer is: convenience.
The long one, if you have precompiled versions of SFML, you have to make sure, that the external libraries which SFML links to are always of the same version. So while the current version might match the other libraries, it might not be the case in the future, so someone will have to maintain the repository of SFML. By providing fixed external libraries, it's guaranteed that it will work no matter what and the user won't have to manually install and maybe compile the other libraries.

If Homebrew can work against the problem of incompatibility you might just use the external libraries from there.
Title: Re: Role of extlibs in build
Post by: Hiura on July 02, 2013, 08:20:35 pm
For reference, here is some work done to create a Formula for Homebrew with a beginning of discussion: https://github.com/mxcl/homebrew/pull/20765

Currently, I'm not sure how to approach this issue. I'm not experienced enough with Homebrew, I guess. But it would really be nice to make `brew install sfml` possible. :)

In the discussion on github I mentioned, vaguely, the possibility to use a special patch to build SFML from brew. I don't know exactly how the patching system works with brew but I've seen it with vim formula, I think. But here are a (non-exhaustive) list of issues that need to be addressed with such patch:

Title: Re: Role of extlibs in build
Post by: Anonymouseable on July 03, 2013, 12:07:30 am
For reference, here is some work done to create a Formula for Homebrew with a beginning of discussion: https://github.com/mxcl/homebrew/pull/20765
Yes, that was me (see the similar name? ;) )
Having messed up quite a bit in the pull request and whatnot, I'm starting the formula anew. This is why I actually created this thread.

Currently, I'm not sure how to approach this issue. I'm not experienced enough with Homebrew, I guess. But it would really be nice to make `brew install sfml` possible. :)

In the discussion on github I mentioned, vaguely, the possibility to use a special patch to build SFML from brew. I don't know exactly how the patching system works with brew but I've seen it with vim formula, I think. But here are a (non-exhaustive) list of issues that need to be addressed with such patch:

  • Xcode templates needs sndfile.framework, freetype.framework and SFML frameworks in /Library/Frameworks/. If they are saved in another location, such as /usr/local/somewhere, that's not an issue as long as this location is fixed and can be determined when installing the templates. I can create a patch for the current template to do that quite easily.
  • Xcode templates needs sndfile.framework and freetype.framework. This is because the shell script used by the templates expect frameworks. But a patch can easily be written to use dylibs instead of frameworks.
  • Xcode templates need to be installed in /Library/Developer/Xcode/Templates/. You mentioned that brew won't install anything outside its prefix. This can be worked around with some linking, I think. I've seen some formulae installing application to ~/Applications.
  • Theoretically, custom version of extlibs can be used to compile SFML when configuring properly CMake. I haven't tested it though. But, as eXpl0it3r said, it would be easier to use brew version of these external libs.
  • If SFML is compiled as frameworks, but are not installed in /Library/Frameworks, and cannot be linked there, I can patch the Xcode templates and make sure the compiler will look for them in the right place.
You participated in the discussion on github? Are you mantognini?
So, now for addressing these...


*(http://soundray.org/linus/inception.png)
Title: Re: Role of extlibs in build
Post by: Hiura on July 03, 2013, 09:13:24 pm
Yep, that was me on github.


If you're stuck at any point with the formula let me know.
Title: Re: Role of extlibs in build
Post by: Anonymouseable on July 10, 2013, 07:07:44 pm
So I've finally had some time to look at it (been busy, moving to a different country and whatnot).

Homebrew simply doesn't seem to be framework-friendly enough. The freetype and sndfile formulae both don't support building/installing frameworks. This leaves us with three options (as far as I can tell):
None of these are great, but homebrew simply doesn't have any in-house support or standardisation for frameworks so to me it seems nicer to just leave them out completely.


EDIT: I've done option 3, having added an option in the SFML CMakeLists that allows the user to decide not to use the extlibs. I've put it in a patch which I've included in the formula as well as submitting a pull request for this option at the SFML github repo. I'll wait for some input on the whole thing before making a pull request to homebrew; meanwhile you can check it out on the appropriate branch in my fork of homebrew (https://github.com/Anonymooseable/homebrew/tree/sfml).
Title: Re: Role of extlibs in build
Post by: Hiura on July 10, 2013, 11:48:19 pm
Not sure what you exactly mean by «drop framework support» so here is how I would do it (maybe it's what you have in mind but for the sake of clarity..):

since the Xcode templates already supports dylibs for SFML, and because it is relatively simple to modify them to import sndfile and freetype as dylibs to the built bundle application, we can keep the framework support for manual compilation and only use dylib compilation with the brew formula.
Title: Re: Role of extlibs in build
Post by: Anonymouseable on July 11, 2013, 12:11:08 am
Yes, that's what I meant - not supporting frameworks from the homebrew formula at all.

Also my patch that allows choosing not to use the extlibs seems to be generating quite some controversy... *sigh* I guess I'll just include it in the formula.
Title: Re: Role of extlibs in build
Post by: Hiura on July 11, 2013, 12:02:37 pm
Quote
I guess I'll just include it in the formula.
I don't think it's a good idea: the patch can become invalid if we edit some files on the git.

Plus, having this discussion is quite important to find the best way to do it.
Title: Re: Role of extlibs in build
Post by: Hiura on July 11, 2013, 12:34:33 pm
There is something we haven't discussed yet.

What about older OS version? I fear that using homebrew to build SFML for older OS version (say, 10.5 since we currently support it) won't be possible.

One other thing: what happen when SFML if build & installed with freetype x.y and then freetype is upgraded to x.z or v.w without rebuilding SFML? That may introduced some incompatibility, or am I wrong?
Title: Re: Role of extlibs in build
Post by: Anonymouseable on July 15, 2013, 11:34:28 pm
There is something we haven't discussed yet.

What about older OS version? I fear that using homebrew to build SFML for older OS version (say, 10.5 since we currently support it) won't be possible.

One other thing: what happen when SFML if build & installed with freetype x.y and then freetype is upgraded to x.z or v.w without rebuilding SFML? That may introduced some incompatibility, or am I wrong?
I'm not sure. We'd have to test it. I need to ask my dad if he has some OS 10.5 installation media, if he does I can test it in a VM.

The other thing: I'm also not sure. I think they should be compatible.