configuration/packages/ios-safari-remote-debug-kit.nix

115 lines
3.2 KiB
Nix
Raw Normal View History

2022-08-26 16:38:17 +00:00
{ lib
, fetchFromGitHub
, fetchsvn
, makeWrapper
, stdenv
# Dependencies
, ios-webkit-debug-proxy
, python3
}:
stdenv.mkDerivation {
pname = "ios-safari-remote-debug-kit";
version = "unstable-2022-06-21";
src = fetchFromGitHub {
owner = "HimbeersaftLP";
repo = "ios-safari-remote-debug-kit";
rev = "0891aab2c8ff33bf758133e32af76ee42781dcf8";
hash = "sha256-/1I8P9x71XLd/IvYk763WD2imEBilZX94srf/MaaY08=";
};
webkitSrc = fetchsvn {
url = "https://svn.webkit.org/repository/webkit/trunk/Source/WebInspectorUI/UserInterface";
rev = "295779";
sha256 = "sha256-3Vfkmsgzue6CAUVTWo7b8aTD/dEOGgGWqaKJ2mHmlCQ=";
};
postUnpack = ''
mkdir --parents $sourceRoot/src/WebKit/Source/WebInspectorUI
cp --no-preserve=mode --recursive --reflink=auto $webkitSrc \
$sourceRoot/src/WebKit/Source/WebInspectorUI/UserInterface
'';
patches = [
(builtins.toFile "disable-fetch.patch" ''
--- a/src/generate.sh
+++ b/src/generate.sh
@@ -9,11 +8,0 @@
-if [ -d "WebKit" ]; then
- echo "WebKit folder already exists!"
- echo "Delete it if you want to update your installation."
- read -p "Press enter to close this window!"
- exit
-fi
-
-echo "Downloading original WebInspector"
-svn checkout \
- https://svn.webkit.org/repository/webkit/trunk/Source/WebInspectorUI/UserInterface \
- WebKit/Source/WebInspectorUI/UserInterface
'')
(builtins.toFile "disable-interactive.patch" ''
--- a/src/generate.sh
+++ b/src/generate.sh
@@ -46 +41,0 @@
-read -p "Press enter to close this window!"
\ No newline at end of file
'')
(builtins.toFile "disable-legacy-protocol" ''
--- a/src/generate.sh
+++ b/src/generate.sh
@@ -37,7 +26,0 @@
-echo "Copying InspectorBackendCommands.js for the latest version"
-protocolPath="WebKit/Source/WebInspectorUI/UserInterface/Protocol"
-legacyPath="$protocolPath/Legacy"
-versionFolder="$(ls -1 $legacyPath | sort | tail -n 1)"
-backendCommandsFile="$legacyPath/$versionFolder/InspectorBackendCommands.js"
-echo " -> Choosing file $backendCommandsFile"
-cp $backendCommandsFile $protocolPath
'')
(builtins.toFile "enable-strict.patch" ''
--- a/src/generate.sh
+++ b/src/generate.sh
@@ -1,2 +1,3 @@
#!/bin/bash
+set -eu
'')
(builtins.toFile "fix-proxy-command.patch" ''
--- a/src/start.sh
+++ b/src/start.sh
@@ -16 +16 @@
-DEBUG_PROXY_EXE="ios-webkit-debug-proxy"
+DEBUG_PROXY_EXE="ios_webkit_debug_proxy"
'')
];
postPatch = ''
chmod +x src/{generate,start}.sh
patchShebangs src/generate.sh
'';
nativeBuildInputs = [ makeWrapper ];
buildPhase = "./src/generate.sh";
installPhase = ''
install -D -t $out src/start.sh
makeWrapper $out/start.sh $out/bin/ios-safari-remote-debug-kit \
--prefix PATH : ${lib.makeBinPath [ ios-webkit-debug-proxy python3 ]}
cp --reflink=auto --recursive --target-directory $out src/WebKit
'';
meta = {
description = "Remotely debugging iOS Safari on Windows and Linux";
homepage = "https://github.com/HimbeersaftLP/ios-safari-remote-debug-kit";
license = lib.licenses.gpl3;
};
}