2020-08-06 05:08:18 +08:00
if ( EXISTS "${CURRENT_INSTALLED_DIR}/include/gmp.h" OR "${CURRENT_INSTALLED_DIR}/include/gmpxx.h" )
message ( FATAL_ERROR "Can't build ${PORT} if mpir is installed. Please remove mpir, and try install ${PORT} again if you need it." )
endif ( )
2022-11-19 04:57:45 +08:00
vcpkg_minimum_required ( VERSION 2022-10-12 ) # for ${VERSION}
2022-03-24 03:14:40 +08:00
vcpkg_download_distfile (
A R C H I V E
2023-06-27 13:17:15 +08:00
U R L S
" h t t p s : / / f t p m i r r o r . g n u . o r g / g m p / g m p - $ { V E R S I O N } . t a r . x z "
" h t t p s : / / f t p . g n u . o r g / g n u / g m p / g m p - $ { V E R S I O N } . t a r . x z "
" h t t p s : / / g m p l i b . o r g / d o w n l o a d / g m p / g m p - $ { V E R S I O N } . t a r . x z "
2022-11-19 04:57:45 +08:00
F I L E N A M E " g m p - $ { V E R S I O N } . t a r . x z "
2022-03-24 03:14:40 +08:00
S H A 5 1 2 c 9 9 b e 0 9 5 0 a 1 d 0 5 a 0 2 9 7 d 6 5 6 4 1 d d 3 5 b 7 5 b 7 4 4 6 6 f 7 b f 0 3 c 9 e 8 a 9 9 8 9 5 a 3 b 2 f 9 a 0 8 5 6 c d 1 7 8 8 7 7 3 8 f a 5 1 c f 7 4 9 9 7 8 1 b 6 5 c 0 4 9 7 6 9 2 7 1 c b c b 7 7 d 0 5 7 d 2 e 9 f 1 e c 5 2 e 0 7 d d 8 4
)
2020-10-29 05:26:41 +08:00
2022-11-19 04:57:45 +08:00
vcpkg_extract_source_archive ( SOURCE_PATH
2022-03-24 03:14:40 +08:00
A R C H I V E " $ { A R C H I V E } "
2022-11-19 04:57:45 +08:00
S O U R C E _ B A S E " v $ { V E R S I O N } "
2022-03-24 03:14:40 +08:00
P A T C H E S
2022-11-19 04:57:45 +08:00
a s m f l a g s . p a t c h
c r o s s - t o o l s . p a t c h
s u b d i r s . p a t c h
m s v c _ s y m b o l . p a t c h
a r m 6 4 - c o f f . p a t c h
2023-06-27 13:17:15 +08:00
g m p - a r m 6 4 - a s m - f i x - 5 f 3 2 d b c 4 1 a f c . p a t c h # Avoid the x18 register since it is reserved on arm64 osx and windows. Source: https://gmplib.org/repo/gmp/raw-rev/5f32dbc41afc
2022-03-24 03:14:40 +08:00
)
2020-05-09 04:55:11 +08:00
2022-11-19 04:57:45 +08:00
vcpkg_list ( SET OPTIONS )
if ( "fat" IN_LIST FEATURES )
vcpkg_list ( APPEND OPTIONS "--enable-fat" )
endif ( )
2022-03-24 03:14:40 +08:00
if ( VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW )
2022-11-19 04:57:45 +08:00
vcpkg_list ( APPEND OPTIONS
" a c _ c v _ f u n c _ m e m s e t = y e s "
" g m p _ c v _ a s m _ w 3 2 = . w o r d "
2023-08-08 00:10:14 +08:00
" g m p _ c v _ c h e c k _ l i b m _ f o r _ b u i l d = n o "
2022-11-19 04:57:45 +08:00
)
endif ( )
set ( disable_assembly OFF )
set ( ccas "" )
set ( asmflags "-c" )
vcpkg_cmake_get_vars ( cmake_vars_file )
include ( "${cmake_vars_file}" )
if ( VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC" )
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" )
string ( APPEND asmflags " --target=i686-pc-windows-msvc" )
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" )
string ( APPEND asmflags " --target=x86_64-pc-windows-msvc" )
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" )
string ( APPEND asmflags " --target=arm64-pc-windows-msvc" )
else ( )
set ( disable_assembly ON )
2020-05-09 04:55:11 +08:00
endif ( )
2022-11-19 04:57:45 +08:00
if ( NOT disable_assembly )
vcpkg_find_acquire_program ( CLANG )
set ( ccas "${CLANG}" )
endif ( )
2023-02-24 04:46:13 +08:00
elseif ( VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" )
# not exporting asm functions
set ( disable_assembly ON )
2023-05-10 05:48:09 +08:00
elseif ( VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" )
set ( ccas "${VCPKG_DETECTED_CMAKE_C_COMPILER}" )
vcpkg_list ( APPEND OPTIONS "ABI=32" )
string ( APPEND asmflags " -m32" )
2023-02-11 04:02:13 +08:00
else ( )
2022-11-19 04:57:45 +08:00
set ( ccas "${VCPKG_DETECTED_CMAKE_C_COMPILER}" )
2022-03-24 03:14:40 +08:00
endif ( )
2020-05-09 04:55:11 +08:00
2022-11-19 04:57:45 +08:00
if ( disable_assembly )
vcpkg_list ( APPEND OPTIONS "--enable-assembly=no" )
elseif ( ccas )
cmake_path ( GET ccas PARENT_PATH ccas_dir )
vcpkg_add_to_path ( "${ccas_dir}" )
cmake_path ( GET ccas FILENAME ccas_command )
2022-03-24 03:14:40 +08:00
endif ( )
2023-02-24 04:46:13 +08:00
vcpkg_list ( APPEND OPTIONS "CCAS=${ccas_command}" "ASMFLAGS=${asmflags}" )
2020-10-29 05:26:41 +08:00
2022-11-19 04:57:45 +08:00
if ( VCPKG_CROSSCOMPILING )
set ( ENV{HOST_TOOLS_PREFIX} "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}" )
2022-08-17 00:33:28 +08:00
endif ( )
2022-03-24 03:14:40 +08:00
vcpkg_configure_make (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
A U T O C O N F I G
O P T I O N S
$ { O P T I O N S }
- - e n a b l e - c x x
2022-06-16 01:58:03 +08:00
- - w i t h - p i c
2022-11-19 04:57:45 +08:00
- - w i t h - r e a d l i n e = n o
" g m p _ c v _ p r o g _ e x e e x t _ f o r _ b u i l d = $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
2022-03-24 03:14:40 +08:00
)
vcpkg_install_make ( )
2022-11-19 04:57:45 +08:00
vcpkg_fixup_pkgconfig ( )
2020-05-09 04:55:11 +08:00
2022-03-24 03:14:40 +08:00
if ( NOT VCPKG_CROSSCOMPILING )
2022-11-19 04:57:45 +08:00
file ( INSTALL
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / g e n - b a s e s $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / g e n - f a c $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / g e n - f i b $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / g e n - j a c o b i t a b $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / g e n - p s q r $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } / $ { T A R G E T _ T R I P L E T } - r e l / g e n - t r i a l d i v t a b $ { V C P K G _ H O S T _ E X E C U T A B L E _ S U F F I X } "
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 } / m a n u a l - t o o l s / $ { P O R T } "
U S E _ S O U R C E _ P E R M I S S I O N S
)
vcpkg_copy_tool_dependencies ( "${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}" )
2021-04-30 07:13:35 +08:00
endif ( )
2022-03-24 03:14:40 +08:00
2022-11-19 04:57:45 +08:00
file ( REMOVE_RECURSE
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / s h a r e "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / i n c l u d e "
)
2022-03-24 03:14:40 +08:00
2022-08-19 01:39:56 +08:00
file ( INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" )
2022-11-19 04:57:45 +08:00
vcpkg_install_copyright (
F I L E _ L I S T
" $ { S O U R C E _ P A T H } / R E A D M E "
" $ { S O U R C E _ P A T H } / C O P Y I N G . L E S S E R v 3 "
" $ { S O U R C E _ P A T H } / C O P Y I N G v 3 "
" $ { S O U R C E _ P A T H } / C O P Y I N G v 2 "
)