homebrew-core/Formula/gwenhywfar.rb

89 lines
2.8 KiB
Ruby

class Gwenhywfar < Formula
desc "Utility library required by aqbanking and related software"
homepage "https://www.aquamaniac.de/"
url "https://www.aquamaniac.de/rdm/attachments/download/390/gwenhywfar-5.7.3.tar.gz"
sha256 "a78bb028665f0d2b927372b0ddf741c0af18cb6f0707c55348ae08e522b28280"
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_big_sur: "5fd0ef9a87749cbd66eb40e4cd94e94f9c1db9129622ba6585cc64a1e03af6e2"
sha256 big_sur: "42dbe67f468722dd8f1bcdd3b57de0db6d8d0e47485b929b8801b41097eb6e26"
sha256 catalina: "f9069b905fefe6f0bb31c4ce65ecb71c805ecf84a96dbe20a98d56d3753bec1a"
sha256 mojave: "ae9d95a1ac5bd4e8e0d85685541c43e8b634923d8fc9a94b8141818ff57d08d8"
sha256 x86_64_linux: "e011be0e08310e882ce96c7f9555d9688aa312edeec809e1312f7570ac04ed60"
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