Skip to content

Commit

Permalink
use lessmsi
Browse files Browse the repository at this point in the history
  • Loading branch information
Neumann-A committed Nov 12, 2024
1 parent 4b98150 commit 5e74626
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ports/msvc/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(NOT VCPKG_CRT_LINKAGE STREQUAL "static")

if(NOT VCPKG_BUILD_TYPE)
file(COPY "${CURRENT_PACKAGES_DIR}/VS/VC/Redist/MSVC/${VCToolkit_REDIST_VERSION}/debug_nonredist/x64/Microsoft.VC143.DebugCRT/" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(COPY "${CURRENT_PACKAGES_DIR}/VS/VC/Redist/MSVC/${VCToolkit_REDIST_VERSION}/debug_nonredist/x64/Microsoft.VC143.DebugMFC/" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(COPY "${CURRENT_PACKAGES_DIR}/VS/VC/Redist/MSVC/${VCToolkit_REDIST_VERSION}/debug_nonredist/x64/Microsoft.VC143.DebugMFC/" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(COPY "${CURRENT_PACKAGES_DIR}/WinSDK/Windows Kits/10/bin/${WinSDK_VERSION}/x64/ucrt" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(COPY "${CURRENT_PACKAGES_DIR}/WinSDK/Windows Kits/10/Redist/${WinSDK_VERSION}/ucrt/DLLs/x64/" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin" PATTERN "ucrtbase.dll" EXCLUDE)
endif()
Expand Down
2 changes: 0 additions & 2 deletions ports/msvc/portfile_msbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ block()

set(counter 0)
foreach(item IN LISTS vsix_installers)
math(EXPR counter "${counter} + 1")
message(STATUS "Extracting '${item}'")
vcpkg_execute_required_process(
COMMAND "${pwsh_exe}" -ExecutionPolicy Bypass -File "${CMAKE_CURRENT_LIST_DIR}/extract-vsix.ps1" "-VsixFile" "${item}" "-ExtractTo" "${CURRENT_PACKAGES_DIR}/VS"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
Expand Down
55 changes: 25 additions & 30 deletions ports/msvc/portfile_winsdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,33 +70,42 @@ block()

message(STATUS "Extracting '${componentName}'")
string(REPLACE " " "" componentName "${componentName}")
set(installLocation "${CURRENT_BUILDTREES_DIR}/sdk/${counter}")
set(installLocation "${CURRENT_BUILDTREES_DIR}/sdk")

# Create the install location directory
file(MAKE_DIRECTORY "${installLocation}")
cmake_path(NATIVE_PATH installLocation NORMALIZE installLocation)
cmake_path(NATIVE_PATH msi NORMALIZE msi)

# Extract the MSI file
cmake_path(NATIVE_PATH msi msi_native)
vcpkg_execute_required_process(
COMMAND msiexec /a "${msi}" /lvoicewarmupx "msiexec_${componentName}.log" /quiet /qn "TARGETDIR=${installLocation}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME "msiexec_${componentName}_cmake.log"
COMMAND "${LESSMSI}" x "${msi_native}"
WORKING_DIRECTORY "${installLocation}"
LOGNAME "lessmsi-${componentName}_cmake.log"
)
cmake_path(GET msi FILENAME packstem)
string(REPLACE ".msi" "" packstem "${packstem}")
#vcpkg_execute_required_process(
# COMMAND msiexec /a "${msi}" /lvoicewarmupx "msiexec_${componentName}.log" /quiet /qn "TARGETDIR=${installLocation}"
# WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
# LOGNAME "msiexec_${componentName}_cmake.log"
#)

# Remove the MSI file from the install location
file(REMOVE "${installLocation}/${filename}")
#file(REMOVE "${installLocation}/${filename}")

# Check if the install location has files or directories
file(GLOB filesAndDirs "${installLocation}/*")
if(NOT filesAndDirs)
message(STATUS "Installer had no files or dirs to extract")
endif()
#file(GLOB filesAndDirs "${installLocation}/${packstem}/*")
#if(NOT filesAndDirs)
# message(STATUS "Installer had no files or dirs to extract")
#endif()

# Copy the extracted files to the SDK install folder
if(EXISTS "${installLocation}")
file(COPY "${installLocation}/" DESTINATION "${installFolderSdk}/")
if(EXISTS "${installLocation}/${packstem}/SourceDir/")
file(COPY "${installLocation}/${packstem}/SourceDir/" DESTINATION "${installFolderSdk}/")
else()
message(STATUS "Installer had no files or dirs to extract")
message(STATUS "Skipping '${componentName}'")
endif()

Expand All @@ -114,28 +123,14 @@ block()

# Handle specific component
if(componentName MATCHES "WindowsAppCertificationKitNativeComponents-x64_en-us")
set(kitsPath "${installFolderSdk}/Program Files/Windows Kits")
set(kitsPath "${installFolderSdk}/Windows Kits")
file(MAKE_DIRECTORY "${kitsPath}")
file(COPY "${installLocation}/Windows Kits" DESTINATION "${kitsPath}")
endif()
endforeach()

# Remove unknown stuff
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/WinSDK/Windows App Certification Kit/")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/WinSDK/Microsoft/")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/WinSDK/Microsoft SDKs/")
endblock()

# copy(self, "winsdk-config.cmake", Path(self.source_folder), Path(f"{self.package_folder}/share/winsdk"))

# #Cleanup unused stuff
# rmdir(self, path.join(self.package_folder, "single_components"))
# rmdir(self, path.join(self.package_folder, "Windows App Certification Kit"))
# rmdir(self, path.join(self.package_folder, "Microsoft"))

# subfolder = "Program Files/Windows Kits/10/Licenses"
# rtf_file = path.join(self.package_folder,subfolder,self.json_data["sdk-folder"],"sdk_license.rtf")
# txt_file = Path(rtf_file).with_suffix('.txt')
# self.run(f'pandoc \"{rtf_file}\" -t plain -o \"{txt_file}\"')
# with open(txt_file) as file:
# license_text = file.read()

# with open(path.join(self.package_folder, "share/winsdk/winsdk-version-info.cmake" ),'w') as file:
# cmake_info = f'set(WinSDK_VERSION \"{self.json_data["sdk-folder"]}\")'
# file.write(cmake_info)
5 changes: 4 additions & 1 deletion ports/msvc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "msvc",
"version": "17.11.5",
"license": "MIT"
"license": "MIT",
"dependencies": [
"vcpkg-tool-lessmsi"
]
}
4 changes: 2 additions & 2 deletions ports/vcpkg-tool-lessmsi/vcpkg-port-config.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
include_guard(GLOBAL)
set(version v1.10.0)
set(version v2.2.0)
find_program(LESSMSI PATHS "${DOWNLOADS}/lessmsi-${version}")
if(NOT LESSMSI)
vcpkg_download_distfile(archive_path
URLS "https://github.com/activescott/lessmsi/releases/download/${version}/lessmsi-${version}.zip"
FILENAME "lessmsi-${version}.zip"
SHA512 91be9363d75e8ca0129304008ddc26fe575cc4fd76d7f43ef0a6ff414855dc1c6e412f4e694b2950026e02cc3d31b18bd8c2e4c03e1ddce01477f3f2d2197479
SHA512 1b66099220175019d7fefe2c4b3f40a92b5bbf077e2100371cf3b9ca98c6ef3bdacb994159a55bcc7759b8890a8cfaeb84f7347ec4f7f23410f185ce5a4124e4
)
file(MAKE_DIRECTORY "${DOWNLOADS}/lessmsi-${version}")
file(ARCHIVE_EXTRACT
Expand Down
3 changes: 1 addition & 2 deletions ports/vcpkg-tool-lessmsi/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "vcpkg-tool-lessmsi",
"version": "1.10.0",
"port-version": 1,
"version": "2.2.0",
"description": "This is a utility with a graphical user interface and a command line interface that can be used to view and extract the contents of an MSI file.",
"homepage": "https://github.com/activescott/lessmsi",
"license": "MIT",
Expand Down

0 comments on commit 5e74626

Please sign in to comment.