8000 Fix for libmagic in latest release · Issue #169 · docwire/docwire · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix for libmagic in latest release #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pipi-mackay opened this issue Feb 3, 2025 · 1 comment
Open

Fix for libmagic in latest release #169

pipi-mackay opened this issue Feb 3, 2025 · 1 comment

Comments

@pipi-mackay
Copy link

Hi

We did find a problem building with libmagic,, where the checksum of the file-ffile-FILES46 as hard coded into the cmake files was incorrect. The fixed file with the correct checksum is shown below:

The old checksum was : SHA512 9165bb5bdbe7b8fccac0c8675d4eb251a286ab2ab7a79e6f8ed98d36fa0928b889cf109c1da3a5cfff64d1b1006b5d73934c2d420484adae6f4c8e26a9ede18f

The currently correct one
SHA512 FB8157EE8065FEAF57412CCDEEE57CD8FC853B54AC49B0DDC818EEB1CA3555A7CFD25DEA08996503F7C565DCBA8C57FD7E4DC5FE3452872C617F5612A94A8F0E

libmagic/ portfile.cmake

if(VCPKG_TARGET_IS_WINDOWS)
set(PATCHES
"0001-Use-libtre.patch"
"0002-Change-zlib-lib-name-to-match-CMake-output.patch"
"0003-Fix-WIN32-macro-checks.patch"
"0004-Typedef-POSIX-types-on-Windows.patch"
"0005-Include-dirent.h-for-S_ISREG-and-S_ISDIR.patch"
"0006-Remove-Wrap-POSIX-headers.patch"
"0007-Substitute-unistd-macros-for-MSVC.patch"
"0008-Add-FILENO-defines.patch"
"0010-Properly-check-for-the-presence-of-bitmasks.patch"
"0011-Remove-pipe-related-functions-in-funcs.c.patch"
"0012-Convert-MSYS2-paths-to-Windows-paths.patch"
"0013-Check-for-backslash-in-argv-0-on-Windows.patch"
"0015-MSYS2-Remove-ioctl-call.patch"
"0016-Fix-file_famagic-function.patch"
"0017-Change-bzlib-name-to-match-CMake-output.patch"
)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO file/file
REF FILE5_46
SHA512 FB8157EE8065FEAF57412CCDEEE57CD8FC853B54AC49B0DDC818EEB1CA3555A7CFD25DEA08996503F7C565DCBA8C57FD7E4DC5FE3452872C617F5612A94A8F0E
HEAD_REF master
PATCHES ${PATCHES}
)

if(VCPKG_TARGET_IS_WINDOWS)
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS")
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS")
endif()

set(FEATURE_OPTIONS)

macro(enable_feature feature switch)
if("${feature}" IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS "--enable-${switch}")
set(has_${feature} 1)
else()
list(APPEND FEATURE_OPTIONS "--disable-${switch}")
set(has_${feature} 0)
endif()
endmacro()

enable_feature("bzip2" "bzlib")
enable_feature("zlib" "zlib")
enable_feature("lzma" "xzlib")
enable_feature("zstd" "zstdlib")

vcpkg_configure_make(
AUTOCONFIG
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
"--disable-lzlib"
"--disable-libseccomp"
)

if(VCPKG_CROSSCOMPILING)
vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/libmagic/bin")
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(EXTRA_ARGS "ADD_BIN_TO_PATH")
endif()

vcpkg_install_make(${EXTRA_ARGS})
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin")
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin")
vcpkg_fixup_pkgconfig()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

if(VCPKG_TARGET_IS_WINDOWS)
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/share/misc")
file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/misc/magic.mgc" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/share/misc")
endif()
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/share/misc")
file(COPY "${CURRENT_PACKAGES_DIR}/share/${PORT}/misc/magic.mgc" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/share/misc")
endif()
endif()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man5")

include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/unofficial-${PORT}-config.cmake.in"
"${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake"
INSTALL_DESTINATION "share/unofficial-${PORT}"
)

Handle copyright and usage

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

@as-ascii
Copy link
Contributor
as-ascii commented Feb 3, 2025

Related VCPKG bug report: microsoft/vcpkg#43565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0