|
| 1 | +class Luanti < Formula |
| 2 | + desc "Free, open source voxel game engine and game" |
| 3 | + homepage "https://www.luanti.org" |
| 4 | + license "LGPL-2.1-or-later" |
| 5 | + |
| 6 | + stable do |
| 7 | + url "https://github.com/luanti-org/luanti/archive/refs/tags/5.11.0.tar.gz" |
| 8 | + sha256 "70e531d0776988ce6e579ea5490fdf6be3e349a4ade5281f5111aa4fdd8ee510" |
| 9 | + |
| 10 | + resource "minetest_game" do |
| 11 | + url "https://github.com/luanti-org/minetest_game/archive/refs/tags/5.8.0.tar.gz" |
| 12 | + sha256 "33a3bb43b08497a0bdb2f49f140a2829e582d5c16c0ad52be1595c803f706912" |
| 13 | + end |
| 14 | + end |
| 15 | + |
| 16 | + livecheck do |
| 17 | + url :stable |
| 18 | + regex(/^v?(\d+(?:\.\d+)+)$/i) |
| 19 | + end |
| 20 | + |
| 21 | + head do |
| 22 | + url "https://github.com/luanti-org/luanti.git", branch: "master" |
| 23 | + |
| 24 | + resource "minetest_game" do |
| 25 | + url "https://github.com/luanti-org/minetest_game.git", branch: "master" |
| 26 | + end |
| 27 | + end |
| 28 | + |
| 29 | + depends_on "cmake" => :build |
| 30 | + depends_on "curl" |
| 31 | + depends_on "freetype" |
| 32 | + depends_on "gettext" |
| 33 | + depends_on "gmp" |
| 34 | + depends_on "jpeg-turbo" |
| 35 | + depends_on "jsoncpp" |
| 36 | + depends_on "libogg" |
| 37 | + depends_on "libpng" |
| 38 | + depends_on "libvorbis" |
| 39 | + depends_on "libx11" |
| 40 | + depends_on "libxi" |
| 41 | + depends_on "libxxf86vm" |
| 42 | + depends_on :linux |
| 43 | + depends_on "luajit" |
| 44 | + depends_on "mesa" |
| 45 | + depends_on "ncurses" |
| 46 | + depends_on "openal-soft" |
| 47 | + depends_on "sqlite" |
| 48 | + depends_on "xinput" |
| 49 | + depends_on "zlib" |
| 50 | + depends_on "zstd" |
| 51 | + |
| 52 | + def install |
| 53 | + # Remove bundled libraries to prevent fallback |
| 54 | + %w[lua gmp jsoncpp].each { |lib| rm_r(buildpath/"lib"/lib) } |
| 55 | + |
| 56 | + (buildpath/"games/minetest_game").install resource("minetest_game") |
| 57 | + |
| 58 | + args = %W[ |
| 59 | + -DBUILD_CLIENT=1 |
| 60 | + -DBUILD_SERVER=0 |
| 61 | + -DENABLE_FREETYPE=1 |
| 62 | + -DCMAKE_EXE_LINKER_FLAGS='-L#{Formula["freetype"].opt_lib}' |
| 63 | + -DENABLE_GETTEXT=1 |
| 64 | + -DCUSTOM_GETTEXT_PATH=#{Formula["gettext"].opt_prefix} |
| 65 | + ] |
| 66 | + |
| 67 | + system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args |
| 68 | + system "cmake", "--build", "build" |
| 69 | + system "cmake", "--install", "build" |
| 70 | + end |
| 71 | + |
| 72 | + test do |
| 73 | + # engine got changed from minetest to luanti with 5.10.0 release |
| 74 | + output = shell_output("#{bin}/luanti --version") |
| 75 | + assert_match "USE_CURL=1", output |
| 76 | + assert_match "USE_GETTEXT=1", output |
| 77 | + assert_match "USE_SOUND=1", output |
| 78 | + end |
| 79 | +end |
0 commit comments