2022-11-01 07:05:59 +08:00
string ( REGEX MATCH "^([0-9]*[.][0-9]*)" GLIB_MAJOR_MINOR "${VERSION}" )
2022-10-14 02:20:24 +08:00
vcpkg_download_distfile ( GLIB_ARCHIVE
2022-11-01 07:05:59 +08:00
U R L S " h t t p s : / / d o w n l o a d . g n o m e . o r g / s o u r c e s / g l i b / $ { G L I B _ M A J O R _ M I N O R } / g l i b - $ { V E R S I O N } . t a r . x z "
F I L E N A M E " g l i b - $ { V E R S I O N } . t a r . x z "
2024-02-06 03:42:29 +08:00
S H A 5 1 2 6 f 3 a 0 6 e 1 0 e 7 3 7 3 a 2 d b f 0 6 8 8 5 1 2 d e 4 1 2 6 4 7 2 f b 7 3 c b e c 4 8 8 b 7 9 8 3 b 5 f f e c f f 0 9 c 6 4 d 7 e 1 c a 4 6 2 f 8 9 2 e 8 f 2 1 5 d 3 d 2 7 7 d 1 0 3 c a 8 0 2 b a d 7 e f 0 b d 0 f 9 1 e d f 2 6 f c 6 c e 6 7 1 8 7 b 6
2023-04-26 13:59:22 +08:00
)
2022-10-14 02:20:24 +08:00
2022-11-01 07:05:59 +08:00
vcpkg_extract_source_archive ( SOURCE_PATH
A R C H I V E " $ { G L I B _ A R C H I V E } "
2017-01-14 09:55:41 +08:00
P A T C H E S
2019-03-01 14:58:46 +08:00
u s e - l i b i c o n v - o n - w i n d o w s . p a t c h
2021-11-30 04:31:32 +08:00
l i b i n t l . p a t c h
2019-03-01 14:58:46 +08:00
)
2017-01-12 04:20:53 +08:00
2024-09-26 03:16:27 +08:00
set ( LANGUAGES C CXX )
2024-06-15 02:40:01 +08:00
if ( VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS )
2024-09-26 03:16:27 +08:00
list ( APPEND LANGUAGES OBJC OBJCXX )
2023-08-26 03:25:28 +08:00
endif ( )
2022-11-01 07:05:59 +08:00
vcpkg_list ( SET OPTIONS )
2021-04-27 01:28:21 +08:00
if ( selinux IN_LIST FEATURES )
2022-11-01 07:05:59 +08:00
if ( NOT EXISTS "/usr/include/selinux" )
message ( WARNING "SELinux was not found in its typical system location. Your build may fail. You can install SELinux with \" apt-get install selinux libselinux1-dev\ "." )
2021-04-27 01:28:21 +08:00
endif ( )
list ( APPEND OPTIONS -Dselinux=enabled )
else ( )
list ( APPEND OPTIONS -Dselinux=disabled )
2019-09-17 06:10:11 +08:00
endif ( )
2021-11-24 12:54:53 +08:00
if ( libmount IN_LIST FEATURES )
list ( APPEND OPTIONS -Dlibmount=enabled )
else ( )
list ( APPEND OPTIONS -Dlibmount=disabled )
endif ( )
2023-03-29 02:00:54 +08:00
vcpkg_list ( SET ADDITIONAL_BINARIES )
if ( VCPKG_HOST_IS_WINDOWS )
# Presence of bash and sh enables installation of auxiliary components.
vcpkg_list ( APPEND ADDITIONAL_BINARIES "bash = ['${CMAKE_COMMAND}', '-E', 'false']" )
vcpkg_list ( APPEND ADDITIONAL_BINARIES "sh = ['${CMAKE_COMMAND}', '-E', 'false']" )
endif ( )
2021-04-27 01:28:21 +08:00
vcpkg_configure_meson (
2022-05-07 02:20:25 +08:00
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
2024-09-26 03:16:27 +08:00
L A N G U A G E S $ { L A N G U A G E S }
2023-03-29 02:00:54 +08:00
A D D I T I O N A L _ B I N A R I E S
$ { A D D I T I O N A L _ B I N A R I E S }
2021-04-27 01:28:21 +08:00
O P T I O N S
$ { O P T I O N S }
2022-11-01 07:05:59 +08:00
- D g t k _ d o c = f a l s e
- D i n s t a l l e d _ t e s t s = f a l s e
- D l i b e l f = d i s a b l e d
- D m a n = f a l s e
2021-11-30 04:31:32 +08:00
- D t e s t s = f a l s e
- D x a t t r = f a l s e
2018-07-10 08:29:28 +08:00
)
2021-04-27 01:28:21 +08:00
vcpkg_install_meson ( ADD_BIN_TO_PATH )
2017-01-12 04:20:53 +08:00
vcpkg_copy_pdbs ( )
2022-11-01 07:05:59 +08:00
file ( MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}" )
set ( GLIB_SCRIPTS
g d b u s - c o d e g e n
g l i b - g e n m a r s h a l
g l i b - g e t t e x t i z e
g l i b - m k e n u m s
g t e s t e r - r e p o r t
)
2021-04-27 01:28:21 +08:00
foreach ( script IN LISTS GLIB_SCRIPTS )
file ( RENAME "${CURRENT_PACKAGES_DIR}/bin/${script}" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${script}" )
file ( REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${script}" )
endforeach ( )
2022-11-01 07:05:59 +08:00
set ( GLIB_TOOLS
g a p p l i c a t i o n
g d b u s
g i o
g i o - q u e r y m o d u l e s
g l i b - c o m p i l e - r e s o u r c e s
g l i b - c o m p i l e - s c h e m a s
g o b j e c t - q u e r y
g r e s o u r c e
g s e t t i n g s
g t e s t e r
)
if ( VCPKG_TARGET_IS_WINDOWS )
list ( REMOVE_ITEM GLIB_TOOLS gapplication gtester )
if ( VCPKG_TARGET_ARCHITECTURE MATCHES "x64|arm64" )
list ( APPEND GLIB_TOOLS gspawn-win64-helper gspawn-win64-helper-console )
elseif ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" )
list ( APPEND GLIB_TOOLS gspawn-win32-helper gspawn-win32-helper-console )
endif ( )
elseif ( VCPKG_TARGET_IS_OSX )
list ( REMOVE_ITEM GLIB_TOOLS gapplication )
2021-04-27 01:28:21 +08:00
endif ( )
2022-11-01 07:05:59 +08:00
vcpkg_copy_tools ( TOOL_NAMES ${ GLIB_TOOLS } AUTO_CLEAN )
2022-01-26 02:31:15 +08:00
2023-02-16 02:00:35 +08:00
vcpkg_fixup_pkgconfig ( )
if ( VCPKG_TARGET_IS_WINDOWS )
set ( LIBINTL_NAME "intl.lib" )
else ( )
set ( LIBINTL_NAME "libintl" )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL dynamic )
string ( APPEND LIBINTL_NAME "${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}" )
else ( )
string ( APPEND LIBINTL_NAME "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" )
endif ( )
endif ( )
2022-12-13 06:37:00 +08:00
set ( pc_replace_intl_path gio glib gmodule-no-export gobject gthread )
foreach ( pc_prefix IN LISTS pc_replace_intl_path )
2023-02-16 02:00:35 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${pc_prefix}-2.0.pc" "\" " " " )
2024-06-20 05:07:05 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${pc_prefix}-2.0.pc" "\${prefix}/debug/lib/${LIBINTL_NAME}" "-lintl" IGNORE_UNCHANGED )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${pc_prefix}-2.0.pc" "\${prefix}/lib/${LIBINTL_NAME}" "-lintl" IGNORE_UNCHANGED )
2022-12-13 06:37:00 +08:00
if ( NOT VCPKG_BUILD_TYPE )
2023-02-16 02:00:35 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${pc_prefix}-2.0.pc" "\" " " " )
2024-06-20 05:07:05 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${pc_prefix}-2.0.pc" "\${prefix}/lib/${LIBINTL_NAME}" "-lintl" IGNORE_UNCHANGED )
2022-12-13 06:37:00 +08:00
endif ( )
endforeach ( )
2022-11-01 07:05:59 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gio-2.0.pc" "\${bindir}" "\${prefix}/tools/${PORT}" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/glib-2.0.pc" "\${bindir}" "\${prefix}/tools/${PORT}" )
if ( NOT VCPKG_BUILD_TYPE )
2022-09-14 07:50:41 +08:00
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gio-2.0.pc" "\${bindir}" "\${prefix}/../tools/${PORT}" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/glib-2.0.pc" "\${bindir}" "\${prefix}/../tools/${PORT}" )
2021-04-27 01:28:21 +08:00
endif ( )
# Fix python scripts
set ( _file "${CURRENT_PACKAGES_DIR}/tools/${PORT}/gdbus-codegen" )
file ( READ "${_file}" _contents )
string ( REPLACE "elif os.path.basename(filedir) == 'bin':" "elif os.path.basename(filedir) == 'tools':" _contents "${_contents}" )
string ( REPLACE "path = os.path.join(filedir, '..', 'share', 'glib-2.0')" "path = os.path.join(filedir, '../..', 'share', 'glib-2.0')" _contents "${_contents}" )
string ( REPLACE "path = os.path.join(filedir, '..')" "path = os.path.join(filedir, '../../share/glib-2.0')" _contents "${_contents}" )
string ( REPLACE "path = os.path.join('${CURRENT_PACKAGES_DIR}/share', 'glib-2.0')" "path = os.path.join('unuseable/share', 'glib-2.0')" _contents "${_contents}" )
file ( WRITE "${_file}" "${_contents}" )
2021-11-10 03:49:00 +08:00
2022-11-01 07:05:59 +08:00
if ( EXISTS "${CURRENT_PACKAGES_DIR}/tools/${PORT}/glib-gettextize" )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/tools/${PORT}/glib-gettextize" "${CURRENT_PACKAGES_DIR}" "`dirname $0`/../.." )
2021-11-10 03:49:00 +08:00
endif ( )
2022-11-01 07:05:59 +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 / i n c l u d e "
" $ { 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 } / s h a r e / g d b "
2023-02-16 02:00:35 +08:00
" $ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b / g i o "
" $ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / g i o "
2022-11-01 07:05:59 +08:00
)
2023-02-16 02:00:35 +08:00
vcpkg_install_copyright ( FILE_LIST "${SOURCE_PATH}/LICENSES/LGPL-2.1-or-later.txt" )