From 41e2412494b99064a7690be505197868fe505598 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 2 Apr 2024 00:04:12 +0200 Subject: [PATCH] [libmount,libsystemd] Updates, fixes (#37869) --- ports/libmount/hide-private-symbols.diff | 15 +++++ ports/libmount/portfile.cmake | 4 +- ports/libmount/vcpkg.json | 2 +- .../libsystemd/disable-warning-nonnull.patch | 14 ++++ ports/libsystemd/only-libsystemd.patch | 62 ++++++++++++++++++ ports/libsystemd/pkgconfig.patch | 18 ++++- ports/libsystemd/portfile.cmake | 65 +++++++------------ ports/libsystemd/vcpkg.json | 3 +- versions/baseline.json | 4 +- versions/l-/libmount.json | 5 ++ versions/l-/libsystemd.json | 5 ++ 11 files changed, 149 insertions(+), 48 deletions(-) create mode 100644 ports/libmount/hide-private-symbols.diff create mode 100644 ports/libsystemd/disable-warning-nonnull.patch create mode 100644 ports/libsystemd/only-libsystemd.patch diff --git a/ports/libmount/hide-private-symbols.diff b/ports/libmount/hide-private-symbols.diff new file mode 100644 index 00000000000000..6527be02b4e188 --- /dev/null +++ b/ports/libmount/hide-private-symbols.diff @@ -0,0 +1,15 @@ +diff --git a/include/strutils.h b/include/strutils.h +index e9f8a0c..2f6d285 100644 +--- a/include/strutils.h ++++ b/include/strutils.h +@@ -16,6 +16,10 @@ + + #include "c.h" + ++// private, and clashing with libsystemd. ++#define parse_size ul__parse_size ++#define parse_range ul__parse_range ++ + /* initialize a custom exit code for all *_or_err functions */ + extern void strutils_set_exitcode(int exit_code); + diff --git a/ports/libmount/portfile.cmake b/ports/libmount/portfile.cmake index 3bba418e28eed6..6c607d2d23f81b 100644 --- a/ports/libmount/portfile.cmake +++ b/ports/libmount/portfile.cmake @@ -1,13 +1,15 @@ vcpkg_download_distfile(ARCHIVE URLS "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${VERSION}/util-linux-${VERSION}.tar.xz" FILENAME "util-linux-${VERSION}.tar.xz" - SHA512 3d59a0f114c06be19ef7f86fca37ba5b9073823d011b3fc37997ddb00124b4505ea32903b78798a64dffbccf0ba645a692678ee845cc65a5b321824448a82a94 + SHA512 f06e61d4ee0e196223f7341ec75a16a6671f82d6e353823490ecff17e947bb169a6b65177e3ab0da6e733e079b24d6a77905a0e8bbfed82ca9aa22a3facb6180 ) vcpkg_extract_source_archive( SOURCE_PATH ARCHIVE "${ARCHIVE}" SOURCE_BASE ${VERSION} + PATCHES + hide-private-symbols.diff ) set(ENV{GTKDOCIZE} true) diff --git a/ports/libmount/vcpkg.json b/ports/libmount/vcpkg.json index 55da323da6d298..de5c885e1affd3 100644 --- a/ports/libmount/vcpkg.json +++ b/ports/libmount/vcpkg.json @@ -1,6 +1,6 @@ { "name": "libmount", - "version": "2.39", + "version": "2.40", "description": "Block device identification library from util-linux", "homepage": "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/about/", "license": null, diff --git a/ports/libsystemd/disable-warning-nonnull.patch b/ports/libsystemd/disable-warning-nonnull.patch new file mode 100644 index 00000000000000..1ce5b68fffe31c --- /dev/null +++ b/ports/libsystemd/disable-warning-nonnull.patch @@ -0,0 +1,14 @@ +diff --git a/src/basic/memory-util.h b/src/basic/memory-util.h +index 1179513..fc39e06 100644 +--- a/src/basic/memory-util.h ++++ b/src/basic/memory-util.h +@@ -41,7 +41,9 @@ static inline int memcmp_safe(const void *s1, const void *s2, size_t n) { + return 0; + assert(s1); + assert(s2); ++DISABLE_WARNING_NONNULL + return memcmp(s1, s2, n); ++REENABLE_WARNING + } + + /* Compare s1 (length n1) with s2 (length n2) in lexicographic order. */ diff --git a/ports/libsystemd/only-libsystemd.patch b/ports/libsystemd/only-libsystemd.patch new file mode 100644 index 00000000000000..bcb98ed9f0d617 --- /dev/null +++ b/ports/libsystemd/only-libsystemd.patch @@ -0,0 +1,62 @@ +diff --git a/meson.build b/meson.build +index 7419e2b..687450e 100644 +--- a/meson.build ++++ b/meson.build +@@ -1909,12 +1909,11 @@ libsystemd_includes = [basic_includes, include_directories( + includes = [libsystemd_includes, include_directories('src/shared')] + + subdir('po') +-subdir('catalog') ++support_url='' + subdir('src/fundamental') + subdir('src/basic') + subdir('src/libsystemd') +-subdir('src/shared') +-subdir('src/libudev') ++subdir('src/systemd') # headers + + libsystemd = shared_library( + 'systemd', +@@ -1930,7 +1929,8 @@ libsystemd = shared_library( + threads, + userspace], + link_depends : libsystemd_sym, +- install : true, ++ build_by_default : static_libsystemd == 'false', ++ install : static_libsystemd == 'false', + install_tag: 'libsystemd', + install_dir : libdir) + +@@ -1963,6 +1963,8 @@ install_libsystemd_static = static_library( + userspace], + c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) + ++if false ++ + libudev = shared_library( + 'udev', + version : libudev_version, +@@ -1974,7 +1976,8 @@ libudev = shared_library( + dependencies : [threads, + userspace], + link_depends : libudev_sym, +- install : true, ++ build_by_default : static_libudev == 'false', ++ install : static_libudev == 'false', + install_tag: 'libudev', + install_dir : libdir) + +@@ -2661,6 +2664,13 @@ if not meson.is_cross_build() + command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs]) + endif + ++endif # false ++static_libudev='unused' ++bashcompletiondir='no' ++zshcompletiondir='no' ++want_html=false ++want_man=false ++ + ############################################################ + + alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch), diff --git a/ports/libsystemd/pkgconfig.patch b/ports/libsystemd/pkgconfig.patch index 1c6f5dee355924..8a7b82ca2cd69f 100644 --- a/ports/libsystemd/pkgconfig.patch +++ b/ports/libsystemd/pkgconfig.patch @@ -1,11 +1,25 @@ +diff --git a/meson.build b/meson.build +index 687450e..ee4460b 100644 +--- a/meson.build ++++ b/meson.build +@@ -1011,6 +1011,9 @@ threads = dependency('threads') + librt = cc.find_library('rt') + libm = cc.find_library('m') + libdl = cc.find_library('dl') ++conf.set_quoted('PC_RT', librt.found() ? '-lrt' : '') ++conf.set_quoted('PC_M', libm.found() ? '-lm' : '') ++conf.set_quoted('PC_DL', libdl.found() ? '-ldl' : '') + libcrypt = dependency('libcrypt', 'libxcrypt', required : false) + if not libcrypt.found() + # fallback to use find_library() if libcrypt is provided by glibc, e.g. for LibreELEC. diff --git a/src/libsystemd/libsystemd.pc.in b/src/libsystemd/libsystemd.pc.in -index da6e4e667e..3786238ccb 100644 +index 3a43ef6..930f16a 100644 --- a/src/libsystemd/libsystemd.pc.in +++ b/src/libsystemd/libsystemd.pc.in @@ -17,4 +17,6 @@ Description: systemd Library URL: {{PROJECT_URL}} Version: {{PROJECT_VERSION}} Libs: -L${libdir} -lsystemd -+Libs.private: -lrt ++Libs.private: {{PC_DL}} {{PC_M}} {{PC_RT}} +Requires.private: libcap libcrypt liblz4 liblzma libzstd mount Cflags: -I${includedir} diff --git a/ports/libsystemd/portfile.cmake b/ports/libsystemd/portfile.cmake index ac72ae6e51631e..d4bcb53e9864bc 100644 --- a/ports/libsystemd/portfile.cmake +++ b/ports/libsystemd/portfile.cmake @@ -4,57 +4,40 @@ vcpkg_from_github( REF "v${VERSION}" SHA512 51728de604c2169d8643718ac72acb8f70f613cfcca9e9abb7dac519f291fa26a16d48f24cae6897356319096cfe8f4d9377743e7870127374f98d432e0c557c PATCHES + disable-warning-nonnull.patch + only-libsystemd.patch pkgconfig.patch ) -vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/gperf") +set(static false) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(static pic) +endif() vcpkg_configure_meson( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - -Dstatic-libsystemd=true - -Daudit=false - -Dgcrypt=false - OPTIONS_DEBUG - -Drootprefix=${CURRENT_PACKAGES_DIR}/debug - -Dpkgconfiglibdir={CURRENT_PACKAGES_DIR}/debug - OPTIONS_RELEASE - -Drootprefix=${CURRENT_PACKAGES_DIR} - -Dpkgconfiglibdir={CURRENT_PACKAGES_DIR} + -Dmode=release + -Dstatic-libsystemd=${static} + -Dtests=false + # dependencies + -Ddns-over-tls=false + -Dlz4=enabled + -Dtranslations=false + -Dxz=enabled + -Dzstd=enabled + ADDITIONAL_BINARIES + "gperf = ['${CURRENT_HOST_INSTALLED_DIR}/tools/gperf/gperf${HOST_EXECUTABLE_SUFFIX}']" ) -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - vcpkg_build_ninja( - TARGETS libsystemd.a devel - ) -else() - vcpkg_build_ninja( - TARGETS libsystemd devel - ) -endif() - -file(INSTALL "${SOURCE_PATH}/src/systemd" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN "*.h") -set(BUILD_DIR_RELEASE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel") -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(INSTALL "${BUILD_DIR_RELEASE}/libsystemd.a" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") -else() - file(INSTALL "${BUILD_DIR_RELEASE}/libsystemd.so" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" FOLLOW_SYMLINK_CHAIN) -endif() +vcpkg_install_meson() -if(NOT VCPKG_BUILD_TYPE) - set(BUILD_DIR_DEBUG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg") - if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(INSTALL "${BUILD_DIR_DEBUG}/libsystemd.a" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") - else() - file(INSTALL "${BUILD_DIR_DEBUG}/libsystemd.so" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" FOLLOW_SYMLINK_CHAIN) - endif() -endif() - -file(INSTALL "${BUILD_DIR_RELEASE}/src/libsystemd/libsystemd.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") -if(NOT VCPKG_BUILD_TYPE) - file(INSTALL "${BUILD_DIR_DEBUG}/src/libsystemd/libsystemd.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") -endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") vcpkg_fixup_pkgconfig() -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.LGPL2.1") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSES/README.md" "${SOURCE_PATH}/LICENSE.LGPL2.1" + COMMENT [[ +This port provides libsystemd.so/.a, which is based on sources in +src/basic, src/fundamental, src/systemd and src/libsystemd. +]]) diff --git a/ports/libsystemd/vcpkg.json b/ports/libsystemd/vcpkg.json index 16e29db78c2152..23a2cb9dbfd89b 100644 --- a/ports/libsystemd/vcpkg.json +++ b/ports/libsystemd/vcpkg.json @@ -1,9 +1,10 @@ { "name": "libsystemd", "version": "255", + "port-version": 1, "description": "Libsystemd", "homepage": "https://github.com/systemd/systemd", - "license": "LGPL-2.1+", + "license": null, "supports": "linux", "dependencies": [ { diff --git a/versions/baseline.json b/versions/baseline.json index 5003eae79f3d7e..30ded1f03e5317 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4649,7 +4649,7 @@ "port-version": 0 }, "libmount": { - "baseline": "2.39", + "baseline": "2.40", "port-version": 0 }, "libmpeg2": { @@ -4998,7 +4998,7 @@ }, "libsystemd": { "baseline": "255", - "port-version": 0 + "port-version": 1 }, "libtar": { "baseline": "1.2.20", diff --git a/versions/l-/libmount.json b/versions/l-/libmount.json index a75dfb568b594b..3466d681a89af4 100644 --- a/versions/l-/libmount.json +++ b/versions/l-/libmount.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e78ea57cae347c42d9b7cdc4d65c521f229e0ed4", + "version": "2.40", + "port-version": 0 + }, { "git-tree": "5fbc2733330a3bac410e90c460db96f54e39e0a5", "version": "2.39", diff --git a/versions/l-/libsystemd.json b/versions/l-/libsystemd.json index e18c93b1016d92..660ac78e01b328 100644 --- a/versions/l-/libsystemd.json +++ b/versions/l-/libsystemd.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a69dc63dcb8666fd4fb3885193dc67889fe65c72", + "version": "255", + "port-version": 1 + }, { "git-tree": "734f27b7651d9fcac8e1b30d9324075c65194094", "version": "255",