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 "
S H A 5 1 2 2 1 1 7 6 c b 9 5 f c a b 4 9 a 7 8 1 d 0 2 7 8 9 b f 2 1 1 9 1 a 9 6 a 3 4 a 6 3 9 1 f 0 6 6 6 9 9 b 3 c 2 0 b 4 1 4 b 3 1 6 9 c 9 5 8 b d 8 6 6 2 3 d e b 3 4 c a 5 5 9 1 2 0 8 3 8 6 2 8 8 5 f 7 a 7 d 1 2 b 6 7 c c 0 4 1 4 6 7 d a 2 b a 9 4 d 9 e 8 3 c 3
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
if ( VCPKG_TARGET_IS_WINDOWS )
list ( APPEND OPTIONS -Diconv=external )
endif ( )
2019-09-17 06:10:11 +08:00
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-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 "
)
file ( INSTALL "${SOURCE_PATH}/LICENSES/LGPL-2.1-or-later.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )