about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-03-18 00:39:50 +0100
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2024-03-20 09:53:22 +0100
commitea012e17f7c3b4d06d45bdc21574635f6a0c92d3 (patch)
tree78e66eecac7383636d8b476556c8b7fbb6a82cd4 /pkgs/by-name
parentad87dc75d6cef7a82fef5153d6bc8141e916c5a1 (diff)
downloadnixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.tar
nixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.tar.gz
nixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.tar.bz2
nixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.tar.lz
nixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.tar.xz
nixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.tar.zst
nixlib-ea012e17f7c3b4d06d45bdc21574635f6a0c92d3.zip
maloader: unstable-2014-02-25 -> 0-unstable-2018-05-02
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/ma/maloader/package.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/pkgs/by-name/ma/maloader/package.nix b/pkgs/by-name/ma/maloader/package.nix
new file mode 100644
index 000000000000..bb0f744f37b6
--- /dev/null
+++ b/pkgs/by-name/ma/maloader/package.nix
@@ -0,0 +1,63 @@
+{
+  lib,
+  llvmPackages,
+  fetchFromGitHub,
+  opencflite,
+  libuuid,
+  zlib,
+}:
+
+let
+  stdenv = llvmPackages.libcxxStdenv;
+in
+stdenv.mkDerivation {
+  pname = "maloader";
+  version = "0-unstable-2018-05-02";
+
+  src = fetchFromGitHub {
+    owner = "shinh";
+    repo = "maloader";
+    rev = "464a90fdfd06a54c9da5d1a3725ed6229c0d3d60";
+    hash = "sha256-0N3+tr8XUsn3WhJNsPVknumBrfMgDawTEXVRkIs/IV8=";
+  };
+
+  postPatch = ''
+    substituteInPlace ld-mac.cc \
+      --replace-fail 'loadLibMac(mypath)' 'loadLibMac("${placeholder "out"}/lib/")' \
+      --replace-fail 'libCoreFoundation.so' '${opencflite}/lib/libCoreFoundation.so'
+    substituteInPlace libmac/stack_protector-obsd.c \
+      --replace-fail 'sys/sysctl.h' 'linux/sysctl.h'
+  '';
+
+  buildInputs = [
+    libuuid
+    zlib
+  ];
+
+  buildFlags = [
+    "USE_LIBCXX=1"
+    "release"
+  ];
+
+  env.NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -vD libmac.so "$out/lib/libmac.so"
+
+    for bin in extract macho2elf ld-mac; do
+      install -vD "$bin" "$out/bin/$bin"
+    done
+
+    runHook postInstall
+  '';
+
+  meta = {
+    description = "Mach-O loader for Linux";
+    homepage = "https://github.com/shinh/maloader";
+    license = lib.licenses.bsd2;
+    maintainers = with lib.maintainers; [ wegank ];
+    inherit (opencflite.meta) platforms;
+  };
+}