libsigc++ 3.0.0

master
Tom Schoonjans 2019-09-05 10:36:20 +01:00 committed by FX Coudert
parent dcfa1308ca
commit cc4f90bd5a
3 changed files with 57 additions and 10 deletions

1
Aliases/libsigc++@3 Symbolic link
View File

@ -0,0 +1 @@
../Formula/libsigc++.rb

View File

@ -1,8 +1,8 @@
class Libsigcxx < Formula
desc "Callback framework for C++"
homepage "https://libsigcplusplus.github.io/libsigcplusplus/"
url "https://download.gnome.org/sources/libsigc++/2.10/libsigc++-2.10.2.tar.xz"
sha256 "b1ca0253379596f9c19f070c83d362b12dfd39c0a3ea1dd813e8e21c1a097a98"
url "https://download.gnome.org/sources/libsigc++/3.0/libsigc++-3.0.0.tar.xz"
sha256 "50a0855c1eb26e6044ffe888dbe061938ab4241f96d8f3754ea7ead38ab8ed06"
bottle do
cellar :any
@ -11,6 +11,8 @@ class Libsigcxx < Formula
sha256 "e68c8c1b8406b34956d4918cfa1b6717ceb1201732da759be9a2601cc60230e4" => :sierra
end
depends_on :macos => :high_sierra # needs C++17
def install
ENV.cxx11
system "./configure", "--prefix=#{prefix}", "--disable-dependency-tracking"
@ -20,18 +22,25 @@ class Libsigcxx < Formula
end
test do
(testpath/"test.cpp").write <<~EOS
#include <iostream>
#include <string>
#include <sigc++/sigc++.h>
void somefunction(int arg) {}
void on_print(const std::string& str) {
std::cout << str;
}
int main(int argc, char *argv[])
{
sigc::slot<void, int> sl = sigc::ptr_fun(&somefunction);
return 0;
int main(int argc, char *argv[]) {
sigc::signal<void(const std::string&)> signal_print;
signal_print.connect(sigc::ptr_fun(&on_print));
signal_print.emit("hello world\\n");
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp",
"-L#{lib}", "-lsigc-2.0", "-I#{include}/sigc++-2.0", "-I#{lib}/sigc++-2.0/include", "-o", "test"
system "./test"
system ENV.cxx, "-std=c++17", "test.cpp",
"-L#{lib}", "-lsigc-3.0", "-I#{include}/sigc++-3.0", "-I#{lib}/sigc++-3.0/include", "-o", "test"
assert_match "hello world", shell_output("./test")
end
end

37
Formula/libsigc++@2.rb Normal file
View File

@ -0,0 +1,37 @@
class Libsigcxx < Formula
desc "Callback framework for C++"
homepage "https://libsigcplusplus.github.io/libsigcplusplus/"
url "https://download.gnome.org/sources/libsigc++/2.10/libsigc++-2.10.2.tar.xz"
sha256 "b1ca0253379596f9c19f070c83d362b12dfd39c0a3ea1dd813e8e21c1a097a98"
bottle do
cellar :any
sha256 "e969efb989c5ec1cd2d024bed7836a46f4edc0b517d11b8d9df4a1fb196eb901" => :mojave
sha256 "3682ee57f364d08e9381c4dbb80438e3fb9194284defabf28f3d2eba8195f63c" => :high_sierra
sha256 "e68c8c1b8406b34956d4918cfa1b6717ceb1201732da759be9a2601cc60230e4" => :sierra
end
def install
ENV.cxx11
system "./configure", "--prefix=#{prefix}", "--disable-dependency-tracking"
system "make"
system "make", "check"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <sigc++/sigc++.h>
void somefunction(int arg) {}
int main(int argc, char *argv[])
{
sigc::slot<void, int> sl = sigc::ptr_fun(&somefunction);
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp",
"-L#{lib}", "-lsigc-2.0", "-I#{include}/sigc++-2.0", "-I#{lib}/sigc++-2.0/include", "-o", "test"
system "./test"
end
end