redumper: 709 → 720, enable on Darwin (#526210)
This commit is contained in:
@@ -2,43 +2,66 @@
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
ctestCheckHook,
|
||||
ninja,
|
||||
llvmPackages,
|
||||
gtest,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
}:
|
||||
|
||||
# redumper is using C++ modules, this requires latest C++20 compiler and build tools
|
||||
llvmPackages.libcxxStdenv.mkDerivation (finalAttrs: {
|
||||
pname = "redumper";
|
||||
version = "709";
|
||||
version = "720";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "superg";
|
||||
repo = "redumper";
|
||||
tag = "b${finalAttrs.version}";
|
||||
hash = "sha256-3J+/v8Rhu5yT+MgAxcNBiHLAPAcNWc/YJXxFMgOZnPs=";
|
||||
hash = "sha256-Gl+BJV9yWFGHk5HZudre+YUaaqCYcQpT50oeDcc39ds=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./remove-static-linking.patch
|
||||
];
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ctestCheckHook
|
||||
ninja
|
||||
llvmPackages.clang-tools
|
||||
];
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = "-isystem ${llvmPackages.libcxx.dev}/include/c++/v1";
|
||||
|
||||
# https://github.com/superg/redumper/blob/main/.github/workflows/cmake.yml
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON"
|
||||
"-DREDUMPER_VERSION_BUILD=${finalAttrs.version}"
|
||||
"-DREDUMPER_CLANG_LINK_OPTIONS=" # overrides the '-static' default
|
||||
(lib.cmakeFeature "REDUMPER_VERSION_BUILD" "${finalAttrs.src.tag}")
|
||||
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_GOOGLETEST" "${gtest.src}")
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
doInstallCheck = true;
|
||||
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
|
||||
passthru.updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--version-regex"
|
||||
"b(.*)"
|
||||
];
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/superg/redumper";
|
||||
description = "Low level CD dumper utility";
|
||||
license = lib.licenses.gpl3Plus;
|
||||
maintainers = with lib.maintainers; [ hughobrien ];
|
||||
platforms = lib.platforms.linux;
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "redumper";
|
||||
};
|
||||
})
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2f5d66a..e437573 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -221,39 +221,8 @@ endif()
|
||||
|
||||
target_link_libraries(redumper ${libs})
|
||||
|
||||
-if(REDUMPER_TARGET_LINUX)
|
||||
- target_link_options(redumper PRIVATE "-static")
|
||||
-endif()
|
||||
-
|
||||
install(TARGETS redumper DESTINATION "bin")
|
||||
|
||||
-# bundle LLVM libc++ for C++20 support (system libc++ is too old, static linking not allowed on macOS)
|
||||
-if(REDUMPER_TARGET_MACOS)
|
||||
- set_target_properties(redumper PROPERTIES INSTALL_RPATH "@executable_path/../lib")
|
||||
-
|
||||
- install(FILES
|
||||
- "${LLVM_LIB_PATH}/c++/libc++.1.0.dylib"
|
||||
- "${LLVM_LIB_PATH}/c++/libc++.1.dylib"
|
||||
- "${LLVM_LIB_PATH}/c++/libc++abi.1.0.dylib"
|
||||
- "${LLVM_LIB_PATH}/c++/libc++abi.1.dylib"
|
||||
- "${LLVM_LIB_PATH}/libunwind.1.0.dylib"
|
||||
- "${LLVM_LIB_PATH}/libunwind.1.dylib"
|
||||
- DESTINATION "lib"
|
||||
- )
|
||||
-
|
||||
- # fix install names after files are copied & re-sign binaries after modification (install_name_tool invalidates signatures)
|
||||
- install(CODE "
|
||||
- execute_process(COMMAND install_name_tool -change ${LLVM_LIB_PATH}/c++/libc++.1.dylib @rpath/libc++.1.dylib \${CMAKE_INSTALL_PREFIX}/bin/redumper)
|
||||
- execute_process(COMMAND install_name_tool -id @rpath/libc++.1.dylib \${CMAKE_INSTALL_PREFIX}/lib/libc++.1.0.dylib)
|
||||
- execute_process(COMMAND install_name_tool -id @rpath/libc++abi.1.dylib \${CMAKE_INSTALL_PREFIX}/lib/libc++abi.1.0.dylib)
|
||||
- execute_process(COMMAND install_name_tool -id @rpath/libunwind.1.dylib \${CMAKE_INSTALL_PREFIX}/lib/libunwind.1.0.dylib)
|
||||
- execute_process(COMMAND codesign --force --sign - \${CMAKE_INSTALL_PREFIX}/bin/redumper)
|
||||
- execute_process(COMMAND codesign --force --sign - \${CMAKE_INSTALL_PREFIX}/lib/libc++.1.0.dylib)
|
||||
- execute_process(COMMAND codesign --force --sign - \${CMAKE_INSTALL_PREFIX}/lib/libc++abi.1.0.dylib)
|
||||
- execute_process(COMMAND codesign --force --sign - \${CMAKE_INSTALL_PREFIX}/lib/libunwind.1.0.dylib)
|
||||
- ")
|
||||
-endif()
|
||||
-
|
||||
# Windows 7 requires administrative access in order to access the disc drive
|
||||
if(MSVC AND CMAKE_SYSTEM_VERSION VERSION_EQUAL "6.1")
|
||||
set_target_properties(redumper PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
|
||||
Reference in New Issue
Block a user