Skip to content

Commit

Permalink
[libmount,libsystemd] Updates, fixes (#37869)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Apr 1, 2024
1 parent 91e4c13 commit 41e2412
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 48 deletions.
15 changes: 15 additions & 0 deletions ports/libmount/hide-private-symbols.diff
Original file line number Diff line number Diff line change
@@ -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);

4 changes: 3 additions & 1 deletion ports/libmount/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ports/libmount/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
14 changes: 14 additions & 0 deletions ports/libsystemd/disable-warning-nonnull.patch
Original file line number Diff line number Diff line change
@@ -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. */
62 changes: 62 additions & 0 deletions ports/libsystemd/only-libsystemd.patch
Original file line number Diff line number Diff line change
@@ -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),
18 changes: 16 additions & 2 deletions ports/libsystemd/pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -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}
65 changes: 24 additions & 41 deletions ports/libsystemd/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
]])
3 changes: 2 additions & 1 deletion ports/libsystemd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4649,7 +4649,7 @@
"port-version": 0
},
"libmount": {
"baseline": "2.39",
"baseline": "2.40",
"port-version": 0
},
"libmpeg2": {
Expand Down Expand Up @@ -4998,7 +4998,7 @@
},
"libsystemd": {
"baseline": "255",
"port-version": 0
"port-version": 1
},
"libtar": {
"baseline": "1.2.20",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libmount.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e78ea57cae347c42d9b7cdc4d65c521f229e0ed4",
"version": "2.40",
"port-version": 0
},
{
"git-tree": "5fbc2733330a3bac410e90c460db96f54e39e0a5",
"version": "2.39",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libsystemd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a69dc63dcb8666fd4fb3885193dc67889fe65c72",
"version": "255",
"port-version": 1
},
{
"git-tree": "734f27b7651d9fcac8e1b30d9324075c65194094",
"version": "255",
Expand Down

0 comments on commit 41e2412

Please sign in to comment.