Skip to content

Commit

Permalink
sfml@2 2.6.2 (new formula)
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Chen <[email protected]>
  • Loading branch information
chenrui333 committed Dec 24, 2024
1 parent c12ab32 commit 176eb7e
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions Formula/s/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
class SfmlAT2 < Formula
desc "Multi-media library with bindings for multiple languages"
homepage "https://www.sfml-dev.org/"
url "https://www.sfml-dev.org/files/SFML-2.6.2-sources.zip"
sha256 "19d6dbd9c901c74441d9888c13cb1399f614fe8993d59062a72cfbceb00fed04"
license "Zlib"

keg_only :versioned_formula

depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "flac"
depends_on "freetype"
depends_on "libogg"
depends_on "libvorbis"

on_linux do
depends_on "libx11"
depends_on "libxcursor"
depends_on "libxrandr"
depends_on "mesa"
depends_on "mesa-glu"
depends_on "openal-soft"
depends_on "systemd"
end

def install
# Fix "fatal error: 'os/availability.h' file not found" on 10.11 and
# "error: expected function body after function declarator" on 10.12
# Requires the CLT to be the active developer directory if Xcode is installed
ENV["SDKROOT"] = MacOS.sdk_path if OS.mac? && MacOS.version <= :high_sierra

# Always remove the "extlibs" to avoid install_name_tool failure
# (https://github.com/Homebrew/homebrew/pull/35279) but leave the
# headers that were moved there in https://github.com/SFML/SFML/pull/795
rm_r(Dir["extlibs/*"] - ["extlibs/headers"])

args = %W[
-DCMAKE_INSTALL_RPATH=#{lib}
-DSFML_MISC_INSTALL_PREFIX=#{share}/SFML
-DSFML_INSTALL_PKGCONFIG_FILES=TRUE
-DSFML_BUILD_DOC=TRUE
]
args << "-DSFML_USE_SYSTEM_DEPS=ON" if OS.linux?

system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
(testpath/"test.cpp").write <<~CPP
#include "Time.hpp"
int main() {
sf::Time t1 = sf::milliseconds(10);
return 0;
}
CPP
system ENV.cxx, "-I#{include}/SFML/System", testpath/"test.cpp",
"-L#{lib}", "-lsfml-system", "-o", "test"
system "./test"
end
end

0 comments on commit 176eb7e

Please sign in to comment.