mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00
darling: drop (#405727)
This commit is contained in:
commit
5adbb5f72a
6 changed files with 1 additions and 348 deletions
|
@ -186,7 +186,6 @@
|
||||||
./programs/corefreq.nix
|
./programs/corefreq.nix
|
||||||
./programs/cpu-energy-meter.nix
|
./programs/cpu-energy-meter.nix
|
||||||
./programs/criu.nix
|
./programs/criu.nix
|
||||||
./programs/darling.nix
|
|
||||||
./programs/dconf.nix
|
./programs/dconf.nix
|
||||||
./programs/digitalbitbox/default.nix
|
./programs/digitalbitbox/default.nix
|
||||||
./programs/direnv.nix
|
./programs/direnv.nix
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.programs.darling;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
programs.darling = {
|
|
||||||
enable = lib.mkEnableOption "Darling, a Darwin/macOS compatibility layer for Linux";
|
|
||||||
package = lib.mkPackageOption pkgs "darling" { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
security.wrappers.darling = {
|
|
||||||
source = lib.getExe cfg.package;
|
|
||||||
owner = "root";
|
|
||||||
group = "root";
|
|
||||||
setuid = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -373,7 +373,6 @@ in
|
||||||
croc = handleTest ./croc.nix { };
|
croc = handleTest ./croc.nix { };
|
||||||
cross-seed = runTest ./cross-seed.nix;
|
cross-seed = runTest ./cross-seed.nix;
|
||||||
cyrus-imap = runTest ./cyrus-imap.nix;
|
cyrus-imap = runTest ./cyrus-imap.nix;
|
||||||
darling = handleTest ./darling.nix { };
|
|
||||||
darling-dmg = runTest ./darling-dmg.nix;
|
darling-dmg = runTest ./darling-dmg.nix;
|
||||||
dae = handleTest ./dae.nix { };
|
dae = handleTest ./dae.nix { };
|
||||||
davis = runTest ./davis.nix;
|
davis = runTest ./davis.nix;
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
import ./make-test-python.nix (
|
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
# Well, we _can_ cross-compile from Linux :)
|
|
||||||
hello =
|
|
||||||
pkgs.runCommand "hello"
|
|
||||||
{
|
|
||||||
sdk = "${pkgs.darling.sdk}/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk";
|
|
||||||
nativeBuildInputs = with pkgs.llvmPackages_14; [
|
|
||||||
clang-unwrapped
|
|
||||||
lld
|
|
||||||
];
|
|
||||||
src = pkgs.writeText "hello.c" ''
|
|
||||||
#include <stdio.h>
|
|
||||||
int main() {
|
|
||||||
printf("Hello, Darling!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
''
|
|
||||||
clang \
|
|
||||||
-target x86_64-apple-darwin \
|
|
||||||
-fuse-ld=lld \
|
|
||||||
-nostdinc -nostdlib \
|
|
||||||
-mmacosx-version-min=10.15 \
|
|
||||||
--sysroot $sdk \
|
|
||||||
-isystem $sdk/usr/include \
|
|
||||||
-L $sdk/usr/lib -lSystem \
|
|
||||||
$src -o $out
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
name = "darling";
|
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [ zhaofengli ];
|
|
||||||
|
|
||||||
nodes.machine = {
|
|
||||||
programs.darling.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
testScript = ''
|
|
||||||
start_all()
|
|
||||||
|
|
||||||
# Darling holds stdout until the server is shutdown
|
|
||||||
machine.succeed("darling ${hello} >hello.out")
|
|
||||||
machine.succeed("grep Hello hello.out")
|
|
||||||
machine.succeed("darling shutdown")
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
)
|
|
|
@ -1,267 +0,0 @@
|
||||||
{
|
|
||||||
clangStdenv,
|
|
||||||
lib,
|
|
||||||
runCommandWith,
|
|
||||||
writeShellScript,
|
|
||||||
fetchFromGitHub,
|
|
||||||
fetchpatch,
|
|
||||||
nixosTests,
|
|
||||||
|
|
||||||
freetype,
|
|
||||||
libjpeg,
|
|
||||||
libpng,
|
|
||||||
libtiff,
|
|
||||||
giflib,
|
|
||||||
libX11,
|
|
||||||
libXext,
|
|
||||||
libXrandr,
|
|
||||||
libXcursor,
|
|
||||||
libxkbfile,
|
|
||||||
cairo,
|
|
||||||
libglvnd,
|
|
||||||
fontconfig,
|
|
||||||
dbus,
|
|
||||||
libGLU,
|
|
||||||
fuse,
|
|
||||||
ffmpeg,
|
|
||||||
pulseaudio,
|
|
||||||
|
|
||||||
makeWrapper,
|
|
||||||
python2,
|
|
||||||
python3,
|
|
||||||
cmake,
|
|
||||||
ninja,
|
|
||||||
pkg-config,
|
|
||||||
bison,
|
|
||||||
flex,
|
|
||||||
|
|
||||||
libbsd,
|
|
||||||
openssl,
|
|
||||||
|
|
||||||
xdg-user-dirs,
|
|
||||||
|
|
||||||
addDriverRunpath,
|
|
||||||
|
|
||||||
# Whether to pre-compile Python 2 bytecode for performance.
|
|
||||||
compilePy2Bytecode ? false,
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
stdenv = clangStdenv;
|
|
||||||
|
|
||||||
# The build system invokes clang to compile Darwin executables.
|
|
||||||
# In this case, our cc-wrapper must not be used.
|
|
||||||
ccWrapperBypass =
|
|
||||||
runCommandWith
|
|
||||||
{
|
|
||||||
inherit stdenv;
|
|
||||||
name = "cc-wrapper-bypass";
|
|
||||||
runLocal = false;
|
|
||||||
derivationArgs = {
|
|
||||||
template = writeShellScript "template" ''
|
|
||||||
for (( i=1; i<=$#; i++)); do
|
|
||||||
j=$((i+1))
|
|
||||||
if [[ "''${!i}" == "-target" && "''${!j}" == *"darwin"* ]]; then
|
|
||||||
# their flags must take precedence
|
|
||||||
exec @unwrapped@ "$@" $NIX_CFLAGS_COMPILE
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exec @wrapped@ "$@"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
''
|
|
||||||
unwrapped_bin=${stdenv.cc.cc}/bin
|
|
||||||
wrapped_bin=${stdenv.cc}/bin
|
|
||||||
|
|
||||||
mkdir -p $out/bin
|
|
||||||
|
|
||||||
unwrapped=$unwrapped_bin/$CC wrapped=$wrapped_bin/$CC \
|
|
||||||
substituteAll $template $out/bin/$CC
|
|
||||||
unwrapped=$unwrapped_bin/$CXX wrapped=$wrapped_bin/$CXX \
|
|
||||||
substituteAll $template $out/bin/$CXX
|
|
||||||
|
|
||||||
chmod +x $out/bin/$CC $out/bin/$CXX
|
|
||||||
'';
|
|
||||||
|
|
||||||
wrappedLibs = [
|
|
||||||
# To find all of them: rg -w wrap_elf
|
|
||||||
|
|
||||||
# src/native/CMakeLists.txt
|
|
||||||
freetype
|
|
||||||
libjpeg
|
|
||||||
libpng
|
|
||||||
libtiff
|
|
||||||
giflib
|
|
||||||
libX11
|
|
||||||
libXext
|
|
||||||
libXrandr
|
|
||||||
libXcursor
|
|
||||||
libxkbfile
|
|
||||||
cairo
|
|
||||||
libglvnd
|
|
||||||
fontconfig
|
|
||||||
dbus
|
|
||||||
libGLU
|
|
||||||
|
|
||||||
# src/external/darling-dmg/CMakeLists.txt
|
|
||||||
fuse
|
|
||||||
|
|
||||||
# src/CoreAudio/CMakeLists.txt
|
|
||||||
ffmpeg
|
|
||||||
pulseaudio
|
|
||||||
];
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "darling";
|
|
||||||
version = "unstable-2024-02-03";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "darlinghq";
|
|
||||||
repo = "darling";
|
|
||||||
rev = "25afbc76428c39c3909e9efcf5caef1140425211";
|
|
||||||
fetchSubmodules = true;
|
|
||||||
hash = "sha256-z9IMgc5hH2Upn8wHl1OgP42q9HTSkeHnxB3N812A+Kc=";
|
|
||||||
# Remove 500MB of dependency test files to get under Hydra output limit
|
|
||||||
postFetch = ''
|
|
||||||
rm -r $out/src/external/openjdk/test
|
|
||||||
rm -r $out/src/external/libmalloc/tests
|
|
||||||
rm -r $out/src/external/libarchive/libarchive/tar/test
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = [
|
|
||||||
"out"
|
|
||||||
"sdk"
|
|
||||||
];
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
# Fix 'clang: error: no such file or directory: .../signal/mach_excUser.c'
|
|
||||||
# https://github.com/darlinghq/darling/issues/1511
|
|
||||||
# https://github.com/darlinghq/darling/commit/f46eb721c11d32addd807f092f4b3a6ea515bb6d
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/darlinghq/darling/commit/f46eb721c11d32addd807f092f4b3a6ea515bb6d.patch?full_index=1";
|
|
||||||
hash = "sha256-FnLcHnK4cNto+E3OQSxE3iK+FHSU8y459FcpMvrzd6o=";
|
|
||||||
})
|
|
||||||
|
|
||||||
# Fix compatibility with ffmpeg_7
|
|
||||||
# https://github.com/darlinghq/darling/pull/1537
|
|
||||||
# https://github.com/darlinghq/darling/commit/9655d5598c87dcb22c54a83cc7741b77cb47a1b0
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/darlinghq/darling/commit/9655d5598c87dcb22c54a83cc7741b77cb47a1b0.patch?full_index=1";
|
|
||||||
hash = "sha256-ogMo4SRRwiOhaVJ+OS8BVolGDa7vGKyR9bdGiOiCuRc=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
# We have to be careful - Patching everything indiscriminately
|
|
||||||
# would affect Darwin scripts as well
|
|
||||||
chmod +x src/external/bootstrap_cmds/migcom.tproj/mig.sh
|
|
||||||
patchShebangs \
|
|
||||||
src/external/bootstrap_cmds/migcom.tproj/mig.sh \
|
|
||||||
src/external/darlingserver/scripts \
|
|
||||||
src/external/openssl_certificates/scripts
|
|
||||||
|
|
||||||
substituteInPlace src/startup/CMakeLists.txt --replace SETUID ""
|
|
||||||
substituteInPlace src/external/basic_cmds/CMakeLists.txt --replace SETGID ""
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
bison
|
|
||||||
ccWrapperBypass
|
|
||||||
cmake
|
|
||||||
flex
|
|
||||||
makeWrapper
|
|
||||||
ninja
|
|
||||||
pkg-config
|
|
||||||
python3
|
|
||||||
] ++ lib.optional compilePy2Bytecode python2;
|
|
||||||
buildInputs = wrappedLibs ++ [
|
|
||||||
libbsd
|
|
||||||
openssl
|
|
||||||
stdenv.cc.libc.linuxHeaders
|
|
||||||
];
|
|
||||||
|
|
||||||
# Breaks valid paths like
|
|
||||||
# Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
|
|
||||||
dontFixCmake = true;
|
|
||||||
|
|
||||||
# src/external/objc4 forces OBJC_IS_DEBUG_BUILD=1, which conflicts with NDEBUG
|
|
||||||
# TODO: Fix in a better way
|
|
||||||
cmakeBuildType = " ";
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DTARGET_i386=OFF"
|
|
||||||
"-DCOMPILE_PY2_BYTECODE=${if compilePy2Bytecode then "ON" else "OFF"}"
|
|
||||||
"-DDARLINGSERVER_XDG_USER_DIR_CMD=${xdg-user-dirs}/bin/xdg-user-dir"
|
|
||||||
];
|
|
||||||
|
|
||||||
env.NIX_CFLAGS_COMPILE = "-Wno-macro-redefined -Wno-unused-command-line-argument";
|
|
||||||
|
|
||||||
# Linux .so's are dlopen'd by wrapgen during the build
|
|
||||||
env.LD_LIBRARY_PATH = lib.makeLibraryPath wrappedLibs;
|
|
||||||
|
|
||||||
# Breaks shebangs of Darwin scripts
|
|
||||||
dontPatchShebangs = true;
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
# Install the SDK as a separate output
|
|
||||||
mkdir -p $sdk
|
|
||||||
|
|
||||||
sdkDir=$(readlink -f ../Developer)
|
|
||||||
|
|
||||||
while read -r path; do
|
|
||||||
dst="$sdk/Developer/''${path#$sdkDir}"
|
|
||||||
|
|
||||||
if [[ -L "$path" ]]; then
|
|
||||||
target=$(readlink -m "$path")
|
|
||||||
if [[ -e "$target" && "$target" == "$NIX_BUILD_TOP"* && "$target" != "$sdkDir"* ]]; then
|
|
||||||
# dereference
|
|
||||||
cp -r -L "$path" "$dst"
|
|
||||||
elif [[ -e "$target" ]]; then
|
|
||||||
# preserve symlink
|
|
||||||
cp -d "$path" "$dst"
|
|
||||||
else
|
|
||||||
# ignore symlink
|
|
||||||
>&2 echo "Ignoring symlink $path -> $target"
|
|
||||||
fi
|
|
||||||
elif [[ -f $path ]]; then
|
|
||||||
cp "$path" "$dst"
|
|
||||||
elif [[ -d $path ]]; then
|
|
||||||
mkdir -p "$dst"
|
|
||||||
fi
|
|
||||||
done < <(find $sdkDir)
|
|
||||||
|
|
||||||
mkdir -p $sdk/bin
|
|
||||||
cp src/external/cctools-port/cctools/ld64/src/*-ld $sdk/bin
|
|
||||||
cp src/external/cctools-port/cctools/ar/*-{ar,ranlib} $sdk/bin
|
|
||||||
'';
|
|
||||||
|
|
||||||
postFixup = ''
|
|
||||||
echo "Checking for references to $NIX_STORE in Darling root..."
|
|
||||||
|
|
||||||
set +e
|
|
||||||
grep -r --exclude=mldr "$NIX_STORE" $out/libexec/darling
|
|
||||||
ret=$?
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [[ $ret == 0 ]]; then
|
|
||||||
echo "Found references to $NIX_STORE in Darling root (see above)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
patchelf --add-rpath "${lib.makeLibraryPath wrappedLibs}:${addDriverRunpath.driverLink}/lib" \
|
|
||||||
$out/libexec/darling/usr/libexec/darling/mldr
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.tests.nixos = nixosTests.darling;
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "Open-source Darwin/macOS emulation layer for Linux";
|
|
||||||
homepage = "https://www.darlinghq.org";
|
|
||||||
changelog = "https://github.com/darlinghq/darling/releases";
|
|
||||||
license = licenses.gpl3Plus;
|
|
||||||
maintainers = with maintainers; [ zhaofengli ];
|
|
||||||
platforms = [ "x86_64-linux" ];
|
|
||||||
mainProgram = "darling";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -497,6 +497,7 @@ mapAliases {
|
||||||
### D ###
|
### D ###
|
||||||
|
|
||||||
dap = throw "'dap' has been removed because it doesn't compile and has been unmaintained since 2014"; # Added 2025-05-10
|
dap = throw "'dap' has been removed because it doesn't compile and has been unmaintained since 2014"; # Added 2025-05-10
|
||||||
|
darling = throw "'darling' has been removed due to vendoring Python2"; # Added 2025-05-10
|
||||||
dart_stable = throw "'dart_stable' has been renamed to/replaced by 'dart'"; # Converted to throw 2024-10-17
|
dart_stable = throw "'dart_stable' has been renamed to/replaced by 'dart'"; # Converted to throw 2024-10-17
|
||||||
dart-sass-embedded = throw "dart-sass-embedded has been removed from nixpkgs, as is now included in Dart Sass itself.";
|
dart-sass-embedded = throw "dart-sass-embedded has been removed from nixpkgs, as is now included in Dart Sass itself.";
|
||||||
dat = nodePackages.dat;
|
dat = nodePackages.dat;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue