scopehal-apps: 0-unstable-2024-09-16 -> 0.1 (#446585)

This commit is contained in:
dish
2025-09-30 14:45:47 +00:00
committed by GitHub
3 changed files with 127 additions and 14 deletions

View File

@@ -13,7 +13,9 @@
libsigcxx,
glew,
zstd,
wrapGAppsHook4,
wrapGAppsHook3,
makeBinaryWrapper,
writeDarwinBundle,
shaderc,
vulkan-headers,
vulkan-loader,
@@ -23,17 +25,22 @@
ffts,
moltenvk,
llvmPackages,
hidapi,
}:
stdenv.mkDerivation {
let
pname = "scopehal-apps";
version = "0-unstable-2024-09-16";
version = "0.1";
in
stdenv.mkDerivation {
pname = "${pname}";
version = "${version}";
src = fetchFromGitHub {
owner = "ngscopeclient";
repo = "scopehal-apps";
rev = "d2a1a2f17e9398a3f60c99483dd2f6dbc2e62efc";
hash = "sha256-FQoaTuL6mEqnH8oNXwHpDcOEAPGExqj6lhrUhZ9VAQ4=";
repo = "${pname}";
tag = "v${version}";
hash = "sha256-AfO6JaWA9ECMI6FkMg/LaAG4QMeZmG9VxHiw0dSJYNM=";
fetchSubmodules = true;
};
@@ -46,7 +53,11 @@ stdenv.mkDerivation {
spirv-tools
]
++ lib.optionals stdenv.hostPlatform.isLinux [
wrapGAppsHook4
wrapGAppsHook3
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
makeBinaryWrapper
writeDarwinBundle
];
buildInputs = [
@@ -61,6 +72,7 @@ stdenv.mkDerivation {
vulkan-tools
yaml-cpp
zstd
hidapi
]
++ lib.optionals stdenv.hostPlatform.isLinux [
ffts
@@ -72,15 +84,30 @@ stdenv.mkDerivation {
moltenvk
];
# Targets InitializeSearchPaths
postPatch = ''
substituteInPlace lib/scopehal/scopehal.cpp \
--replace-fail '"/share/' '"/../share/'
cmakeFlags = [
"-DNGSCOPECLIENT_VERSION=${version}"
];
patches = [
./remove-git-derived-version.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
./remove-brew-molten-vk-lookup.patch
];
postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
mv -v $out/bin/ngscopeclient $out/bin/.ngscopeclient-unwrapped
makeWrapper $out/bin/.ngscopeclient-unwrapped $out/bin/ngscopeclient \
--prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath ([ vulkan-loader ])}"
'';
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
"-DCMAKE_INSTALL_RPATH=${lib.strings.makeLibraryPath [ vulkan-loader ]}"
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications/ngscopeclient.app/Contents/{MacOS,Resources}
install -m644 {../src/ngscopeclient/icons/macos,$out/Applications/ngscopeclient.app/Contents/Resources}/ngscopeclient.icns
write-darwin-bundle $out ngscopeclient ngscopeclient ngscopeclient
'';
meta = {
description = "Advanced test & measurement remote control and analysis suite";

View File

@@ -0,0 +1,36 @@
diff --git a/src/ngscopeclient/CMakeLists.txt b/src/ngscopeclient/CMakeLists.txt
index fb6d19fa..25611981 100644
--- a/src/ngscopeclient/CMakeLists.txt
+++ b/src/ngscopeclient/CMakeLists.txt
@@ -249,31 +249,6 @@ if(LINUX)
DESTINATION share/mime/packages)
endif()
-if(APPLE)
- set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/ngscopeclient")
- set(DIRS "\${CMAKE_INSTALL_PREFIX}/lib")
- set(FRAMEWORKS "\${CMAKE_INSTALL_PREFIX}/Frameworks")
- execute_process(
- COMMAND brew --prefix molten-vk
- RESULT_VARIABLE MOLTEN_VK_RESULT
- OUTPUT_VARIABLE MOLTEN_VK_OUTPUT
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- if(NOT MOLTEN_VK_RESULT EQUAL 0)
- message(FATAL_ERROR "failed to find Homebrew prefix for molten-vk")
- endif()
- # https://vulkan.lunarg.com/doc/view/1.3.275.0/mac/getting_started.html#application-bundle-structure-on-macos
- install(FILES "${CMAKE_SOURCE_DIR}/src/ngscopeclient/macos/MoltenVK_icd.json"
- DESTINATION bin/vulkan/icd.d/)
- install(FILES "${MOLTEN_VK_OUTPUT}/lib/libMoltenVK.dylib" DESTINATION lib)
- install(CODE "
- include(BundleUtilities)
- fixup_bundle(\"${APPS}\" \"lib/libMoltenVK.dylib\" \"${DIRS}\")
- include(\"${CMAKE_SOURCE_DIR}/src/ngscopeclient/macos/signing.cmake\")
- ")
-endif()
-
# ngscopeclient Windows portable zip/MSI installer build
if(WIXPATH AND WIN32)
# Run the command to get /mingw64/bin full path using where gcc

View File

@@ -0,0 +1,50 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d362165d..7e3dfd09 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,45 +23,6 @@ if(DEFINED ENV{VULKAN_SDK})
endif()
endif()
-# Git is used for git-describe based version generation if we have it
-find_package(Git)
-
-#Set up versioning (with a dummy string for now if Git isn't present)
-if(Git_FOUND)
- execute_process(
- COMMAND ${GIT_EXECUTABLE} describe --always --tags
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE NGSCOPECLIENT_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("Git reports scopehal-apps version ${NGSCOPECLIENT_VERSION}")
-
-
- execute_process(
- COMMAND ${GIT_EXECUTABLE} describe --always --tags --long
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE NGSCOPECLIENT_VERSION_LONG
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- # TODO: if/when we have a point release, make MSI version 10x+9
- # ex: 0.1.2-rc2 is 0.1.22
- # ex: 0.1.2 is 0.1.29
-
- # Ugly string parsing to make windows build happy
- # First path: release candidate tags
- if(NGSCOPECLIENT_VERSION_LONG MATCHES "v([0-9]*).([0-9]*)-rc([0-9])-([0-9]*)")
- set(MSI_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${CMAKE_MATCH_4}")
-
- # Release tags
- elseif(NGSCOPECLIENT_VERSION_LONG MATCHES "v([0-9]*).([0-9]*)-([0-9]*)")
- set(MSI_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.9.${CMAKE_MATCH_3}")
- endif()
-
-else()
- set(NGSCOPECLIENT_VERSION "unknown")
- set(MSI_VERSION "0.1")
- message("Git not detected, scopehal-apps version unknown")
-endif()
-
set(PROJECT_VERSION "${NGSCOPECLIENT_VERSION}")
include(CTest)