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

Improve package test, add check pkgconfig #5945

Open
star-hengxing opened this issue Dec 7, 2024 · 13 comments
Open

Improve package test, add check pkgconfig #5945

star-hengxing opened this issue Dec 7, 2024 · 13 comments

Comments

@star-hengxing
Copy link
Contributor

star-hengxing commented Dec 7, 2024

Is your feature request related to a problem? Please describe.

N/A

Describe the solution you'd like

  • Test package .pc
  • Use ldd to check unbundle deps.

Describe alternatives you've considered

No response

Additional context

No response

@waruqi
Copy link
Member

waruqi commented Dec 8, 2024

这个怎么测

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


How to test this

@star-hengxing
Copy link
Contributor Author

可以在 xmake/modules/private/action/require/impl/actions/test.lua 添加 _test_pkgconfig 函数

  • 检测 includedirs/links 是否和 package 匹配,预防一些 corner case(libxml2/x264)。
  • 检测 package:name 和 pc file name 是否一样,如果不一样可以在 verbose 下打印提醒。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


You can add the _test_pkgconfig function in xmake/modules/private/action/require/impl/actions/test.lua

  • Check whether includedirs/links matches package to prevent some corner cases (libxml2/x264).
  • Check whether package:name and pc file name are the same. If they are different, you can print a reminder under verbose.

@waruqi
Copy link
Member

waruqi commented Dec 15, 2024

这种感觉只能加 warning 要是直接 abort 估计得 break 一堆包,而且很多包 有很多的子库,和多个 pc 的,全是跟包名不同的 怎么搞,比如 abseil

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This feeling can only be added with warning. If you directly abort, you will probably have to break a bunch of packages.

@star-hengxing
Copy link
Contributor Author

install 后,可以用 ldd 对动态库检查一下是否用了系统包管理的库,这样就可以知道有没有依赖没拆

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After install, you can use ldd to check whether the dynamic library uses the system package management library, so that you can know whether there are any dependencies that have not been removed.

@waruqi
Copy link
Member

waruqi commented Jan 10, 2025

  • 检测 package:name 和 pc file name 是否一样,如果不一样可以在 verbose 下打印提醒。

很多都是不同的,内置检测不太好搞,会有很多 warning 误报,像 libxml2 就是 lib/pkgconfig/libxml-2.0.pc 不是 libxml2.pc

这种要么搞成 package:check_pkgconfig("libxml-2.0.pc") 在 on_test 根据不同包的情况 按需测。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


  • Check whether package:name and pc file name are the same. If they are different, you can print a reminder under verbose.

Many are different. The built-in detection is not easy to do. There will be many warning false positives. For example, libxml2 is lib/pkgconfig/libxml-2.0.pc, not libxml2.pc

This can be done as package:check_pkgconfig("libxml-2.0.pc") in on_test and tested on demand according to the situation of different packages.

@waruqi
Copy link
Member

waruqi commented Jan 10, 2025

试下这个 patch #6055
We can check pkgconfig/cmake importfiles

package("libxml2")
    on_test(function (package)
        assert(package:check_importfiles("pkgconfig::libxml-2.0"))
    end)

package("x264")
    on_test(function (package)
        assert(package:check_importfiles()) -- default: pkgconfig::x264
    end)

package("libcurl")
    on_test(function (package)
        assert(package:check_importfiles("cmake::CURL"))
    end)
> checking for pkgconfig/x264
checking for pkg-config ... /usr/local/bin/pkg-config
{
  includedirs = {
    "/Users/ruki/.xmake/packages/x/x264/v2024.02.27/7d8fe89a9dc648139ce022fac2728184/include"
  },
  version = "0.164.3192",
  links = {
    "x264",
    "pthread",
    "m",
    "dl"
  },
  linkdirs = {
    "/Users/ruki/.xmake/packages/x/x264/v2024.02.27/7d8fe89a9dc648139ce022fac2728184/lib"
  }
}

@waruqi waruqi added this to the v2.9.8 milestone Jan 10, 2025
@waruqi waruqi changed the title Improve package test Improve package test, add check pkgconfig Jan 10, 2025
@waruqi
Copy link
Member

waruqi commented Jan 10, 2025

改了下,用 package:check_importfiles 更合理些,并且具有扩展性,还可以检测 cmake 的导入文件

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After changing it, using package:check_importfiles is more reasonable and extensible. It can also detect the import files of cmake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants