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

Add ladybird.rb formula #40

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Add ladybird.rb formula #40

wants to merge 5 commits into from

Conversation

Neved4
Copy link
Owner

@Neved4 Neved4 commented Aug 24, 2024

Any PRs to build this welcome!

@Neved4 Neved4 requested a review from 0risc August 24, 2024 17:54
@Neved4 Neved4 self-assigned this Aug 24, 2024
@Neved4 Neved4 force-pushed the ladybird branch 2 times, most recently from fcec496 to bbaa1e5 Compare August 24, 2024 18:03
Copy link
Collaborator

@0risc 0risc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell Ladybird doesn't provide any precompiled builds yet so this would have to be a formula rather than a cask. Spent a few minutes on it but it looks like it'll be fairly complicated to build.

Worth considering whether it's appropriate for a brew formula at this time LadybirdBrowser/ladybird#25 (comment)

Also seems like you've got some extraneous commits in here.

Please do the following:

  1. Move it to the formulas folder
  2. Fix the style issues (tabs instead of spaces, wrong indentation)
  3. Make it actually build (seemingly will need more dependencies and possibly more build commands. not 100% sure what changes will be required. I messed with it for a while and couldn't get it to build)
  4. You may want to get rid of the extraneous commits that change README.md in unrelated ways

@Neved4 Neved4 added the help wanted Extra attention is needed label Sep 29, 2024
@Neved4
Copy link
Owner Author

Neved4 commented Oct 5, 2024

This was a typo, meant to close a different PR.

@Neved4 Neved4 closed this Oct 5, 2024
@Neved4 Neved4 reopened this Oct 5, 2024
@Neved4
Copy link
Owner Author

Neved4 commented Oct 5, 2024

@0risc

  • Fixed most brew style issues
  • Solved README.md conflicts

@Neved4
Copy link
Owner Author

Neved4 commented Oct 5, 2024

We'd appreciate any outside help to build Ladybird 🤍

@Neved4
Copy link
Owner Author

Neved4 commented Oct 5, 2024

For reference, the Nix package contains some build steps.

@Neved4 Neved4 force-pushed the ladybird branch 2 times, most recently from df26730 to b895061 Compare October 8, 2024 21:07
@Neved4
Copy link
Owner Author

Neved4 commented Oct 8, 2024

There's been some progress and got rid of some of the errors when building it.

Currently fails with:

CMake Error at /opt/homebrew/Cellar/cmake/3.30.4/share/cmake/Modules/FindPkgConfig.cmake:645 (message):
  The following required packages were not found:

   - skia=129
   - skia

Ladybird uses Skia for rendering SVG and 2D canvas.

Right now google/skia is not available in homebrew-core, so we might need to package it to build Ladybird.

@Neved4 Neved4 force-pushed the ladybird branch 7 times, most recently from 6039db7 to 41e5f7c Compare October 9, 2024 10:14
@Neved4
Copy link
Owner Author

Neved4 commented Oct 9, 2024

Decided to take a different approach using the steps from BuildInstructionsLadybird.md, namely:

brew install autoconf autoconf-archive automake ccache cmake ffmpeg nasm ninja pkg-config llvm

CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ ./Meta/ladybird.sh build

@Neved4
Copy link
Owner Author

Neved4 commented Oct 12, 2024

Ladybird seems to be building, but we need to move the resulting .app to /Applications.

@Neved4 Neved4 assigned 0risc and unassigned Neved4 and 0risc Oct 23, 2024
@tostr7191
Copy link

I installed the current ladybird.rb, and afterwards I get this:

$ ladybird 
dyld[39746]: Library not loaded: @rpath/liblagom-webview.0.dylib
  Referenced from: <7D37594E-D72D-3B29-81F9-636CCB53232B> /opt/homebrew/Cellar/ladybird/0.1.0-b9e7c6a/Ladybird.app/Contents/MacOS/Ladybird
  Reason: tried: '/opt/homebrew/Cellar/ladybird/0.1.0-b9e7c6a/Ladybird.app/Contents/lib/liblagom-webview.0.dylib' (no such file), '/opt/homebrew/Cellar/ladybird/0.1.0-b9e7c6a/Ladybird.app/Contents/lib/liblagom-webview.0.dylib' (no such file)
fish: Job 1, 'ladybird' terminated by signal SIGABRT (Abort)

The directory /opt/homebrew/Cellar/ladybird/0.1.0-b9e7c6a/Ladybird.app/Contents/lib/ does, in fact, not exist. The buildscript did finish without any reported issues however.

@Neved4
Copy link
Owner Author

Neved4 commented Nov 14, 2024

Hey @tostr7191 thx for trying this out!

Wasn't advancing with it personally, so I assigned it to @0risc.

We'd love any help to push this forward!

@tostr7191
Copy link

@Neved4 thanks for you words, I am not really knowledgeable about this subject unfortunately. But I did try to run the steps in the formula by hand, and - lo and behold - I get a functioning .app file in the build directory.

Upon further inspection, the problem seems to come from the lib in the app bundle being symlinked, but getting cleaned up by brew, which breaks the link.

I have changed the formula a bit, an now it builds a functioning .app bundle on my system, I would be grateful if someone could verify it. The main change is ln29-32, which replaces the lib symlink with the actual directory.

Formula follows, if it works I can create a proper pull request.

class Ladybird < Formula
  desc "Truly independent web browser (pre-alpha developer version)"
  homepage "https://ladybird.org/"
  url "https://github.com/LadybirdBrowser/ladybird/archive/b9e7c6a2f66d83c6af73bcc102c05d3056382c02.tar.gz"
  version "0.1.0-b9e7c6a"
  sha256 "855a293849805d89c49cc29fd87a6b3e002f68d633f7ce52065e3260046be54b"
  license "BSD-2-Clause"
  head "https://github.com/LadybirdBrowser/ladybird.git", branch: "master"

  depends_on "autoconf" => :build
  depends_on "autoconf-archive" => :build
  depends_on "automake" => :build
  depends_on "ccache" => :build
  depends_on "cmake" => :build
  depends_on "ffmpeg" => :build
  depends_on "llvm" => :build
  depends_on "nasm" => :build
  depends_on "ninja" => :build
  depends_on "pkg-config" => :build
  depends_on :macos

  def install
    ENV["CC"] = "#{Formula["llvm"].opt_bin}/clang"
    ENV["CXX"] = "#{Formula["llvm"].opt_bin}/clang++"

    system "git", "init"
    system "./Meta/ladybird.sh", "install"

    cd "Build/ladybird/bin/Ladybird.app/Contents" do
      system "unlink", "./lib"
      system "cp", "-r", "../../../lib", "."
    end

    app_name = "Ladybird.app"
    app_path = "./Build/ladybird/bin/#{app_name}"

    prefix.install app_path
    bin.install_symlink "#{prefix}/#{app_name}/Contents/MacOS/Ladybird" => "ladybird"
    #bin.install_symlink "#{prefix}/#{app_name}" => "/Applications/"
  end

  def caveats
    <<~EOS
      Ladybird is in pre-alpha stage and is intended for developers only.
    EOS
  end
end

Co-authored-by: tostr7191
@Neved4
Copy link
Owner Author

Neved4 commented Nov 16, 2024

@tostr7191 Woa thx a lot 🚀 LGTM! Added you as a Co-Author in the commit!

Also changed those system calls to more idiomatic ones to placate brew style.

@Neved4
Copy link
Owner Author

Neved4 commented Nov 16, 2024

@tostr7191 Apparently some runners are failing, lmk if u can take a look: step:7:55

@ADKaster
Copy link

Using vcpkg inside a brew formula is strange. I would expect that upstream would only accept a formula if you use other homebrew packages to obtain the dependencies.

@Neved4
Copy link
Owner Author

Neved4 commented Nov 17, 2024

Hey @ADKaster thx I think you're right!

Do you have any improvements we could add?

Cheers

@Neved4 Neved4 force-pushed the main branch 6 times, most recently from 229bbc0 to dc0a1de Compare February 2, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants