lol
1{ stdenv, fetchgit, opencflite, clang, libcxx }:
2
3stdenv.mkDerivation {
4 name = "maloader-0git";
5
6 src = fetchgit {
7 url = "git://github.com/shinh/maloader.git";
8 rev = "5f220393e0b7b9ad0cf1aba0e89df2b42a1f0442";
9 sha256 = "07j9b7n0grrbxxyn2h8pnk6pa8b370wq5z5zwbds8dlhi7q37rhn";
10 };
11
12 postPatch = ''
13 sed -i \
14 -e '/if.*loadLibMac.*mypath/s|mypath|"'"$out/lib/"'"|' \
15 -e 's|libCoreFoundation\.so|${opencflite}/lib/&|' \
16 ld-mac.cc
17 '';
18
19 NIX_CFLAGS_COMPILE = "-I${libcxx}/include/c++/v1";
20 buildInputs = [ clang libcxx ];
21 buildFlags = [ "USE_LIBCXX=1" "release" ];
22
23 installPhase = ''
24 install -vD libmac.so "$out/lib/libmac.so"
25
26 for bin in extract macho2elf ld-mac; do
27 install -vD "$bin" "$out/bin/$bin"
28 done
29 '';
30
31 meta = {
32 description = "Mach-O loader for Linux";
33 homepage = https://github.com/shinh/maloader;
34 license = stdenv.lib.licenses.bsd2;
35 };
36}