mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-16 03:29:06 +08:00
d369df7ecf
* [rollup:2021-07-06 1/8] PR #18272 (@strega-nil) [scripts-audit] vcpkg_from_* * [rollup:2021-07-06 2/8] PR #18319 (@strega-nil) [scripts-audit] add guidelines for cmake * [rollup 2021-07-06 3/8] PR #18410 (@mheyman) [vcpkg-cmake-config] documentation fix * [rollup:2021-07-06 4/8] PR #18488 (@strega-nil) [scripts-audit] vcpkg_execute_* * [rollup:2021-07-06 5/8] PR #18517 (@strega-nil) [scripts-audit] vcpkg_extract_source_archive * [rollup:2021-07-06 6/8] PR #18674 (@NancyLi1013) [vcpkg doc] Update examples * [rollup:2021-07-06 7/8] PR #18695 (@JackBoosY) [vcpkg] Update the minimum version of vcpkg * [rollup:2021-07-06 8/8] PR #18758 (@ras0219-msft) [vcpkg_from_git] Fix error if downloads folder does not exist * build docs! * fix bond:*-windows * fix nmap Co-authored-by: nicole mazzuca <mazzucan@outlook.com> Co-authored-by: Michael Heyman <Michael.Heyman@jhuapl.edu> Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com> Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com> Co-authored-by: Robert Schumacher <ras0219@outlook.com>
121 lines
4.3 KiB
CMake
121 lines
4.3 KiB
CMake
# nmap is a tools, so ignor POST_CHECK
|
|
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
|
|
|
vcpkg_download_distfile(ARCHIVE
|
|
URLS "https://nmap.org/dist/nmap-7.70.tar.bz2"
|
|
FILENAME "nmap-7.70.tar.bz2"
|
|
SHA512 084c148b022ff6550e269d976d0077f7932a10e2ef218236fe13aa3a70b4eb6506df03329868fc68cb3ce78e4360b200f5a7a491d3145028fed679ef1c9ecae5
|
|
)
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
vcpkg_extract_source_archive_ex(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
ARCHIVE ${ARCHIVE}
|
|
PATCHES
|
|
fix-snprintf.patch
|
|
fix-ssize_t.patch
|
|
fix-msvc-prj.patch
|
|
)
|
|
list(APPEND DEL_PROJS "libpcap" "libpcre" "libssh2" "libz")
|
|
foreach (DEL_PROJ ${DEL_PROJS})
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/${DEL_PROJ})
|
|
endforeach()
|
|
|
|
# Clear
|
|
vcpkg_execute_required_process(
|
|
COMMAND "devenv.exe"
|
|
"nmap.sln"
|
|
/Clean
|
|
WORKING_DIRECTORY ${SOURCE_PATH}/mswin32
|
|
)
|
|
|
|
# Uprade
|
|
message(STATUS "Upgrade solution...")
|
|
vcpkg_execute_required_process(
|
|
COMMAND "devenv.exe"
|
|
"nmap.sln"
|
|
/Upgrade
|
|
WORKING_DIRECTORY ${SOURCE_PATH}/mswin32
|
|
LOGNAME upgrade-Packet-${TARGET_TRIPLET}
|
|
)
|
|
# Build
|
|
vcpkg_build_msbuild(
|
|
PROJECT_PATH ${SOURCE_PATH}/mswin32/nmap.vcxproj
|
|
PLATFORM ${MSBUILD_PLATFORM}
|
|
USE_VCPKG_INTEGRATION
|
|
)
|
|
|
|
# Install
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL Release)
|
|
file(INSTALL ${SOURCE_PATH}/mswin32/Release/nmap.exe
|
|
${SOURCE_PATH}/mswin32/Release/nmap.pdb
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
|
endif()
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL Debug)
|
|
file(INSTALL ${SOURCE_PATH}/mswin32/Debug/nmap.exe
|
|
${SOURCE_PATH}/mswin32/Debug/nmap.pdb
|
|
DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
|
endif()
|
|
else()
|
|
set(ENV{LDFLAGS} "$ENV{LDFLAGS} -pthread")
|
|
set(OPTIONS --without-nmap-update --with-openssl=${CURRENT_INSTALLED_DIR} --with-libssh2=${CURRENT_INSTALLED_DIR} --with-libz=${CURRENT_INSTALLED_DIR} --with-libpcre=${CURRENT_INSTALLED_DIR})
|
|
message(STATUS "Building Options: ${OPTIONS}")
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL Release)
|
|
# Since nmap makefile has strong relationshop with codes, copy codes to obj path
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
|
|
vcpkg_extract_source_archive(source_path_release
|
|
ARCHIVE "${ARCHIVE}"
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
|
)
|
|
|
|
vcpkg_execute_required_process(
|
|
COMMAND "./configure" ${OPTIONS}
|
|
WORKING_DIRECTORY "${source_path_release}"
|
|
LOGNAME config-${TARGET_TRIPLET}-rel
|
|
)
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-rel")
|
|
vcpkg_execute_required_process(
|
|
COMMAND make
|
|
WORKING_DIRECTORY "${source_path_release}"
|
|
LOGNAME build-${TARGET_TRIPLET}-rel
|
|
)
|
|
|
|
message(STATUS "Installing ${TARGET_TRIPLET}-rel")
|
|
file(INSTALL ${source_path_release}/nmap DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL Debug)
|
|
# Since nmap makefile has strong relationshop with codes, copy codes to obj path
|
|
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
|
|
vcpkg_extract_source_archive(source_path_debug
|
|
ARCHIVE "${ARCHIVE}"
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
|
)
|
|
|
|
vcpkg_execute_required_process(
|
|
COMMAND "./configure" ${OPTIONS}
|
|
WORKING_DIRECTORY ${source_path_debug}
|
|
LOGNAME config-${TARGET_TRIPLET}-dbg
|
|
)
|
|
|
|
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
|
|
vcpkg_execute_required_process(
|
|
COMMAND make
|
|
WORKING_DIRECTORY ${source_path_debug}
|
|
LOGNAME build-${TARGET_TRIPLET}-dbg
|
|
)
|
|
|
|
message(STATUS "Installing ${TARGET_TRIPLET}-dbg")
|
|
file(INSTALL ${source_path_release}/nmap DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools)
|
|
endif()
|
|
|
|
set(SOURCE_PATH "${source_path_release}")
|
|
endif()
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
# Handle copyright
|
|
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|