2022-11-01 07:05:59 +08:00
vcpkg_minimum_required ( VERSION 2022-10-12 ) # for ${VERSION}
2022-10-14 02:20:24 +08:00
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 "
2022-12-27 16:53:38 +08:00
S H A 5 1 2 4 3 3 8 b f 3 e 4 2 c c b f 3 6 7 9 f 6 0 b 9 1 7 1 9 4 0 7 0 0 4 0 f f 9 4 b a 3 6 4 3 1 2 1 e 8 9 1 6 1 8 0 d 6 9 4 9 f 3 b 8 c c 3 0 8 b 6 a d 7 3 9 1 2 b e b c b 5 3 a 2 9 9 2 0 9 5 4 b c f b 2 2 1 6 b a c c a 0 5 0 3 4 7 3 a 8 9 7 f 1 f d 0 2 3 9 8 1
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
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 ( )
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 } "
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
)
if ( VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW )
list ( REMOVE_ITEM GLIB_SCRIPTS glib-gettextize )
2021-04-27 01:28:21 +08:00
endif ( )
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
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 )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${pc_prefix}-2.0.pc" "\${prefix}/debug/lib/intl" "-lintl" )
if ( NOT VCPKG_BUILD_TYPE )
vcpkg_replace_string ( "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${pc_prefix}-2.0.pc" "\${prefix}/lib/intl" "-lintl" )
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 ( )
2022-11-01 07:05:59 +08:00
vcpkg_fixup_pkgconfig ( )
2021-04-27 01:28:21 +08:00
# 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 "
)
2022-12-13 06:37:00 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/gio" "${CURRENT_PACKAGES_DIR}/lib/gio" )
2022-11-01 07:05:59 +08:00
file ( INSTALL "${SOURCE_PATH}/LICENSES/LGPL-2.1-or-later.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )