Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ylluminate opened this issue Jun 3, 2024 · 5 comments
Open

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

ylluminate opened this issue Jun 3, 2024 · 5 comments
Labels
packaging Issue is related to packaging of Ladybird for OS distributions

Comments

@ylluminate
Copy link
Contributor

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

@kussumma
Copy link

kussumma commented Jun 5, 2024

agree! I'm ready as a tester

@ADKaster
Copy link
Member

ADKaster commented Jun 5, 2024

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
Copy link
Contributor Author

ylluminate commented Jun 6, 2024

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
  1. 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

@ADKaster ADKaster added the packaging Issue is related to packaging of Ladybird for OS distributions label Jun 18, 2024
@russes
Copy link

russes commented Jul 6, 2024

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()

@Neved4
Copy link

Neved4 commented Oct 5, 2024

We've started a tap from @ylluminate's work at Neved4/homebrew-tap#40.

Any help building it would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging Issue is related to packaging of Ladybird for OS distributions
Projects
None yet
Development

No branches or pull requests

5 participants