LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
19.48k stars 789 forks source link

Homebrew tap for Ladybird for macOS use, testing, etc? #25

Open ylluminate opened 3 months ago

ylluminate commented 3 months ago

It seems that pulling together a Homebrew tap for Ladybird could be attractive and improve testing and development opportunities on macOS.

kussumma commented 3 months ago

agree! I'm ready as a tester

ADKaster commented 3 months ago

Ladybird is not ready for general user testing. If there's a way to put a package behind a "please only use it you're planning to contribute upstream" flag, them sure, we could probably help out with whoever wants to maintain a brew package.

But really, the browser is in a pre-alpha state. Exposing it to non-developer users when we have so many features unimplemented and low hanging fruit bugs around would not give a first impression we can be proud of. We would much rather the browser be tested by people who have the source code already handy to submit patches.

I suspect that a roadmap describing when a homebrew package would be appropriate will surface soon ™️.

ylluminate commented 3 months ago

We might be able to do something like this (I'm not a Homebrew guy; I use it out of necessity, but I'm not a fan of their project so I don't contribute to it - I prefer MacPorts, but I realize Homebrew has the market share... so take what I say below as a stab in the dark and I would expect someone else with more experience to chime in with a proper refined answer):

NOTE: I think a regularly updated tarball might be good to have for "milestone builds" - and a "build from master" option could also be implemented as a flag.

  1. Create a tap with a check for an environment variable to restrict installation to developers, example:

    class Ladybird < Formula
    desc "Ladybird browser for macOS (pre-alpha developer version)"
    homepage "https://github.com/LadybirdWebBrowser/ladybird"
    url "https://github.com/LadybirdWebBrowser/ladybird/releases/download/v0.1/ladybird-milestone-0.1.tar.gz"
    version "0.1"
    sha256 "milestone_sha256_here"
    license "BSD-2-Clause"
    
    option "with-github-master", "Build from the latest GitHub master branch"
    
    depends_on "cmake" => :build
    depends_on "ninja" => :build
    depends_on "ccache" => :build
    depends_on "qt"
    depends_on xcode: ["14.3", :build]
    depends_on macos: :minimum_version_of_macos_here
    
    def install
    if ENV["LADYBIRD_DEVELOPER"] != "true"
      odie "Ladybird is in pre-alpha. Set LADYBIRD_DEVELOPER=true to install."
    end
    
    if build.with? "github-master"
      ohai "Cloning Ladybird repository"
      system "git", "clone", "--depth", "1", "https://github.com/LadybirdWebBrowser/ladybird.git"
      chdir "ladybird"
    else
      ohai "Extracting milestone tarball"
      system "tar", "xzf", "ladybird-milestone-#{version}.tar.gz"
      chdir "ladybird-milestone-#{version}"
    end
    
    mkdir "build" do
      system "cmake", "..", "-GNinja", *std_cmake_args
      system "ninja"
      system "ninja", "install"
    end
    end
    
    def caveats
    <<~EOS
      Ladybird is in pre-alpha stage and is intended for developers only.
    
      To build from the GitHub master branch:
        LADYBIRD_DEVELOPER=true brew install LadybirdWebBrowser/ladybird/ladybird --with-github-master
    
      To install the latest milestone tarball:
        LADYBIRD_DEVELOPER=true brew install LadybirdWebBrowser/ladybird/ladybird
    
      To prevent Homebrew from automatically updating this formula:
        brew pin ladybird
    
      Note: Xcode 14.3 or later is required to build Ladybird.
    
      The SHA for the milestone tarball must be updated regularly to reflect new stable builds.
    EOS
    end
    
    test do
    assert_match "Ladybird Version #{version}", shell_output("#{bin}/ladybird --version")
    end
    end
  2. Developers would set the LADYBIRD_DEVELOPER variable before installation (as per instructions in the recipe); some instructions like this could be given on the website/build instructions:

    
    To install from GitHub master branch:
    LADYBIRD_DEVELOPER=true brew install LadybirdWebBrowser/ladybird --with-github-master

To install the milestone tarball by default: LADYBIRD_DEVELOPER=true brew install LadybirdWebBrowser/ladybird

To prevent automatic updates: brew pin ladybird

russes commented 2 months ago

You can build using MacPorts. You need to make sure the same (required) packages are installed using MacPorts, and then modify Meta/CMake/lagom_compile_options.cmake from:

if (APPLE) list(APPEND CMAKE_PREFIX_PATH /opt/homebrew) endif()

To this:

if (APPLE) list(APPEND CMAKE_PREFIX_PATH /opt/local) endif()