-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rui Chen <[email protected]>
- Loading branch information
1 parent
c12ab32
commit 176eb7e
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |