diff --git a/ports/libb2/portfile.cmake b/ports/libb2/portfile.cmake index 452218f2804874..25f9d6a461b99d 100644 --- a/ports/libb2/portfile.cmake +++ b/ports/libb2/portfile.cmake @@ -6,6 +6,10 @@ vcpkg_from_github( HEAD_REF master ) +# The `libb2` true version is from `B2_LIBRARY_VERSION` defined in `configure.ac`, which `libtool` use `-version-info $(B2_LIBRARY_VERSION)` to set libb2's version(It generated [libb2.1.dylib, libb2.dylib]) +set(B2_LIBRARY_VERSION 1:4:0) +string(REGEX MATCH "^[0-9]*" B2_LIBRARY_VERSION_MAJOR "${B2_LIBRARY_VERSION}") + set(OPTIONS) if(CMAKE_HOST_WIN32) set(OPTIONS --disable-native) # requires cpuid @@ -18,9 +22,55 @@ vcpkg_configure_make( ax_cv_check_cflags___O3=no # see https://github.com/microsoft/vcpkg/pull/17912#issuecomment-840514179 ${OPTIONS} ) + vcpkg_install_make() -vcpkg_fixup_pkgconfig() +# Fix #31719: change rpath setting after install +if(VCPKG_TARGET_IS_OSX AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(INSTALL_NAME_DIR "@rpath") + + find_program( + INSTALL_NAME_TOOL + install_name_tool + DOC "Absolute path of install_name_tool" + REQUIRED + ) + + foreach(LIB_NAME IN ITEMS libb2) + # debug + vcpkg_execute_build_process( + COMMAND "${INSTALL_NAME_TOOL}" -id "${INSTALL_NAME_DIR}/${LIB_NAME}.${B2_LIBRARY_VERSION_MAJOR}.dylib" + "${LIB_NAME}.${B2_LIBRARY_VERSION_MAJOR}.dylib" + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib" + LOGNAME "make-install-fix-rpath-dbg" + ) + + vcpkg_execute_build_process( + COMMAND "${INSTALL_NAME_TOOL}" -add_rpath "@loader_path" + "${LIB_NAME}.${B2_LIBRARY_VERSION_MAJOR}.dylib" + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib" + LOGNAME "make-install-fix-rpath-dbg" + ) + + # release + vcpkg_execute_build_process( + COMMAND "${INSTALL_NAME_TOOL}" -id "${INSTALL_NAME_DIR}/${LIB_NAME}.${B2_LIBRARY_VERSION_MAJOR}.dylib" + "${LIB_NAME}.${B2_LIBRARY_VERSION_MAJOR}.dylib" + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib" + LOGNAME "make-install-fix-rpath-rel" + ) + + vcpkg_execute_build_process( + COMMAND "${INSTALL_NAME_TOOL}" -add_rpath "@loader_path" + "${LIB_NAME}.${B2_LIBRARY_VERSION_MAJOR}.dylib" + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib" + LOGNAME "make-install-fix-rpath-rel" + ) + endforeach() + +endif() + +vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/libb2/vcpkg.json b/ports/libb2/vcpkg.json index e8ef8ec0578ee2..b40e1853aa5c9d 100644 --- a/ports/libb2/vcpkg.json +++ b/ports/libb2/vcpkg.json @@ -1,7 +1,7 @@ { "name": "libb2", "version": "0.98.1", - "port-version": 6, + "port-version": 7, "description": "C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp", "homepage": "https://github.com/BLAKE2/libb2", "supports": "!windows" diff --git a/versions/baseline.json b/versions/baseline.json index d3d15af56a2ece..0b4bd171d9d7fa 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3854,7 +3854,7 @@ }, "libb2": { "baseline": "0.98.1", - "port-version": 6 + "port-version": 7 }, "libbacktrace": { "baseline": "2021-03-14", diff --git a/versions/l-/libb2.json b/versions/l-/libb2.json index b26edd252d9648..be76a70fdd1f7d 100644 --- a/versions/l-/libb2.json +++ b/versions/l-/libb2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "44f6dc3f78e49afde1d14b56295ebbadf8f0d01e", + "version": "0.98.1", + "port-version": 7 + }, { "git-tree": "7c113e12089453e4e2cf2bbf67ad1f0b80a133a8", "version": "0.98.1",