homebrew-core/Formula/gwenhywfar.rb

90 lines
2.9 KiB
Ruby

class Gwenhywfar < Formula
desc "Utility library required by aqbanking and related software"
homepage "https://www.aquamaniac.de/rdm/projects/gwenhywfar"
url "https://www.aquamaniac.de/rdm/attachments/download/415/gwenhywfar-5.9.0.tar.gz"
sha256 "e88c7d3383a3cbbe46cb3b2299f71dfb9e6fa565f5a1668b4297391c874b0e12"
license "LGPL-2.1-or-later"
livecheck do
url "https://www.aquamaniac.de/rdm/projects/gwenhywfar/files"
regex(/href=.*?gwenhywfar[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "fff0a9c1b61acc58e4916356b8ae9790d6390f92793cd6b19acd19c41db5aee4"
sha256 arm64_big_sur: "6df6fd8af83a216de5bc80c5beaa2cb1e79a043d13ee63b16de50a9709c09944"
sha256 monterey: "7ae5f189ba9ba9b89585ad98c9222262921ff7426d626f3f4a63a3fad605831d"
sha256 big_sur: "d07022854cd1f1d9155d1840d31d88079368f17661e328e7204354f38ec9a960"
sha256 catalina: "87f3d218ac732ef0be68decfaf0e230c5bf40f98916d623ee85f2a81f7d95be3"
sha256 x86_64_linux: "1aa388288fe7fd86bb667e5b778839de858571a08de78051148b049e694cfa82"
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "cmake" => :test
depends_on "gettext"
depends_on "gnutls"
depends_on "libgcrypt"
depends_on "openssl@1.1"
depends_on "pkg-config" # gwenhywfar-config needs pkg-config for execution
depends_on "qt@5"
on_linux do
depends_on "gcc"
end
fails_with gcc: "5"
def install
inreplace "gwenhywfar-config.in.in", "@PKG_CONFIG@", "pkg-config"
system "autoreconf", "-fiv" # needed because of the patch. Otherwise only needed for head build (if build.head?)
guis = ["cpp", "qt5"]
guis << "cocoa" if OS.mac?
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-guis=#{guis.join(" ")}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <gwenhywfar/gwenhywfar.h>
int main()
{
GWEN_Init();
return 0;
}
EOS
system ENV.cc, "test.c", "-I#{include}/gwenhywfar5", "-L#{lib}", "-lgwenhywfar", "-o", "test_c"
system "./test_c"
system ENV.cxx, "test.c", "-I#{include}/gwenhywfar5", "-L#{lib}", "-lgwenhywfar", "-o", "test_cpp"
system "./test_cpp"
(testpath/"CMakeLists.txt").write <<~EOS
project(test_gwen)
find_package(Qt5 REQUIRED Core Widgets)
find_package(gwenhywfar REQUIRED)
find_package(gwengui-cpp REQUIRED)
find_package(gwengui-qt5 REQUIRED)
add_executable(${PROJECT_NAME} test.c)
target_link_libraries(${PROJECT_NAME} PUBLIC
gwenhywfar::core
gwenhywfar::gui-cpp
gwenhywfar::gui-qt5
)
EOS
args = std_cmake_args
args << "-DQt5_DIR=#{Formula["qt@5"].opt_prefix/"lib/cmake/Qt5"}"
system "cmake", testpath.to_s, *args
system "make"
end
end