Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2.2 - OSX Install script  (Read 5962 times)

0 Members and 2 Guests are viewing this topic.

LudVichzme

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML 2.2 - OSX Install script
« on: December 31, 2014, 10:46:53 am »
Hi everyone,

I just wanted to know why installation script is no longer included in SFML 2.2 package for OSX ?
In version 2.1, there was an install.sh script, but nothing in the 2.2.

The 2.1 installation script seems to work fine with version 2.2 (so I used it).

Thanks :)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 - OSX Install script
« Reply #1 on: December 31, 2014, 11:50:03 am »
This script works for some people but not everyone. I had not enough time to upgrade it for 2.2 file structure and make it 100% robust against issues such as permissions. So I decided to let people manually copy stuff.

But if you say it works fine, that's good news.  :)
SFML / OS X developer

LudVichzme

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML 2.2 - OSX Install script
« Reply #2 on: December 31, 2014, 02:34:16 pm »
Thanks for the answer :)

Let me know if I can help you making a new installation script.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 - OSX Install script
« Reply #3 on: January 01, 2015, 09:24:25 pm »
Thanks. I think I'll focus on homebrew formula instead. If you have any expertise in the domain, help is always welcome. https://github.com/SFML/SFML/issues/620  ;)
SFML / OS X developer

LudVichzme

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML 2.2 - OSX Install script
« Reply #4 on: January 02, 2015, 01:21:45 pm »
Never made brew formula, but i'll take a look :)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 - OSX Install script
« Reply #5 on: January 02, 2015, 02:10:45 pm »
There's an ongoing discussion over there (if you find the courage to go through it). https://github.com/Homebrew/homebrew/pull/35279
SFML / OS X developer

LudVichzme

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML 2.2 - OSX Install script
« Reply #6 on: January 02, 2015, 03:17:18 pm »
I've read this looooong discussion :).

Btw, I think that there are two distinct problems, which don't directly concern brew :
  • XCode templates, which must have a specific configuration to copy dylibs which have been generated via brew
  • Cmake configuration, to allow build to skip extlibs
(in fact, that's just what you written on the original issue (620))

Well, I don't want to "pollute" the Github discussions, so I'm gonna write here for the moment :)

In the CMakeLists.txt, there are the following lines :
Quote
install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
    install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})

Since I never used cmake, maybe I'm wrong but can't we "just" make those paths dynamic, and set them passing a parameter to cmake inside the brew formula ?

EDIT : Or maybe we can use brew's patch feature, to apply a diff to the files when using the formula.

If you thinks it can be enough, I may try to do it.

(Oh and sorry if my English is bad, it's not my native language :D)
« Last Edit: January 02, 2015, 03:20:32 pm by LudVichzme »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 - OSX Install script
« Reply #7 on: January 02, 2015, 06:43:54 pm »
Thanks for the energy you put into this.  :)

In the CMakeLists.txt, there are the following lines :
Quote
install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
    install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})

Since I never used cmake, maybe I'm wrong but can't we "just" make those paths dynamic, and set them passing a parameter to cmake inside the brew formula ?
Better yet, since those two lines in fact install freetype and sndfile from extlibs on the system, if they were not used (i.e. the libs come from brew or another install) then we could simply skip those two lines with an if statement.

Quote
Or maybe we can use brew's patch feature, to apply a diff to the files when using the formula.
Yes, that could be another option. But keeping the patch as minimal as possible would be better to be easily updated if needed when we change something in SFML script.
SFML / OS X developer

LudVichzme

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML 2.2 - OSX Install script
« Reply #8 on: January 02, 2015, 07:35:33 pm »
Thanks for the answer :)

I've made a little test, with a custom CMakeLists, in which I removed the extlibs lines (just to test).

Compilation works fine, and I'm able to create a SFML App with the template within XCode, compile and run it (the music and the font are working, so I think it's good :) ).

I've made the following changes to the project:
 
  • Use dylibs instead of frameworks
  • Disable i386 compilation
  • Edit the post-build script to disable sndfile.framework  and freetype.framework copy to the app package.

And an otool -L /usr/local/Cellar/sfml/HEAD/lib/libsfml-audio.dylib indicates that the lib use /usr/local/lib/libsndfile.1.dylib...Which is a symlink created via brew for libsndfile (/usr/local/Cellar/libsndfile/1.0.25/lib/libsndfile.1.dylib).

So I think that since there are no Frameworks, the system fallback to /usr/local/lib, and found the most recent available lib, which is the brewed one.

I will now try to add a simple if statement to the CMakeLists, in order to be able to disable extlibs usage :)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 - OSX Install script
« Reply #9 on: January 02, 2015, 10:05:36 pm »
Brillant! :)

Let me know when you have something ready. Maybe have a chat with DomT4 (on the github discussion) who also seems to work on that.
SFML / OS X developer

LudVichzme

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML 2.2 - OSX Install script
« Reply #10 on: January 02, 2015, 10:18:05 pm »
I just pushed my CMakeLists.txt on my branch :
https://github.com/ludvichzme/SFML/blob/brew/CMakeLists.txt

It just adds a new option : SFML_INSTALL_EXTLIBS (default TRUE), which allow to skip the extlibs installation.

And my custom brew formula (actually use my local git branch) :
Quote
require "formula"

class Sfml < Formula
  homepage "http://www.sfml-dev.org/"

  head "/Users/ludovic/Development/projects/SFML-B", :using => :git, :branch => 'brew'

  depends_on "cmake" => :build
  depends_on "freetype"
  depends_on "glew"
  depends_on "jpeg"
  depends_on "libsndfile"

  def install
    system "cmake", ".", "-DSFML_INSTALL_EXTLIBS=FALSE", *std_cmake_args
    system "make", "install"
  end
end

I'm gonna update the XCode template in my branch soon :)
So the only thing that will be missing in the brew formula will be installing them.

But there might be a little problem : if we want the brew formula to build stable sources (from a static zip file), you'll need to upload a new archive with the updated CMakeLists.

And also, since this change the CMakeLists, I think Laurent should review this (don't know if he will accept this new option :))


Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 2.2 - OSX Install script
« Reply #11 on: January 03, 2015, 04:04:59 pm »
Great! I dropped you a line on github about an alternative implementation.

Quote
I'm gonna update the XCode template in my branch soon
Don't lose too much of your time on that: it's a mess. Apple doesn't provide any documentation so good luck to understand a thing without spending hours...

The good news is that I see pretty clearly what should be done about them. Beside that, I've already made some change in another branch that should get merged before the end of the month (hopefully). So I'd rather work on it after it's merged to avoid conflicts.  ::)

There's also the issue that brew doesn't allow files to be installed outside /usr/local. But this has to be confirmed.

Quote
But there might be a little problem : if we want the brew formula to build stable sources (from a static zip file), you'll need to upload a new archive with the updated CMakeLists.
We are trying to release SFML 2.3 very soon, most probably in less than 3 months from now, hopefully only 2 months. So we could include the change we want/need by then and be ready to officially support brew formula with SFML 2.3.

The code would have to be reviewed by the team, of course. But that's just a minor detail.
SFML / OS X developer

 

anything