Skip to content
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

[serf] add new port #37829

Closed
wants to merge 0 commits into from
Closed

[serf] add new port #37829

wants to merge 0 commits into from

Conversation

rinrab
Copy link

@rinrab rinrab commented Mar 29, 2024

  • Changes comply with the maintainer guide.
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.
@rinrab rinrab changed the title [serf] add port Mar 29, 2024
@dg0yt
Copy link
Contributor

dg0yt commented Mar 29, 2024

Upstream has a cmake buildsystem. Is there a good reason to add a vendored msbuild?

@rinrab
Copy link
Author

rinrab commented Mar 30, 2024

The CMake build system is currently only available in the development version (trunk) and has not been officially released yet. In the stable version, SCons is the only available build system.

@MonicaLiu0311 MonicaLiu0311 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Apr 1, 2024
@MonicaLiu0311
Copy link
Contributor

The above are some modifications to deprecated functions and redundant code. In addition, there is another problem. I found that this port provides neither .pc file nor *config.cmake. Please provide at least one usage.

@MonicaLiu0311 MonicaLiu0311 marked this pull request as draft April 1, 2024 08:12
versions/s-/serf.json Outdated Show resolved Hide resolved
@rinrab
Copy link
Author

rinrab commented Apr 2, 2024

The above are some modifications to deprecated functions and redundant code. In addition, there is another problem. I found that this port provides neither .pc file nor *config.cmake. Please provide at least one usage.

I added package-config, usage, and fixed that modifications about deprecated functions and redundant code.

@rinrab rinrab marked this pull request as ready for review April 2, 2024 12:21
ports/serf/usage Outdated Show resolved Hide resolved
ports/serf/serf.pc.in Outdated Show resolved Hide resolved
@MonicaLiu0311 MonicaLiu0311 marked this pull request as draft April 3, 2024 03:23
@rinrab rinrab marked this pull request as ready for review April 3, 2024 15:17
@rinrab
Copy link
Author

rinrab commented Apr 4, 2024

I've implemented the corrections you pointed out and it's now ready for review. Additionally, I've made a minor adjustment to the target name: I've appended the major version name to it, changing it from 'serf' to 'serf-1'.

ports/serf/vcpkg.json Outdated Show resolved Hide resolved
@MonicaLiu0311
Copy link
Contributor

usage:

serf provides CMake targets:

    find_package(SERF REQUIRED)
    target_link_libraries(main PRIVATE SERF:serf)

When testing usage, the following error occurs:

>------ Build All started: Project: CMakeUsage, Configuration: x64-Debug ------
  MSBuild version 17.9.5+33de0b227 for .NET Framework
  
    1>Checking Build System
    Building Custom Rule C:/Users/monica/source/repos/CMakeUsage/CMakeUsage/CMakeLists.txt
    CMakeUsage.cpp
C:\Users\monica\source\repos\CMakeUsage\CMakeUsage\CMakeUsage.cpp(2,10): error C1083: Cannot open include file: 'serf.h': No such file or directory 

Build All failed.
CMakeLists.txt
cmake_minimum_required (VERSION 3.8)
set(CMAKE_TOOLCHAIN_FILE "G:/serf/scripts/buildsystems/vcpkg.cmake")

project ("CMakeUsage")

add_library (main "CMakeUsage.cpp" "CMakeUsage.h")

find_package(SERF REQUIRED)

target_link_libraries(main PRIVATE SERF:serf)

CMakeUsage.cpp
#include <iostream>
#include "serf.h"

using namespace std;

int main()
{
cout << "Hello CMake." << endl;
return 0;
}

@rinrab
Copy link
Author

rinrab commented Apr 7, 2024

usage:

serf provides CMake targets:

    find_package(SERF REQUIRED)
    target_link_libraries(main PRIVATE SERF:serf)

When testing usage, the following error occurs:

>------ Build All started: Project: CMakeUsage, Configuration: x64-Debug ------
  MSBuild version 17.9.5+33de0b227 for .NET Framework
  
    1>Checking Build System
    Building Custom Rule C:/Users/monica/source/repos/CMakeUsage/CMakeUsage/CMakeLists.txt
    CMakeUsage.cpp
C:\Users\monica\source\repos\CMakeUsage\CMakeUsage\CMakeUsage.cpp(2,10): error C1083: Cannot open include file: 'serf.h': No such file or directory 

Build All failed.

CMakeLists.txt

CMakeUsage.cpp

Thank you! I found and fixed this problem; I forgot to specify the INTERFACE_INCLUDE_DIRECTORIES property.

@MonicaLiu0311
Copy link
Contributor

The usage test passed on x64-windows (header files found):

serf provides CMake targets:

    find_package(SERF REQUIRED)
    target_link_libraries(main PRIVATE SERF:serf)
MonicaLiu0311
MonicaLiu0311 previously approved these changes Apr 9, 2024
@MonicaLiu0311 MonicaLiu0311 added the info:reviewed Pull Request changes follow basic guidelines label Apr 9, 2024
Copy link
Contributor

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do CMake config and target name match the future upstream name, or are they unofficial?
Does it work properly in single-config mode?
Doesn't it need find_dependency and INTERFACE_LINK_LIBRARIES for static linkage?

ports/serf/usage Outdated Show resolved Hide resolved
@MonicaLiu0311 MonicaLiu0311 removed the info:reviewed Pull Request changes follow basic guidelines label Apr 10, 2024
@MonicaLiu0311
Copy link
Contributor

Note: I will be converting your PR to draft status. When you're ready, please revert to "ready for review".

@MonicaLiu0311 MonicaLiu0311 marked this pull request as draft April 12, 2024 02:46
@rinrab
Copy link
Author

rinrab commented Apr 12, 2024

Thank you! Today I'm going to fix these problems.

Comment on lines 14 to 18
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
SET(INTERFACE_LINK_LIBRARIES "ZLIB::ZLIB;unofficial::apr::apr-1;unofficial::apr::aprapp-1;OpenSSL::SSL;OpenSSL::Crypto")
else()
SET(INTERFACE_LINK_LIBRARIES "ZLIB::ZLIB;unofficial::apr::libapr-1;unofficial::apr::libaprapp-1;OpenSSL::SSL;OpenSSL::Crypto")
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not entirely correct if users override linkage per port.
The correct way is to use target expressions as in

$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>

(TBH I would prefer the unofficial config of apr to provide uniform target names...)

@MonicaLiu0311
Copy link
Contributor

@rinrab Is there any new progress?

Please resolve the conflict. Finally, if you have finished editing, click “Ready for review”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR!
3 participants