diff --git a/1-setup-brew.sh b/1-setup-brew.sh index 6e43fc9..2c4adea 100755 --- a/1-setup-brew.sh +++ b/1-setup-brew.sh @@ -30,9 +30,13 @@ export HOMEBREW_NO_ANALYTICS=1 export OS=`uname -r | cut -d "." -f1` -if [ $OS -lt 15 ]; then #For OSX < 10.11 - brew install "${WORKDIR}/autobuild/osx/librsvg-2.40.20.rb" - brew install "${WORKDIR}/autobuild/osx/adwaita-icon-theme.rb" +if [ $OS -lt 15 ] && [ -z "$TRAVIS_BUILD_DIR" ]; then # For OSX < 10.11 + cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/ + git fetch --unshallow || true + git checkout a91becd6afc177b0cada2cf9cce2e3bde514053b # librsvg 2.40.20 (wothout rust) 2017.12.16 + cd /usr/local/Homebrew/ + git checkout 1.4.1 + brew info gobject-introspection | grep --quiet 'Not installed' && brew install ${WORKDIR}/autobuild/osx/gobject-introspection.rb fi for pkg in $PACKAGES; diff --git a/autobuild/osx/adwaita-icon-theme.rb b/autobuild/osx/adwaita-icon-theme.rb deleted file mode 100644 index 8ad4ad8..0000000 --- a/autobuild/osx/adwaita-icon-theme.rb +++ /dev/null @@ -1,36 +0,0 @@ -class AdwaitaIconTheme < Formula - desc "Icons for the GNOME project" - homepage "https://developer.gnome.org" - url "https://download.gnome.org/sources/adwaita-icon-theme/3.30/adwaita-icon-theme-3.30.1.tar.xz" - sha256 "6d752a2b1bc668483956d4485c39cad1642d9358e133ff689526e43674a4e1ce" - - bottle do - cellar :any_skip_relocation - sha256 "50a30cbc9017985d9ca2ff7285a0da47563dd3be313ee6fd406c172305bf0d7c" => :mojave - sha256 "11a39582ae7f7e34f0d9d3557e01553d967546b6cbb6c9913799352437c0dbbe" => :high_sierra - sha256 "11a39582ae7f7e34f0d9d3557e01553d967546b6cbb6c9913799352437c0dbbe" => :sierra - end - - depends_on "gettext" => :build - depends_on "gtk+3" => :build # for gtk3-update-icon-cache - depends_on "intltool" => :build - depends_on "pkg-config" => :build - depends_on "librsvg-2.40.20" - - def install - system "./configure", "--disable-dependency-tracking", - "--prefix=#{prefix}", - "GTK_UPDATE_ICON_CACHE=#{Formula["gtk+3"].opt_bin}/gtk3-update-icon-cache" - system "make", "install" - end - - test do - # This checks that a -symbolic png file generated from svg exists - # and that a file created late in the install process exists. - # Someone who understands GTK+3 could probably write better tests that - # check if GTK+3 can find the icons. - png = "weather-storm-symbolic.symbolic.png" - assert_predicate share/"icons/Adwaita/96x96/status/#{png}", :exist? - assert_predicate share/"icons/Adwaita/index.theme", :exist? - end -end diff --git a/autobuild/osx/gobject-introspection.rb b/autobuild/osx/gobject-introspection.rb new file mode 100644 index 0000000..863d3b7 --- /dev/null +++ b/autobuild/osx/gobject-introspection.rb @@ -0,0 +1,51 @@ +class GobjectIntrospection < Formula + desc "Generate introspection data for GObject libraries" + homepage "https://live.gnome.org/GObjectIntrospection" + url "https://download.gnome.org/sources/gobject-introspection/1.54/gobject-introspection-1.54.1.tar.xz" + sha256 "b88ded5e5f064ab58a93aadecd6d58db2ec9d970648534c63807d4f9a7bb877e" + revision 1 + + bottle do + sha256 "af8872721600cf3b5c033bad125fcef08a59e3ddfde4093fe6bc6bce5331e004" => :high_sierra + sha256 "4f07bc2e12b9015a670a999744d8201c575ea9d49421ec617507aa01407d841e" => :sierra + sha256 "88736baecfbab3cf709cb6b09de85f9e4a4382ac1d1c59f33af22c522dab81a4" => :el_capitan + end + + depends_on "pkg-config" => :run + depends_on "glib" + depends_on "cairo" + depends_on "libffi" + depends_on "python@2" if MacOS.version <= :mavericks + + resource "tutorial" do + url "https://gist.github.com/7a0023656ccfe309337a.git", + :revision => "499ac89f8a9ad17d250e907f74912159ea216416" + end + + def install + ENV["GI_SCANNER_DISABLE_CACHE"] = "true" + inreplace "giscanner/transformer.py", "/usr/share", "#{HOMEBREW_PREFIX}/share" + inreplace "configure" do |s| + s.change_make_var! "GOBJECT_INTROSPECTION_LIBDIR", "#{HOMEBREW_PREFIX}/lib" + end + + python = if MacOS.version >= :yosemite + "/usr/bin/python2.7" + else + Formula["python@2"].opt_bin/"python2.7" + end + + system "./configure", "--disable-dependency-tracking", + "--prefix=#{prefix}", + "--with-python=#{python}" + system "make" + system "make", "install" + end + + test do + ENV.prepend_path "PKG_CONFIG_PATH", Formula["libffi"].opt_lib/"pkgconfig" + resource("tutorial").stage testpath + system "make" + assert_predicate testpath/"Tut-0.1.typelib", :exist? + end +end diff --git a/autobuild/osx/librsvg-2.40.20.rb b/autobuild/osx/librsvg-2.40.20.rb deleted file mode 100644 index c989443..0000000 --- a/autobuild/osx/librsvg-2.40.20.rb +++ /dev/null @@ -1,98 +0,0 @@ -class Librsvg24020 < Formula - desc "Library to render SVG files using Cairo" - homepage "https://live.gnome.org/LibRsvg" - url "https://download.gnome.org/sources/librsvg/2.40/librsvg-2.40.20.tar.xz" - sha256 "cff4dd3c3b78bfe99d8fcfad3b8ba1eee3289a0823c0e118d78106be6b84c92b" - - bottle do - sha256 "072c7a4450eee5154aa380ada8cd193ca37f81ff1d3eaeb21a7e80eae384392b" => :high_sierra - sha256 "a764af163564b1a20b4d85b8ce408cacd28e3dfdc369a31341edd788be34dde8" => :sierra - sha256 "2be12f4d27cd0b87cefcb526ad4af4dde9555fe67e64b2218d4d15d8a58e2615" => :el_capitan - end - - depends_on "pkg-config" => :build - depends_on "cairo" - depends_on "gdk-pixbuf" - depends_on "glib" - depends_on "libcroco" - depends_on "pango" - depends_on "gtk+3" => :optional - depends_on "gobject-introspection" - - def install - args = %W[ - --disable-dependency-tracking - --prefix=#{prefix} - --disable-Bsymbolic - --enable-tools=yes - --enable-pixbuf-loader=yes - --enable-introspection=yes - ] - - system "./configure", *args - - # disable updating gdk-pixbuf cache, we will do this manually in post_install - # https://github.com/Homebrew/homebrew/issues/40833 - inreplace "gdk-pixbuf-loader/Makefile", - "$(GDK_PIXBUF_QUERYLOADERS) > $(DESTDIR)$(gdk_pixbuf_cache_file) ;", - "" - - system "make", "install", - "gdk_pixbuf_binarydir=#{lib}/gdk-pixbuf-2.0/2.10.0/loaders", - "gdk_pixbuf_moduledir=#{lib}/gdk-pixbuf-2.0/2.10.0/loaders" - end - - def post_install - # librsvg is not aware GDK_PIXBUF_MODULEDIR must be set - # set GDK_PIXBUF_MODULEDIR and update loader cache - ENV["GDK_PIXBUF_MODULEDIR"] = "#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders" - system "#{Formula["gdk-pixbuf"].opt_bin}/gdk-pixbuf-query-loaders", "--update-cache" - end - - test do - (testpath/"test.c").write <<~EOS - #include - - int main(int argc, char *argv[]) { - RsvgHandle *handle = rsvg_handle_new(); - return 0; - } - EOS - cairo = Formula["cairo"] - fontconfig = Formula["fontconfig"] - freetype = Formula["freetype"] - gdk_pixbuf = Formula["gdk-pixbuf"] - gettext = Formula["gettext"] - glib = Formula["glib"] - libpng = Formula["libpng"] - pixman = Formula["pixman"] - flags = %W[ - -I#{cairo.opt_include}/cairo - -I#{fontconfig.opt_include} - -I#{freetype.opt_include}/freetype2 - -I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0 - -I#{gettext.opt_include} - -I#{glib.opt_include}/glib-2.0 - -I#{glib.opt_lib}/glib-2.0/include - -I#{include}/librsvg-2.0 - -I#{libpng.opt_include}/libpng16 - -I#{pixman.opt_include}/pixman-1 - -D_REENTRANT - -L#{cairo.opt_lib} - -L#{gdk_pixbuf.opt_lib} - -L#{gettext.opt_lib} - -L#{glib.opt_lib} - -L#{lib} - -lcairo - -lgdk_pixbuf-2.0 - -lgio-2.0 - -lglib-2.0 - -lgobject-2.0 - -lintl - -lm - -lrsvg-2 - ] - system ENV.cc, "test.c", "-o", "test", *flags - system "./test" - end -end