2020-06-12 14:13:23 +08:00
if ( EXISTS "${CURRENT_INSTALLED_DIR}/share/libpcap" )
message ( FATAL_ERROR "FATAL ERROR: libpcap and winpcap are incompatible." )
endif ( )
2018-10-24 07:00:17 +08:00
set ( WINPCAP_VERSION 4_1_3 )
2017-08-25 13:43:08 +08:00
vcpkg_download_distfile ( ARCHIVE
2018-10-24 07:00:17 +08:00
U R L S " h t t p s : / / w w w . w i n p c a p . o r g / i n s t a l l / b i n / W p c a p S r c _ $ { W I N P C A P _ V E R S I O N } . z i p "
F I L E N A M E " W p c a p S r c _ $ { W I N P C A P _ V E R S I O N } . z i p "
2017-08-25 23:55:26 +08:00
S H A 5 1 2 8 9 a 5 1 0 9 e d 1 7 f 8 0 6 9 f 7 a 4 3 4 9 7 f 6 f e c 8 1 7 c 5 8 6 2 0 d b c 5 f a 5 0 6 e 5 2 0 6 9 b 9 1 1 3 c 5 b c 1 3 f 6 9 c 3 0 7 a f f e 6 1 1 2 8 1 c b 7 2 7 c f a 0 f 8 5 2 9 d 0 7 0 4 4 d 4 1 4 2 7 e 3 5 0 b 2 4 4 6 8 c c c 8 9 a 8 7 f 3 3
2017-08-25 13:43:08 +08:00
)
2018-03-09 03:12:22 +08:00
2017-08-28 00:03:32 +08:00
if ( VCPKG_CRT_LINKAGE STREQUAL "static" )
set ( CRT_LINKAGE "MT" )
elseif ( VCPKG_CRT_LINKAGE STREQUAL "dynamic" )
set ( CRT_LINKAGE "MD" )
endif ( )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" )
2018-10-24 07:00:17 +08:00
set ( LIBRARY_LINKAGE "4" )
2023-10-11 06:01:19 +08:00
set ( lib_type StaticLibrary )
2017-08-28 00:03:32 +08:00
elseif ( VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" )
2018-10-24 07:00:17 +08:00
set ( LIBRARY_LINKAGE "2" )
2023-10-11 06:01:19 +08:00
set ( lib_type DynamicLibrary )
2017-08-28 00:03:32 +08:00
endif ( )
2018-10-24 07:00:17 +08:00
configure_file ( "${CMAKE_CURRENT_LIST_DIR}/packetNtx.patch.in" "${CURRENT_BUILDTREES_DIR}/src/packetNtx.patch" @ONLY )
configure_file ( "${CMAKE_CURRENT_LIST_DIR}/wpcap.patch.in" "${CURRENT_BUILDTREES_DIR}/src/wpcap.patch" @ONLY )
2023-04-14 00:13:15 +08:00
vcpkg_extract_source_archive (
S O U R C E _ P A T H
2023-08-16 07:41:33 +08:00
A R C H I V E " $ { A R C H I V E } "
2023-04-14 00:13:15 +08:00
S O U R C E _ B A S E $ { W I N P C A P _ V E R S I O N }
2018-10-24 07:00:17 +08:00
P A T C H E S
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / s r c / p a c k e t N t x . p a t c h "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / s r c / w p c a p . p a t c h "
2023-10-11 06:01:19 +08:00
" b i s o n - f l e x . p a t c h "
2017-08-25 23:55:26 +08:00
)
2023-10-11 06:01:19 +08:00
file ( REMOVE_RECURSE "${SOURCE_PATH}/wpcap/libpcap/rpcapd/win32-pthreads" ) # avoid copying pthreadVC.lib; TODO: maybe should also use libpcap headers instead of this vendored stuff
vcpkg_replace_string ( "${SOURCE_PATH}/wpcap/PRJ/wpcap.vcproj" "DebugInformationFormat=\" 4\ "" "" )
vcpkg_replace_string ( "${SOURCE_PATH}/wpcap/PRJ/wpcap.vcproj" "DebugInformationFormat=\" 3\ "" "" )
2017-08-25 23:55:26 +08:00
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" )
set ( PLATFORM Win32 )
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" )
set ( PLATFORM x64 )
endif ( )
2023-10-11 06:01:19 +08:00
vcpkg_find_acquire_program ( BISON )
cmake_path ( GET BISON PARENT_PATH BISON_DIR )
vcpkg_add_to_path ( "${BISON_DIR}" )
vcpkg_find_acquire_program ( FLEX )
cmake_path ( GET FLEX PARENT_PATH FLEX_DIR )
vcpkg_add_to_path ( "${FLEX_DIR}" )
2017-08-25 23:55:26 +08:00
vcpkg_execute_required_process (
C O M M A N D " d e v e n v . e x e "
" P a c k e t . s l n "
/ U p g r a d e
2021-11-16 08:46:48 +08:00
W O R K I N G _ D I R E C T O R Y " $ { S O U R C E _ P A T H } / p a c k e t N t x / D l l / P r o j e c t "
2017-08-25 23:55:26 +08:00
L O G N A M E u p g r a d e - P a c k e t - $ { T A R G E T _ T R I P L E T }
)
2023-08-16 07:41:33 +08:00
vcpkg_msbuild_install (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
P R O J E C T _ S U B P A T H " p a c k e t N t x / D l l / P r o j e c t / P a c k e t . s l n "
2019-02-28 15:50:52 +08:00
R E L E A S E _ C O N F I G U R A T I O N " R e l e a s e "
D E B U G _ C O N F I G U R A T I O N " D e b u g "
2017-08-25 23:55:26 +08:00
P L A T F O R M $ { P L A T F O R M }
)
2023-10-11 06:01:19 +08:00
message ( STATUS "Building Scanner/Parser" )
2017-08-25 23:55:26 +08:00
vcpkg_execute_required_process (
2023-08-16 07:41:33 +08:00
C O M M A N D " $ { S O U R C E _ P A T H } / w p c a p / P R J / b u i l d _ s c a n n e r _ p a r s e r . b a t "
2023-10-11 06:01:19 +08:00
W O R K I N G _ D I R E C T O R Y " $ { S O U R C E _ P A T H } / w p c a p / P R J "
2017-08-25 23:55:26 +08:00
L O G N A M E b u i l d _ s c a n n e r _ p a r s e r - $ { T A R G E T _ T R I P L E T }
)
2023-10-11 06:01:19 +08:00
message ( STATUS "Building wpcap" )
2017-08-25 23:55:26 +08:00
vcpkg_execute_required_process (
C O M M A N D " d e v e n v . e x e "
" w p c a p . s l n "
/ U p g r a d e
2023-08-16 07:41:33 +08:00
W O R K I N G _ D I R E C T O R Y " $ { S O U R C E _ P A T H } / w p c a p / P R J "
2017-08-25 23:55:26 +08:00
L O G N A M E u p g r a d e - w p c a p - $ { T A R G E T _ T R I P L E T }
)
2023-10-11 06:01:19 +08:00
configure_file ( "${CURRENT_PORT_DIR}/wpcap.vcxproj.in" "${SOURCE_PATH}/wpcap/PRJ/wpcap.vcxproj" @ONLY )
2019-02-28 15:50:52 +08:00
2023-08-16 07:41:33 +08:00
vcpkg_msbuild_install (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
P R O J E C T _ S U B P A T H " w p c a p / P R J / w p c a p . s l n "
2017-08-25 23:55:26 +08:00
R E L E A S E _ C O N F I G U R A T I O N " R e l e a s e - N o A i r P c a p "
D E B U G _ C O N F I G U R A T I O N " D e b u g - N o A i r P c a p "
P L A T F O R M $ { P L A T F O R M }
)
vcpkg_execute_required_process (
2023-08-16 07:41:33 +08:00
C O M M A N D " $ { S O U R C E _ P A T H } / c r e a t e _ i n c l u d e . b a t "
W O R K I N G _ D I R E C T O R Y " $ { S O U R C E _ P A T H } "
2017-08-25 23:55:26 +08:00
L O G N A M E c r e a t e _ i n c l u d e - $ { T A R G E T _ T R I P L E T }
)
2020-07-31 13:45:15 +08:00
file ( INSTALL
2017-08-25 23:55:26 +08:00
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / b i t t y p e s . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / i p 6 _ m i s c . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / P a c k e t 3 2 . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p - b p f . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p - n a m e d b . h "
2017-09-22 22:57:54 +08:00
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p - s t d i n c . h "
2017-08-25 23:55:26 +08:00
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / r e m o t e - e x t . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / W i n 3 2 - E x t e n s i o n s . h "
2021-11-16 08:46:48 +08:00
D E S T I N A T I O N " $ { C U R R E N T _ P A C K A G E S _ D I R } / i n c l u d e " )
2017-08-25 13:43:08 +08:00
2020-07-31 13:45:15 +08:00
file ( INSTALL
2017-08-25 23:55:26 +08:00
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / b l u e t o o t h . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / b p f . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / n a m e d b . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / p c a p . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / s l l . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / u s b . h "
" $ { S O U R C E _ P A T H } / W p d P a c k / I n c l u d e / p c a p / v l a n . h "
2021-11-16 08:46:48 +08:00
D E S T I N A T I O N " $ { C U R R E N T _ P A C K A G E S _ D I R } / i n c l u d e / p c a p " )
2017-08-25 13:43:08 +08:00
2021-11-16 08:46:48 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/include/pcap-stdinc.h" "#define inline __inline" "#ifndef __cplusplus\n#define inline __inline\n#endif" )
2020-07-31 13:45:15 +08:00
2023-06-02 02:05:06 +08:00
file ( WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "The latest license is available in https://www.winpcap.org/misc/copyright.htm and in the header files." )