Skip to content

Commit

Permalink
ladybird: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
wegank committed Nov 28, 2022
1 parent dfc8fe3 commit 390c682
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
29 changes: 23 additions & 6 deletions pkgs/applications/networking/browsers/ladybird/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{ lib
, gcc11Stdenv
, stdenv
, fetchFromGitHub
, cmake
, ninja
, unzip
, wrapQtAppsHook
, libxcrypt
, qtbase
, qttools
, nixosTests
}:

Expand All @@ -17,8 +16,8 @@ let serenity = fetchFromGitHub {
rev = "a0f3e2c9a2b82117aa7c1a3444ad0d31baa070d5";
hash = "sha256-8Xde59ZfdkTD39mYSv0lfFjBHFDWTUwfozE+Q9Yq6C8=";
};

in gcc11Stdenv.mkDerivation {
in
stdenv.mkDerivation {
pname = "ladybird";
version = "unstable-2022-09-29";

Expand All @@ -30,6 +29,11 @@ in gcc11Stdenv.mkDerivation {
hash = "sha256-XQj2Bohk8F6dGCAManOmmDP5b/SqEeZXZbLDYPfvi2E=";
};

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "MACOSX_BUNDLE TRUE" "MACOSX_BUNDLE FALSE"
'';

nativeBuildInputs = [
cmake
ninja
Expand All @@ -49,6 +53,20 @@ in gcc11Stdenv.mkDerivation {
"-DENABLE_UNICODE_DATABASE_DOWNLOAD=false"
];

# error: use of undeclared identifier 'aligned_alloc'
NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.isDarwin && lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0") [
"-include mm_malloc.h"
"-Daligned_alloc=_mm_malloc"
]);

# https://github.com/NixOS/nixpkgs/issues/201254
NIX_LDFLAGS = lib.optionalString (stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU) "-lgcc";

# https://github.com/SerenityOS/serenity/issues/10055
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -add_rpath $out/lib $out/bin/ladybird
'';

passthru.tests = {
nixosTest = nixosTests.ladybird;
};
Expand All @@ -58,7 +76,6 @@ in gcc11Stdenv.mkDerivation {
homepage = "https://github.com/awesomekling/ladybird";
license = licenses.bsd2;
maintainers = with maintainers; [ fgaz ];
# SerenityOS only works on x86, and can only be built on unix systems.
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
platforms = platforms.unix;
};
}
4 changes: 3 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30042,7 +30042,9 @@ with pkgs;

ladspa-sdk = callPackage ../applications/audio/ladspa-sdk { };

ladybird = qt6.callPackage ../applications/networking/browsers/ladybird { };
ladybird = qt6Packages.callPackage ../applications/networking/browsers/ladybird {
stdenv = if stdenv.isDarwin then llvmPackages_14.stdenv else gcc11Stdenv;
};

lazpaint = callPackage ../applications/graphics/lazpaint { };

Expand Down

0 comments on commit 390c682

Please sign in to comment.