-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libsystemd] add new port #31150
[libsystemd] add new port #31150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it wasn't easy to get so far. Please bear with me if my comments ask for more work. It is opinon, not an official request.
ports/libcap/portfile.cmake
Outdated
FETCH_REF "libcap-${VERSION}" | ||
REF 3c7dda330bd9a154bb5b878d31fd591e4951fe17 | ||
PATCHES | ||
configure.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might might be more useful to not patch but copy a small configure
script from port to source dir which generates a minimal Makefile.vcpkg
.
This makefile would have the per-config settings as needed (--prefix
) and add the missing rules and dependencies (install
; libcap.a
vs. libcap.so
etc).
In that way, you would also solve a problem with this PR: These ports will fail in release-only builds.
I assume you would ask for an example... In port openssl, there is a configure
wrapper, but it doesn't have to generate a Makefile. In https://github.com/microsoft/vcpkg/pull/30608/files, there is the example with generating a Makefile, but it is work in progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would require some work, I can maybe try to add it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions, what is the benefit with your proposed method? Would a if/else of VCPKG_BUILD_TYPE
in portfile not be enough to fix the release only builds (this also applies to libsystemd)?
btw, I made the patch because vcpkg has an existing bug with projects that do not come with any configuration files, which you seem to know of #14389 (comment) 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it from being a patch to an empty configure script. However I have not made it as a general configure script since it is empty and therefore would instead like to do the required things in CMake.
ports/libsystemd/portfile.cmake
Outdated
|
||
vcpkg_fixup_pkgconfig() | ||
|
||
configure_file("${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-systemd/unofficial-systemd-config.cmake" @ONLY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this CMake config should be removed. There is an official pc file, and the CMake config would need to rely on pkg-config for some dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my experience, the systemd pkgconfig file is not enough they do not declare requirements since they manually make the pkgconfig file instead of utilizing the meson generator.
https://github.com/systemd/systemd/blob/main/src/libsystemd/libsystemd.pc.in
ports/libcap/portfile.cmake
Outdated
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET cap_names.h | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
CC=gcc # use host architecture to generate cap_names.h | ||
) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.a | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) | ||
else() | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.so | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) | ||
endif() | ||
|
||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.pc | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use "Target" as a variable to optimize the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I fully understand, could you elaborate further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set(TARGETS ***)
if(**)
list(APPEND TARGETS ***)
endif()
...
vcpkg_build_make(SUBPATH libcap
BUILD_TARGET ${targets}
OPTIONS
prefix=${CURRENT_INSTALLED_DIR}
CC=gcc # use host architecture to generate cap_names.h
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Adela0814 BUILD_TARGET
does not support multi targets in my experience, and this would break cross compilation. So why?
ports/libcap/portfile.cmake
Outdated
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET cap_names.h | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
CC=gcc # use host architecture to generate cap_names.h | ||
) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.a | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) | ||
else() | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.so | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) | ||
endif() | ||
|
||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.pc | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set(TARGETS ***)
if(**)
list(APPEND TARGETS ***)
endif()
...
vcpkg_build_make(SUBPATH libcap
BUILD_TARGET ${targets}
OPTIONS
prefix=${CURRENT_INSTALLED_DIR}
CC=gcc # use host architecture to generate cap_names.h
)
Note: I will be converting your PR to draft status. When you respond, please revert to "ready for review". That way, I can be aware that you've responded since you can't modify the tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address review comments
ports/libcap/portfile.cmake
Outdated
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET cap_names.h | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
CC=gcc # use host architecture to generate cap_names.h | ||
) | ||
|
||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.a | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) | ||
else() | ||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.so | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) | ||
endif() | ||
|
||
vcpkg_build_make(SUBPATH libcap | ||
BUILD_TARGET libcap.pc | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Adela0814 BUILD_TARGET
does not support multi targets in my experience, and this would break cross compilation. So why?
ports/libcap/portfile.cmake
Outdated
FETCH_REF "libcap-${VERSION}" | ||
REF 3c7dda330bd9a154bb5b878d31fd591e4951fe17 | ||
PATCHES | ||
configure.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it from being a patch to an empty configure script. However I have not made it as a general configure script since it is empty and therefore would instead like to do the required things in CMake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The host stuff must be done in the host triplet.
(Example: infoware pci_data.hpp in #31388)
Multiple calls to vcpkg_*_make overwrite logfiles.
Are the pc files valid now?
ports/libcap/portfile.cmake
Outdated
BUILD_TARGET cap_names.h | ||
OPTIONS | ||
prefix=${CURRENT_INSTALLED_DIR} | ||
CC=gcc # use host architecture to generate cap_names.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this cannot be approved!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate further on this topic please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dg0yt Could you please explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Adela0814 or @dg0yt is there any progress with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know where to start with explanation again, and why the reviewers can't do it.
Host stuff must be done in the host triplet. The artifact become readily available for the cross build context by using host dependencies. This done in infoware, gmp, nettle, luajit, ..., What shouldn't be assumed to be readily available, even for a linux-only port, is gcc
.
The problem with libcap is that it needs a number of makefile variables properly passed in. It is not an easy port to start with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dg0yt Okay, I am still unsure what a host triplet is!. Reason for hard coding gcc
as compiler is because it is the default compiler for Linux, as you are already aware of I reckon.
As I would like this to finish, I see 3 options for next steps:
- Iterative development, this currently works, let's fix it when it becomes a problem.
- @Adela0814 helps with the review and me to make host triplet changes.
- @dg0yt would you be willing to help by contributing directly to this pull request? I can give you access privileges to my fork.
Which option do you guys prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Iterative development, this currently works, let's fix it when it becomes a problem.
Not acceptable IMO. It is known to not be implemented correctly. It may become a problem for another contributor who wants to update lzma, lz4, meson...
2. @Adela0814 helps with the review and me to make host triplet changes.
This is how I understand the roles.
3. @dg0yt would you be willing to help by contributing directly to this pull request? I can give you access privileges to my fork.
I already considered that option. I would be willing but I don't think I can spend time on it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be converting your PR to draft status. When this PR is ready for review, please reactivate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Adela0814 Added gcc/clang host compiler detection and logs for each build command are exported correctly.
@dg0yt Thank you for the review!
I am guessing you are referring to
Should I specify
If you are referring to the systemd pkgconfig files, than no. The pkgconfig files are straight from systemd as I don't wan't to change the implementation of systemd without going to upstream with it. As a result I made the cmake configuration file which is an addon, therefore, not changing the behavior in any way. |
ports/libcap/portfile.cmake
Outdated
elseif (CLANG_FOUND) | ||
set(C_HOST_COMPILER clang) | ||
else () | ||
message(FATAL_ERROR "Unable to find gcc or clang host compiler") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @dg0yt pointed out earlier, this needs to be in the host triplet. If you are cross compiling, you can use VCPKG_CROSSCOMPILING
, or compare the host and target triplets. See the protobuf
port for an example of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @dan-shaw for the example, and suggestion. I was now able to understand what needed to be changed. I have applied your suggestion.
58f9a8d
to
8715ed4
Compare
* Decouple cap_names.h from libcap.* make targets * Use vcpkg_cmake_get_vars instead of ENV{CC} etc. * Remove unnecessary self dependency of libcap * Update libcap to 1.2.69
@dan-shaw I have finished point 2 and 3 of your request for changes comment, cd334f8 |
@dg0yt I think all the outstanding changes have been addressed unless there was something I missed. We may need changes to other ports, but I think it is outside the scope of this PR. |
* add libsystemd, libcap, libxcrypt * baseline libsystemd, libcap, libxcrypt * versions tree libsystemd, libcap, libxcrypt * licenses for libsystemd, libcap, libxcrypt in vcpkg.json * update tree for libsystemd, libcap, libxcrypt * allow restricted header libxcrypt * tree allow restricted header libxcrypt * remove message Warning * use targets exist during configure, instead of configure_file variable to search for zstd * update git-tree * add quotes to full paths and remove messages in portfiles * update git-tree * remove extra spaces * update git-tree * remove extra line * update git tree * do configure hack differently and remove cross compile patch and override compiler during build_make * update git tree * try either gcc or clang for libcap and specify log file root for each build command * update git-tree * libcap use host dependency of self * libcap update git tree * libsystemd is LGPL2.1 * update libsystemd git-tree * change from find_package to find_dependency in unofficial cmake export of libsystemd * update libsystemd git-tree * update libxcrypt * update git tree libxcrypt * patch pkgconfig file of libsystemd * update libsystemd git-tree * update libsystemd to 254 * update git-tree libsystemd * * Copy of cap_names.h checked in for cross compilation * Decouple cap_names.h from libcap.* make targets * Use vcpkg_cmake_get_vars instead of ENV{CC} etc. * Remove unnecessary self dependency of libcap * Update libcap to 1.2.69 * Update git-tree * cleanup old versions from version jsons
find_package
calls are REQUIRED, are satisfied byvcpkg.json
's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxxvcpkg.json
matches what upstream says.vcpkg.json
matches what upstream says../vcpkg x-add-version --all
and committing the result.