From 13d7255093675e87bac24baf1084cd028a74b0f8 Mon Sep 17 00:00:00 2001 From: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:07:05 -0700 Subject: [PATCH] [pbc] Add usage (#27049) * [pbc] Add usage * x-add-version * fix * x-add-version * update config file * update version --- ports/pbc/portfile.cmake | 19 +++++++++---------- ports/pbc/unofficial-pbc-config.cmake | 25 +++++++++++++++++++++++++ ports/pbc/vcpkg.json | 1 + versions/p-/pbc.json | 2 +- 4 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 ports/pbc/unofficial-pbc-config.cmake diff --git a/ports/pbc/portfile.cmake b/ports/pbc/portfile.cmake index 6a2d35fe43..1fd27f8a4a 100644 --- a/ports/pbc/portfile.cmake +++ b/ports/pbc/portfile.cmake @@ -1,17 +1,15 @@ -set(PBC_VERSION 0.5.14) - if(NOT VCPKG_TARGET_IS_WINDOWS) vcpkg_download_distfile( ARCHIVE - URLS "https://crypto.stanford.edu/pbc/files/pbc-${PBC_VERSION}.tar.gz" - FILENAME pbc-${PBC_VERSION}.tar.gz + URLS "https://crypto.stanford.edu/pbc/files/pbc-${VERSION}.tar.gz" + FILENAME pbc-${VERSION}.tar.gz SHA512 d75d4ceb3f67ee62c7ca41e2a91ee914fbffaeb70256675aed6734d586950ea8e64e2f16dc069d71481eddb703624df8d46497005fb58e75cf098dd7e7961333 ) vcpkg_extract_source_archive( SOURCE_PATH ARCHIVE ${ARCHIVE} - SOURCE_BASE ${PBC_VERSION} + SOURCE_BASE "${VERSION}" PATCHES linux.patch ) @@ -27,7 +25,7 @@ if(NOT VCPKG_TARGET_IS_WINDOWS) set(OPTIONS ${SHARED_STATIC} LEX=${FLEX} YACC=${BISON}\ -y) vcpkg_configure_make( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH "${SOURCE_PATH}" AUTOCONFIG COPY_SOURCE OPTIONS @@ -36,8 +34,8 @@ if(NOT VCPKG_TARGET_IS_WINDOWS) vcpkg_install_make() - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/share/info) - file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/share/info") + vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") else() vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( @@ -105,9 +103,10 @@ else() OPTIONS_DEBUG "/p:RuntimeLibrary=MultiThreadedDebug${RuntimeLibraryExt}" OPTIONS_RELEASE "/p:RuntimeLibrary=MultiThreaded${RuntimeLibraryExt}" OPTIONS /p:SolutionDir=../ - ALLOW_ROOT_INCLUDES ON + ALLOW_ROOT_INCLUDES ) # clean up mpir stuff - file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/mpir.lib ${CURRENT_PACKAGES_DIR}/debug/lib/mpir.lib) + file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/mpir.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/mpir.lib") + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-pbc-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}") endif() diff --git a/ports/pbc/unofficial-pbc-config.cmake b/ports/pbc/unofficial-pbc-config.cmake new file mode 100644 index 0000000000..5e71df0c02 --- /dev/null +++ b/ports/pbc/unofficial-pbc-config.cmake @@ -0,0 +1,25 @@ +if(NOT TARGET unofficial::pbc::pbc) + get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + + add_library(unofficial::pbc::pbc UNKNOWN IMPORTED) + + set_target_properties(unofficial::pbc::pbc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" + ) + + find_library(PBC_LIBRARY_DEBUG NAMES pbclib libpbc PATHS "${_IMPORT_PREFIX}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH) + if(EXISTS "${PBC_LIBRARY_DEBUG}") + set_property(TARGET unofficial::pbc::pbc APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug") + set_target_properties(unofficial::pbc::pbc PROPERTIES IMPORTED_LOCATION_DEBUG "${PBC_LIBRARY_DEBUG}") + endif() + + find_library(PBC_LIBRARY_RELEASE NAMES pbclib libpbc PATHS "${_IMPORT_PREFIX}/" PATH_SUFFIXES lib NO_DEFAULT_PATH) + if(EXISTS "${PBC_LIBRARY_RELEASE}") + set_property(TARGET unofficial::pbc::pbc APPEND PROPERTY IMPORTED_CONFIGURATIONS "Release") + set_target_properties(unofficial::pbc::pbc PROPERTIES IMPORTED_LOCATION_RELEASE "${PBC_LIBRARY_RELEASE}") + endif() + + unset(_IMPORT_PREFIX) +endif() diff --git a/ports/pbc/vcpkg.json b/ports/pbc/vcpkg.json index 55136eac45..5a440a2089 100644 --- a/ports/pbc/vcpkg.json +++ b/ports/pbc/vcpkg.json @@ -4,6 +4,7 @@ "port-version": 7, "description": "Pairing-Based Crypto library provides low-level routines for pairing-based cryptosystems.", "homepage": "https://crypto.stanford.edu/pbc", + "license": "LGPL-3.0", "supports": "!uwp & !arm", "dependencies": [ { diff --git a/versions/p-/pbc.json b/versions/p-/pbc.json index 60bc59d6f5..5da6ca4359 100644 --- a/versions/p-/pbc.json +++ b/versions/p-/pbc.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "8622a50777b672d1eb2066d3110c8cb503da84ba", + "git-tree": "23f4f1804aaa515560fdd3efa19485c9714d2a20", "version": "0.5.14", "port-version": 7 },