astroidmail / homebrew-astroid

Homebrew tap for Astroid
10 stars 5 forks source link

rescue webkit2gtk from the homebrew boneyard #11

Closed yeled closed 5 years ago

yeled commented 7 years ago

Since https://github.com/Homebrew/homebrew-core/pull/9053 we can't just depend on homebrew webkit existing. We'll need to build our own.

gauteh commented 7 years ago

Hi, we're making fast progress on webkit2 here: https://github.com/astroidmail/astroid/issues/403#issuecomment-331793009, might not be worth the hassle.

gauteh commented 7 years ago

So, just for the record, this is the dependency we need for new webkit2.

yeled commented 6 years ago

@c-alpha do you want to have a crack at compiling new webkit2?

gauteh commented 6 years ago

New webkit2 branch of astroid here: https://github.com/astroidmail/astroid/pull/455

c-alpha commented 6 years ago

I'm trying to figure out a useful, up to date webkit for homebrew. No luck so far.

To show off my lack of knowledge: any difference between webkitgtk.org and the GTK+ port of webkit.org?

c-alpha commented 6 years ago

webkitgtk@2.4.11 doesn't build anymore against the current homebrew, btw.:

CDPATH="${ZSH_VERSION+.}:" && cd . && aclocal-1.15 -I Source/autotools
/bin/sh: aclocal-1.15: command not found
make: *** [aclocal.m4] Error 127

Instead of figuring out where the aclocal-1.15 dependency is hardcoded, it seems more promising to investigate a homebrew port of the current WebKit (also considering how far @gauteh seems to be with his webkit2 PR at astroidmail/astroid#455).

gauteh commented 6 years ago

Yeah - I am going to merge to master soon, need to get this done. This will make master unstable for a while. Specifically need to get resource blocking and some visual focusing stuff done, then its feature-complete enough to merge.

gauteh commented 6 years ago

c-alpha writes on June 25, 2018 18:15:

To show off my lack of knowledge: any difference between webkitgtk.org and the GTK+ port of webkit.org?

I think they are the same, but I always use webkitgtk.org.

c-alpha commented 6 years ago

What build options should I minimally be using?

-- Cache values
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CMAKE_OSX_ARCHITECTURES:STRING=
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=
CMAKE_OSX_SYSROOT:STRING=
DEBUG_FISSION:BOOL=OFF
ENABLE_ACCELERATED_2D_CANVAS:BOOL=OFF
ENABLE_ADDRESS_SANITIZER:BOOL=OFF
ENABLE_DRAG_SUPPORT:BOOL=ON
ENABLE_EXPERIMENTAL_FEATURES:BOOL=OFF
ENABLE_GEOLOCATION:BOOL=ON
ENABLE_GLES2:BOOL=OFF
ENABLE_GTKDOC:BOOL=OFF
ENABLE_ICONDATABASE:BOOL=ON
ENABLE_INTROSPECTION:BOOL=ON
ENABLE_JIT:BOOL=ON
ENABLE_MINIBROWSER:BOOL=OFF
ENABLE_OPENGL:BOOL=ON
ENABLE_PLUGIN_PROCESS_GTK2:BOOL=ON
ENABLE_QUARTZ_TARGET:BOOL=ON
ENABLE_SAMPLING_PROFILER:BOOL=ON
ENABLE_SPELLCHECK:BOOL=ON
ENABLE_TOUCH_EVENTS:BOOL=ON
ENABLE_VIDEO:BOOL=ON
ENABLE_WAYLAND_TARGET:BOOL=OFF
ENABLE_WEBDRIVER:BOOL=ON
ENABLE_WEB_AUDIO:BOOL=ON
ENABLE_WEB_CRYPTO:BOOL=ON
ENABLE_X11_TARGET:BOOL=OFF
EXEC_INSTALL_DIR:PATH=/usr/local/bin
LIBEXEC_INSTALL_DIR:PATH=/usr/local/libexec/webkit2gtk-4.0
LIBGCRYPTCONFIG_SCRIPT:FILEPATH=/usr/local/bin/libgcrypt-config
LIB_INSTALL_DIR:PATH=/usr/local/lib
PORT:STRING=GTK
SHOULD_INSTALL_JS_SHELL:BOOL=OFF
USE_LIBHYPHEN:BOOL=ON
USE_LIBNOTIFY:BOOL=ON
USE_LIBSECRET:BOOL=ON
USE_SYSTEM_MALLOC:BOOL=OFF
USE_THIN_ARCHIVES:BOOL=ON
USE_WOFF2:BOOL=ON
WEBP_DEMUX_INCLUDE_DIR:PATH=/usr/local/Cellar/webp/1.0.0/include
WEBP_DEMUX_LIBRARY:FILEPATH=/usr/local/Cellar/webp/1.0.0/lib/libwebpdemux.dylib
WEBP_INCLUDE_DIR:PATH=/usr/local/Cellar/webp/1.0.0/include
WEBP_LIBRARY:FILEPATH=/usr/local/Cellar/webp/1.0.0/lib/libwebp.dylib
WTF_CPU_ARM64_CORTEXA53:BOOL=OFF
gauteh commented 6 years ago

ENABLE_INTROSPECTION:BOOL=ON Yes / but not very strict. Limits astroid plugins.

Seems like sane defaults, you can probably disable the ones that give you trouble. Acceleration is probably not needed. We do not use very advanced features, but HTML mail might suffer slightly if you're too strict.

TheKashe commented 6 years ago

Not sure if related, but currently brew install astroid fails on my computer (high sierra, 10.13.5).

First, during the build I get a popup saying "gir_main cannot be opened because of a problem.". The build however continues, but then fails with:

==> cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/Cellar/astroid/0.11 -DDISABLE_EMBEDDED_EDITOR:B
==> cmake --build build --target install
Last 15 lines from /Users/jernej/Library/Logs/Homebrew/astroid/02.cmake:
[ 48%] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/resource.cc.o
[ 50%] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/ustring_utils.cc.o
[ 51%] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/utils.cc.o
[ 52%] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/vector_utils.cc.o
[ 53%] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/gmime/gmime-compat.cc.o
[ 54%] Building C object CMakeFiles/hypocycloid.dir/src/utils/gmime/gmime-filter-html-bq.c.o
[ 55%] Building C object CMakeFiles/hypocycloid.dir/src/utils/gmime/gtrie.c.o
[ 56%] Building C object CMakeFiles/hypocycloid.dir/src/utils/gmime/url-scanner.c.o
[ 57%] Building C object CMakeFiles/hypocycloid.dir/src/plugin/astroid_activatable.c.o
[ 58%] Building CXX object CMakeFiles/hypocycloid.dir/src/plugin/manager.cc.o
[ 59%] Building C object CMakeFiles/hypocycloid.dir/src/plugin/thread_index_activatable.c.o
[ 60%] Building C object CMakeFiles/hypocycloid.dir/src/plugin/thread_view_activatable.c.o
[ 61%] Linking CXX static library libhypocycloid.a
[ 61%] Built target hypocycloid
gmake: *** [Makefile:141: all] Error 2

brew install astroid --head also fails, but with different error (gir_main error is the same):

[48/98] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/ustring_utils.cc.o
[49/98] Generating Astroid-0.1.gir
FAILED: Astroid-0.1.gir 
cd /tmp/astroid-20180627-95587-105rq5o/build && /usr/local/Cellar/gobject-introspection/1.56.1/bin/g-ir-scanner --warn-all --namespace=Astroid --nsversion=0.1 --add-include-path=/tmp/astroid-20180627-95587-105rq5o/build --output /tmp/astroid-20180627-95587-105rq5o/build/Astroid-0.1.gir --no-libtool --program=/tmp/astroid-20180627-95587-105rq5o/build/gir_main --include=GObject-2.0 --include=GMime-3.0 /tmp/astroid-20180627-95587-105rq5o/src/plugin/astroid_activatable.c /tmp/astroid-20180627-95587-105rq5o/src/plugin/thread_view_activatable.c /tmp/astroid-20180627-95587-105rq5o/src/plugin/thread_index_activatable.c /tmp/astroid-20180627-95587-105rq5o/src/plugin/astroid_activatable.h /tmp/astroid-20180627-95587-105rq5o/src/plugin/thread_view_activatable.h /tmp/astroid-20180627-95587-105rq5o/src/plugin/thread_index_activatable.h /tmp/astroid-20180627-95587-105rq5o/src/plugin/gir_main.c
dyld: Symbol not found: _UCNV_FROM_U_CALLBACK_ESCAPE_60
  Referenced from: /usr/local/opt/webkitgtk@2.4.11/lib/libwebkitgtk-3.0.0.dylib
  Expected in: flat namespace
 in /usr/local/opt/webkitgtk@2.4.11/lib/libwebkitgtk-3.0.0.dylib
Command '['/tmp/astroid-20180627-95587-105rq5o/build/gir_main', u'--introspect-dump=/tmp/tmp-introspecta3g0Mo/functions.txt,/tmp/tmp-introspecta3g0Mo/dump.xml']' returned non-zero exit status -6
[50/98] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/utils.cc.o
[51/98] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/gmime/gmime-compat.cc.o
[52/98] Building CXX object CMakeFiles/hypocycloid.dir/src/utils/vector_utils.cc.o
[53/98] Building CXX object CMakeFiles/hypocycloid.dir/src/plugin/manager.cc.o
[54/98] Building CXX object tests/CMakeFiles/test_convert_error.dir/test_convert_error.cc.o
ninja: build stopped: subcommand failed.

Any idea how to fix?

gauteh commented 6 years ago

@c-alpha: is it possible to point the astroid recipe to the webkit2-branch for testing? to get things going again on mac.

c-alpha commented 6 years ago

I build without plugin support (which works), but get the same undefined symbol warning about _UCNV_FROM_U_CALLBACK_ESCAPE_60 when launching astroid.

The issue is that the current homebrew uses a newer boost than the webkitgtk@2.4.11 bottle. The missing symbol is from the ICU library, which is of course also compiled against the current boost.

I tried to recompile the webkitgtk@2.4.11 bottle against an up-to-date homebrew, i.e. with the lastest boost and ICU. This breaks, because the webkitgtk@2.4.11 build references aclocal-1.15, but the current homebrew has aclocal-1.16 (cf. my comment above from 5 days ago). So I would need to dig into the guts of webkitgtk@2.4.11 to determine why and where it fixes aclocal to 1.15, try to replace those references with aclocal-1.16, and keep fingers crossed that it will still build and work with the new aclocal.

The other option would be to find or make a new homebrew formula for the latest stable webkitgtk (2.20.3 as of this writing). This will be needed for @gauteh's webkit2-branch, and for future astroid versions anyway.

Fixing the webkitgtk@2.4.11 build may seem straightforward at first, but due to the extensive list of webkitgtk@2.4.11's dependencies could turn out to be a tarpit sooner than later. I would therefore suggest to look into getting a homebrew formula for a current webkitgtk. Solves two issues: this one, and allows @gauteh's webkit2-branch to be used on the macOS platform.

I have not been able to find a homebrew formula for a current webkitgtk. Searching github, I found a couple of repositories, but none looked maintained or otherwise promising. I guess we will have to make our own. So I am currently looking into creating a new formula for the current stable webkitgtk. This will take a little while, however.

gauteh commented 6 years ago

Good plan! Would definitely focus on webkit2! Fingers crossed 🤞

lør. 30. jun. 2018 kl. 18:57 skrev c-alpha notifications@github.com:

I build without plugin support (which works), but get the same undefined symbol warning about _UCNV_FROM_U_CALLBACK_ESCAPE_60 when launching astroid.

The issue is that the current homebrew uses a newer boost than the webkitgtk@2.4.11 bottle. The missing symbol is from the ICU library, which is of course also compiled against the current boost.

I tried to recompile the webkitgtk@2.4.11 bottle against an up-to-date homebrew, i.e. with the lastest boost and ICU. This breaks, because the webkitgtk@2.4.11 build references aclocal-1.15, but the current homebrew has aclocal-1.16 (cf. my comment above from 5 days ago). So I would need to dig into the guts of webkitgtk@2.4.11 to determine why and where it fixes aclocal to 1.15, try to replace those references with aclocal-1.16, and keep fingers crossed that it will still build and work with the new aclocal.

The other option would be to find or make a new homebrew formula for the latest stable webkitgtk (2.20.3 as of this writing). This will be needed for @gauteh https://github.com/gauteh's webkit2-branch, and for future astroid versions anyway.

Fixing the webkitgtk@2.4.11 build may seem straightforward at first, but due to the extensive list of webkitgtk@2.4.11's dependencies could turn out to be a tarpit sooner than later. I would therefore suggest to look into getting a homebrew formula for a current webkitgtk. Solves two issues: this one, and allows @gauteh https://github.com/gauteh's webkit2-branch to be used on the macOS platform.

I have not been able to find a homebrew formula for a current webkitgtk. Searching github, I found a couple of repositories, but none looked maintained or otherwise promising. I guess we will have to make our own. So I am currently looking into creating a new formula for the current stable webkitgtk. This will take a little while, however.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/astroidmail/homebrew-astroid/issues/11#issuecomment-401553176, or mute the thread https://github.com/notifications/unsubscribe-auth/AADd-5WyOr6_pj0tZl_PwDiDATL6sgPuks5uB63ogaJpZM4PiBZV .

gauteh commented 6 years ago

Gaute Hope writes on June 30, 2018 19:34:

Good plan! Would definitely focus on webkit2! Fingers crossed 🤞

WebKit2 has now been merged to master.

c-alpha commented 6 years ago

Ok, I've gotten past the dependencies. This is where I am with my webkitgtk.rb:

class Webkitgtk < Formula
  desc "WebkitGTK+ is a full-featured port of the WebKit rendering engine, suitable for projects requiring any kind of web integration, from hybrid HTML/CSS applications to full-fledged web browsers. It’s the official web engine of the GNOME platform and is used in browsers such as Epiphany and Midori."
  homepage "https://webkitgtk.org/"
  url "https://webkitgtk.org/releases/webkitgtk-2.20.3.tar.xz"
  sha256 "579b307d78fa16a73f112790178022166d7ad17d4147492ced9b9fba48f20dd8"

  depends_on "cmake" => :build
  depends_on "ninja" => :build if build.head?     # only use ninja if building devel

  depends_on "gtk+3"
  depends_on "enchant"
  depends_on "gettext"
  depends_on "gobject-introspection"     # => :build  ???????
  depends_on "intltool"
  depends_on "itstool"
  depends_on "libcroco"
  depends_on "libgcrypt"
  depends_on "libgpg-error"
  depends_on "libnotify"
  depends_on "libsecret"
  depends_on "libtasn1"
  depends_on "libtiff"
  depends_on "libtool"
  depends_on "pango"
  depends_on "sqlite"
  depends_on "webp"
  depends_on "woff2"

  def install
    # ENV.deparallelize  # if your formula fails when building in parallel

    # https://github.com/WebKit/webkit#building-the-gtk-port
    #
    # DISabling the following faetures, which are on by default:
    # - ENABLE_GEOLOCATION since it requires geoclue, but no formula for it exists
    # - ENABLE_OPENGL since macOS provides CGL, but WebkitGTK+ builds against either GLX or EGL only
    # - USE_LIBHYPHEN since no formula for it exists
    # - ENABLE_VIDEO and ENABLE_WEB_AUDIO since they would require gstreamer and tons of plugins for the codecs
    #
    # ENabling the following faetures, which are off by default:
    # - USE_SYSTEM_MALLOC since the WebkitGTK+ tarball does not contain the required bmalloc files
    #
    args = %w[
      -DPORT=GTK
      -DCMAKE_BUILD_TYPE=RelWithDebInfo
      -DENABLE_GEOLOCATION=OFF
      -DENABLE_OPENGL=OFF
      -DENABLE_VIDEO=OFF
      -DENABLE_WEB_AUDIO=OFF
      -DUSE_LIBHYPHEN=OFF
      -DUSE_SYSTEM_MALLOC=ON
    ]

    # only use ninja if building devel (ninja is possibly faster)
    args += [
      "-GNinja"
    ] if build.head?

    system "cmake", *args, "-H.", "-Bbuild"
    system "cmake", "--build", "build", "--target", "install"    
  end
end

Any clues whether gobject-introspection is really needed at runtime, or during build only?

Now moving on to making it build.

gauteh commented 6 years ago

man. 2. jul. 2018 kl. 17:34 skrev c-alpha notifications@github.com:

Ok, I've gotten past the dependencies. This is where I am with my webkitgtk.rb:

class Webkitgtk < Formula desc "WebkitGTK+ is a full-featured port of the WebKit rendering engine, suitable for projects requiring any kind of web integration, from hybrid HTML/CSS applications to full-fledged web browsers. It’s the official web engine of the GNOME platform and is used in browsers such as Epiphany and Midori." homepage "https://webkitgtk.org/" url "https://webkitgtk.org/releases/webkitgtk-2.20.3.tar.xz" sha256 "579b307d78fa16a73f112790178022166d7ad17d4147492ced9b9fba48f20dd8"

depends_on "cmake" => :build depends_on "ninja" => :build if build.head? # only use ninja if building devel

depends_on "gtk+3" depends_on "enchant" depends_on "gettext" depends_on "gobject-introspection" # => :build ??????? depends_on "intltool" depends_on "itstool" depends_on "libcroco" depends_on "libgcrypt" depends_on "libgpg-error" depends_on "libnotify" depends_on "libsecret" depends_on "libtasn1" depends_on "libtiff" depends_on "libtool" depends_on "pango" depends_on "sqlite" depends_on "webp" depends_on "woff2"

def install

ENV.deparallelize # if your formula fails when building in parallel

# https://github.com/WebKit/webkit#building-the-gtk-port
#
# DISabling the following faetures, which are on by default:
# - ENABLE_GEOLOCATION since it requires geoclue, but no formula for it exists
# - ENABLE_OPENGL since macOS provides CGL, but WebkitGTK+ builds against either GLX or EGL only
# - USE_LIBHYPHEN since no formula for it exists
# - ENABLE_VIDEO and ENABLE_WEB_AUDIO since they would require gstreamer and tons of plugins for the codecs
#
# ENabling the following faetures, which are off by default:
# - USE_SYSTEM_MALLOC since the WebkitGTK+ tarball does not contain the required bmalloc files
#
args = %w[      -DPORT=GTK      -DCMAKE_BUILD_TYPE=RelWithDebInfo      -DENABLE_GEOLOCATION=OFF      -DENABLE_OPENGL=OFF      -DENABLE_VIDEO=OFF      -DENABLE_WEB_AUDIO=OFF      -DUSE_LIBHYPHEN=OFF      -DUSE_SYSTEM_MALLOC=ON    ]

# only use ninja if building devel (ninja is possibly faster)
args += [
  "-GNinja"
] if build.head?

system "cmake", *args, "-H.", "-Bbuild"
system "cmake", "--build", "build", "--target", "install"

endend

Any clues whether gobject-introspection is really needed at runtime, or during build only?

Probably only build. It is useful for plugins, though none of the plugins make use of it yet. As long as you get a typelib and gir file installed you are good.

yeled commented 6 years ago

@c-alpha how are you going here? Is there a branch we can help you out with?

c-alpha commented 6 years ago

Sorry for the delay in responding, @yeled! I am almost there with webkit-2.22.2. It does compile everything, but chokes on an install issue, where the cmake scripts try to install the pkg-config receipt in an absolute location (/usr/local), but which is not accessible when building under Homebrew, since that happens in a sandbox environment. I am thus optimistic that webkit-2.22.2 can be supported via astroidmail/homebrew-astroid once its build scripts can be convinced to use a relative install path for the pkg-config receipt.

This is my current Homebrew formula:

# coding: utf-8
class Webkitgtk < Formula
  desc "WebkitGTK+ is a full-featured port of the WebKit rendering engine, suitable for projects requiring any kind of web integration, from hybrid HTML/CSS applications to full-fledged web browsers. It’s the official web engine of the GNOME platform and is used in browsers such as Epiphany and Midori."
  homepage "https://webkitgtk.org/"

  stable do
    url "https://webkitgtk.org/releases/webkitgtk-2.22.2.tar.xz"
    sha256 "345487d4d1896e711683f951d1e09387d3b90d7cf59295c0e634af7f515e99ba"
    patch :DATA
  end

  # build-time dependencies
  depends_on "cmake" => :build
  depends_on "gobject-introspection" => :build
  depends_on "ninja" => :build if build.head?     # only use ninja if building devel
  depends_on "pkg-config" => :build

  # run-time dependencies
  depends_on "gtk+3"
  depends_on "enchant"
  depends_on "gettext"
  depends_on "intltool"
  depends_on "itstool"
  depends_on "libcroco"
  depends_on "libepoxy"
  depends_on "libgcrypt"
  depends_on "libgpg-error"
  depends_on "libnotify"
  depends_on "libsecret"
  depends_on "libtasn1"
  depends_on "libtiff"
  depends_on "libtool"
  depends_on "pango"
  depends_on "sqlite"
  depends_on "webp"
  depends_on "woff2"

  def install
    # ENV.deparallelize  # if your formula fails when building in parallel

    # https://github.com/WebKit/webkit#building-the-gtk-port
    #
    # DISabling the following faetures, which are on by default:
    # - ENABLE_GEOLOCATION since it requires geoclue, but no formula for it exists
    # - ENABLE_OPENGL since macOS provides CGL, but WebkitGTK+ builds against either GLX or EGL only
    # - USE_LIBHYPHEN since no formula for it exists
    # - ENABLE_VIDEO and ENABLE_WEB_AUDIO since they would require gstreamer and tons of plugins for the codecs
    # - ENABLE_INTROSPECTION since GObject introspection causes the build to break
    #
    # ENabling the following faetures, which are off by default:
    # - USE_SYSTEM_MALLOC since the WebkitGTK+ tarball does not contain the required bmalloc files
    #
    args = %w[
      -DPORT=GTK
      -DCMAKE_BUILD_TYPE=RelWithDebInfo
      -DENABLE_INTROSPECTION=OFF
      -DENABLE_GEOLOCATION=OFF
      -DENABLE_OPENGL=OFF
      -DENABLE_VIDEO=OFF
      -DENABLE_WEB_AUDIO=OFF
      -DUSE_LIBHYPHEN=OFF
      -DUSE_SYSTEM_MALLOC=ON
    ]

    # only use ninja if building devel (ninja is possibly faster)
    args += [
      "-GNinja"
    ] if build.head?

    system "cmake", *args, "-H.", "-Bbuild"
    system "cmake", "--build", "build", "--target", "install"

    # mkdir "build" do
    #   system "cmake", "..", *(std_cmake_args + extra_args)
    #   system "make", "install"
    # end

    # system "make", "install" # if this fails, try separate make/make install steps
  end

  test do
    # `test do` will create, run in and delete a temporary directory.
    #
    # This test will fail and we won't accept that! For Homebrew/homebrew-core
    # this will need to be a test that verifies the functionality of the
    # software. Run the test with `brew test webkitgtk`. Options passed
    # to `brew install` such as `--HEAD` also need to be provided to `brew test`.
    #
    # The installed folder is not in the path, so use the entire path to any
    # executables being tested: `system "#{bin}/program", "do", "something"`.
    system "false"
  end
end

###
# The following patches are needed because...
#
__END__
diff -x '*~' -Naur webkitgtk-2.22.2-orig/Source/WTF/wtf/RAMSize.cpp webkitgtk-2.22.2/Source/WTF/wtf/RAMSize.cpp
--- webkitgtk-2.22.2-orig/Source/WTF/wtf/RAMSize.cpp    2018-02-19 08:45:30.000000000 +0100
+++ webkitgtk-2.22.2/Source/WTF/wtf/RAMSize.cpp 2018-07-02 20:00:42.000000000 +0200
@@ -33,7 +33,13 @@
 #include <windows.h>
 #elif defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
 #if OS(UNIX)
+#if OS(DARWIN)
+// macOS uses a bsd-style sysctl(2), which resembles POSIX
+#include <sys/sysctl.h>
+#else
+// the default for other unix-ish systems is svr4-style sysinfo(2)
 #include <sys/sysinfo.h>
+#endif // OS(DARWIN)
 #endif // OS(UNIX)
 #else
 #include <bmalloc/bmalloc.h>
@@ -56,9 +62,18 @@
     return status.ullTotalPhys;
 #elif defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
 #if OS(UNIX)
+#if OS(DARWIN)
+    // macOS uses a bsd-style sysctl(2), which resembles POSIX
+    int64_t hw_memsize;
+    size_t len = sizeof(hw_memsize);
+    sysctlbyname("hw.memsize", &hw_memsize, &len, NULL, 0);
+    return (size_t)hw_memsize;
+#else
+    // the default for other unix-ish systems is svr4-style sysinfo(2)
     struct sysinfo si;
     sysinfo(&si);
     return si.totalram * si.mem_unit;
+#endif // OS(DARWIN)
 #else
 #error "Missing a platform specific way of determining the available RAM"
 #endif // OS(UNIX)
diff -x '*~' -Naur webkitgtk-2.22.2-orig/Source/WebCore/platform/graphics/OpenGLShims.h webkitgtk-2.22.2/Source/WebCore/platform/graphics/OpenGLShims.h
--- webkitgtk-2.22.2-orig/Source/WebCore/platform/graphics/OpenGLShims.h    2018-02-19 08:45:32.000000000 +0100
+++ webkitgtk-2.22.2/Source/WebCore/platform/graphics/OpenGLShims.h 2018-07-03 17:58:07.000000000 +0200
@@ -20,8 +20,13 @@
 #ifndef OpenGLShims_h
 #define OpenGLShims_h

+#if OS(DARWIN)
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#else
 #include <GL/gl.h>
 #include <GL/glext.h>
+#endif

 #if defined(GL_ES_VERSION_2_0)
 // Some openGL ES systems miss this typedef.
diff -x '*~' -Naur webkitgtk-2.22.2-orig/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp webkitgtk-2.22.2/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp
--- webkitgtk-2.22.2-orig/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp   2018-08-06 16:07:41.000000000 +0200
+++ webkitgtk-2.22.2/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp    2018-10-04 17:45:07.000000000 +0200
@@ -30,7 +30,7 @@
 #include "NotImplemented.h"
 #include "ScrollingStateTree.h"

-#if USE(COORDINATED_GRAPHICS)
+#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)

 namespace WebCore {

@@ -56,4 +56,4 @@

 } // namespace WebCore

-#endif // USE(COORDINATED_GRAPHICS)
+#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
gauteh commented 6 years ago

Im on mac now for a while too, so can have a go as well at testing this.

On Fri, Nov 16, 2018 at 10:59 AM Alexander Adolf notifications@github.com wrote:

Sorry for the delay in responding, @yeled https://github.com/yeled! I am almost there with webkit-2.22.2. It does compile everything, but chokes on an install issue, where the cmake scripts try to install the pkg-config receipt in an absolute location (/usr/local), but which is not accessible when building under Homebrew, since that happens in a sandbox environment. I am thus optimistic that webkit-2.22.2 can be supported via astroidmail/homebrew-astroid once its build scripts can be convinced to use a relative install path for the pkg-config receipt.

This is my current Homebrew formula:

coding: utf-8class Webkitgtk < Formula

desc "WebkitGTK+ is a full-featured port of the WebKit rendering engine, suitable for projects requiring any kind of web integration, from hybrid HTML/CSS applications to full-fledged web browsers. It’s the official web engine of the GNOME platform and is used in browsers such as Epiphany and Midori." homepage "https://webkitgtk.org/"

stable do url "https://webkitgtk.org/releases/webkitgtk-2.22.2.tar.xz" sha256 "345487d4d1896e711683f951d1e09387d3b90d7cf59295c0e634af7f515e99ba" patch :DATA end

build-time dependencies

depends_on "cmake" => :build depends_on "gobject-introspection" => :build depends_on "ninja" => :build if build.head? # only use ninja if building devel depends_on "pkg-config" => :build

run-time dependencies

depends_on "gtk+3" depends_on "enchant" depends_on "gettext" depends_on "intltool" depends_on "itstool" depends_on "libcroco" depends_on "libepoxy" depends_on "libgcrypt" depends_on "libgpg-error" depends_on "libnotify" depends_on "libsecret" depends_on "libtasn1" depends_on "libtiff" depends_on "libtool" depends_on "pango" depends_on "sqlite" depends_on "webp" depends_on "woff2"

def install

ENV.deparallelize # if your formula fails when building in parallel

# https://github.com/WebKit/webkit#building-the-gtk-port
#
# DISabling the following faetures, which are on by default:
# - ENABLE_GEOLOCATION since it requires geoclue, but no formula for it exists
# - ENABLE_OPENGL since macOS provides CGL, but WebkitGTK+ builds against either GLX or EGL only
# - USE_LIBHYPHEN since no formula for it exists
# - ENABLE_VIDEO and ENABLE_WEB_AUDIO since they would require gstreamer and tons of plugins for the codecs
# - ENABLE_INTROSPECTION since GObject introspection causes the build to break
#
# ENabling the following faetures, which are off by default:
# - USE_SYSTEM_MALLOC since the WebkitGTK+ tarball does not contain the required bmalloc files
#
args = %w[      -DPORT=GTK      -DCMAKE_BUILD_TYPE=RelWithDebInfo      -DENABLE_INTROSPECTION=OFF      -DENABLE_GEOLOCATION=OFF      -DENABLE_OPENGL=OFF      -DENABLE_VIDEO=OFF      -DENABLE_WEB_AUDIO=OFF      -DUSE_LIBHYPHEN=OFF      -DUSE_SYSTEM_MALLOC=ON    ]

# only use ninja if building devel (ninja is possibly faster)
args += [
  "-GNinja"
] if build.head?

system "cmake", *args, "-H.", "-Bbuild"
system "cmake", "--build", "build", "--target", "install"

# mkdir "build" do
#   system "cmake", "..", *(std_cmake_args + extra_args)
#   system "make", "install"
# end

# system "make", "install" # if this fails, try separate make/make install steps

end

test do

test do will create, run in and delete a temporary directory.

#
# This test will fail and we won't accept that! For Homebrew/homebrew-core
# this will need to be a test that verifies the functionality of the
# software. Run the test with `brew test webkitgtk`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "false"

endend

The following patches are needed because...#END

diff -x '*~' -Naur webkitgtk-2.22.2-orig/Source/WTF/wtf/RAMSize.cpp webkitgtk-2.22.2/Source/WTF/wtf/RAMSize.cpp--- webkitgtk-2.22.2-orig/Source/WTF/wtf/RAMSize.cpp 2018-02-19 08:45:30.000000000 +0100+++ webkitgtk-2.22.2/Source/WTF/wtf/RAMSize.cpp 2018-07-02 20:00:42.000000000 +0200 @@ -33,7 +33,13 @@

include

elif defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC

if OS(UNIX)+#if OS(DARWIN)+// macOS uses a bsd-style sysctl(2), which resembles POSIX+#include <sys/sysctl.h>+#else+// the default for other unix-ish systems is svr4-style sysinfo(2)

include <sys/sysinfo.h>+#endif // OS(DARWIN)

endif // OS(UNIX)

else

include <bmalloc/bmalloc.h>

@@ -56,9 +62,18 @@ return status.ullTotalPhys;

elif defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC

if OS(UNIX)+#if OS(DARWIN)+ // macOS uses a bsd-style sysctl(2), which resembles POSIX+ int64_t hw_memsize;+ size_t len = sizeof(hw_memsize);+ sysctlbyname("hw.memsize", &hw_memsize, &len, NULL, 0);+ return (size_t)hw_memsize;+#else+ // the default for other unix-ish systems is svr4-style sysinfo(2)

 struct sysinfo si;
 sysinfo(&si);
 return si.totalram * si.mem_unit;+#endif // OS(DARWIN)

else

error "Missing a platform specific way of determining the available RAM"

endif // OS(UNIX)

diff -x '*~' -Naur webkitgtk-2.22.2-orig/Source/WebCore/platform/graphics/OpenGLShims.h webkitgtk-2.22.2/Source/WebCore/platform/graphics/OpenGLShims.h--- webkitgtk-2.22.2-orig/Source/WebCore/platform/graphics/OpenGLShims.h 2018-02-19 08:45:32.000000000 +0100+++ webkitgtk-2.22.2/Source/WebCore/platform/graphics/OpenGLShims.h 2018-07-03 17:58:07.000000000 +0200 @@ -20,8 +20,13 @@

ifndef OpenGLShims_h

define OpenGLShims_h

+#if OS(DARWIN)+#include <OpenGL/gl.h>+#include <OpenGL/glext.h>+#else

include <GL/gl.h>

include <GL/glext.h>+#endif

if defined(GL_ES_VERSION_2_0)

// Some openGL ES systems miss this typedef. diff -x '*~' -Naur webkitgtk-2.22.2-orig/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp webkitgtk-2.22.2/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp--- webkitgtk-2.22.2-orig/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp 2018-08-06 16:07:41.000000000 +0200+++ webkitgtk-2.22.2/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp 2018-10-04 17:45:07.000000000 +0200 @@ -30,7 +30,7 @@

include "NotImplemented.h"

include "ScrollingStateTree.h"

-#if USE(COORDINATED_GRAPHICS)+#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)

namespace WebCore {

@@ -56,4 +56,4 @@

} // namespace WebCore -#endif // USE(COORDINATED_GRAPHICS)+#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/astroidmail/homebrew-astroid/issues/11#issuecomment-439342703, or mute the thread https://github.com/notifications/unsubscribe-auth/AADd-79sb_5qqS1wf_doZc9MJc7KGVOVks5uvoxvgaJpZM4PiBZV .

yeled commented 6 years ago

@c-alpha It's been over a year since I've tried building test formulas.

Can you remind me the best homebrew command line args and environment variables to use?

gauteh commented 5 years ago

Merged #26 even though things are not working completely as they should yet.

yeled commented 5 years ago

Merged #26 even though things are not working completely as they should yet.

We can close this, the issue now resides in Astroid codebase