diff --git a/pkgs/applications/networking/browsers/ladybird/default.nix b/pkgs/applications/networking/browsers/ladybird/default.nix index 0bd3cc79df257..1bba399997f46 100644 --- a/pkgs/applications/networking/browsers/ladybird/default.nix +++ b/pkgs/applications/networking/browsers/ladybird/default.nix @@ -1,5 +1,5 @@ { lib -, gcc11Stdenv +, stdenv , fetchFromGitHub , cmake , ninja @@ -7,7 +7,6 @@ , wrapQtAppsHook , libxcrypt , qtbase -, qttools , nixosTests }: @@ -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"; @@ -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 @@ -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; }; @@ -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; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 63dd74b56d507..cc78d11d4cb98 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };