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

[lhasa] add new port #32793

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

[lhasa] add new port #32793

wants to merge 4 commits into from

Conversation

Ghabry
Copy link
Contributor

@Ghabry Ghabry commented Jul 27, 2023

  • 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.
  • No dependencies. 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.

The library uses autotools. I created a CMakeLists based on the one from bzip2 available here in vcpkg.

I'm unsure about the "usage text". Am I required to create a unofficial::lhasa target that a few other libraries offer?

@Ghabry Ghabry force-pushed the lhasa branch 2 times, most recently from 8d11b2f to bf37a1b Compare July 27, 2023 22:21
@FrankXie05 FrankXie05 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Jul 28, 2023
@dg0yt
Copy link
Contributor

dg0yt commented Jul 28, 2023

The library uses autotools.

So why don't we use it?

@FrankXie05
Copy link
Contributor

@Ghabry As #32793 (comment) said, we support autotools. :)

@Ghabry
Copy link
Contributor Author

Ghabry commented Jul 28, 2023

ooh. My last port contribution was a long time ago so I wasn't aware of the autotools support. 😅

will make it a draft until I resolve this.

@Ghabry Ghabry marked this pull request as draft July 28, 2023 09:37
@Ghabry Ghabry marked this pull request as ready for review July 28, 2023 15:03
@Ghabry Ghabry force-pushed the lhasa branch 5 times, most recently from 97bd3e0 to 87f5d1f Compare July 28, 2023 16:22
@Ghabry
Copy link
Contributor Author

Ghabry commented Jul 28, 2023

@FrankXie05 migrated to autotools. macos builder looks stuck though.

Comment on lines 1 to 4
set(LHASA_VERSION 0.4.0)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/fragglet/lhasa/releases/download/v0.4.0/lhasa-${LHASA_VERSION}.tar.gz"
FILENAME "lhasa-${LHASA_VERSION}.tar.gz"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
set(LHASA_VERSION 0.4.0)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/fragglet/lhasa/releases/download/v0.4.0/lhasa-${LHASA_VERSION}.tar.gz"
FILENAME "lhasa-${LHASA_VERSION}.tar.gz"
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/fragglet/lhasa/releases/download/v0.4.0/lhasa-${VERSION}.tar.gz"
FILENAME "lhasa-${VERSION}.tar.gz"

You can use ${VERSION} directly, it reads the "version" field in vcpkg.json.

Comment on lines 38 to 40
vcpkg_install_copyright(
COMMENT "lhasa is under ISC license."
FILE_LIST
"${SOURCE_PATH}/COPYING"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
vcpkg_install_copyright(
COMMENT "lhasa is under ISC license."
FILE_LIST
"${SOURCE_PATH}/COPYING"
)
vcpkg_install_copyright( FILE_LIST "${SOURCE_PATH}/COPYING")

{
"name": "lhasa",
"version-semver": "0.4.0",
"port-version": 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"port-version": 1,

ports/lhasa/vcpkg.json Outdated Show resolved Hide resolved
@FrankXie05
Copy link
Contributor

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.

@FrankXie05 FrankXie05 marked this pull request as draft July 31, 2023 05:54
@Ghabry Ghabry marked this pull request as ready for review August 12, 2023 22:41
@FrankXie05
Copy link
Contributor

@Ghabry The port provides a pc file, but does not provide a usage. We need find_package(PkgConfig). Refer to port liburing.

@Ghabry
Copy link
Contributor Author

Ghabry commented Sep 20, 2023

sorry for the delay. Was on vacation and didn't notice the build failure because the usage file was not installed. :/

Now resolved.

"version": "0.4.0",
"description": "LZH/LHA archive library",
"homepage": "https://fragglet.github.io/lhasa/",
"license": "ISC"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"license": "ISC"
"license": "ISC",
"dependencies": [
{
"name": "pkgconf",
"host": true,
"default-features": false
}
]

Please add the dependencies to use the pkg-config.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

For the usage.

Copy link
Contributor

Choose a reason for hiding this comment

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

For using this port? (I have pkg-config.)
Or for building this port? (Don't we we still use vcpkg_find_acquire_program(PKGCONFG)?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course this method can be used, what I mean is that this port requires pkgconfg to be installed. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course this method can be used, what I mean is that this port requires pkgconfg to be installed. :)

I don't see why it requires port pkgconf.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or add vcpkg_find_acquire_program(PKGCONFIG) to portfile.cmake.

FrankXie05
FrankXie05 previously approved these changes Oct 24, 2023
@Ghabry
Copy link
Contributor Author

Ghabry commented Nov 12, 2023

Hey this was approved 3 weeks ago. Is there anything else missing before merging?

ports/lhasa/vcpkg.json Outdated Show resolved Hide resolved
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.

It might be possible to drop the patch (unless upstreamed) and just pass COPY_SOURCE to vcpkg_configure_make.

ports/lhasa/portfile.cmake Outdated Show resolved Hide resolved
Comment on lines 13 to 15
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
# fixes error: libtool: can't build x86_64-pc-mingw32 shared library unless -no-undefined is specified
list(APPEND OPTIONS "LDFLAGS=-no-undefined")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
# fixes error: libtool: can't build x86_64-pc-mingw32 shared library unless -no-undefined is specified
list(APPEND OPTIONS "LDFLAGS=-no-undefined")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_MINGW)
# fixes error: libtool: can't build x86_64-pc-mingw32 shared library unless -no-undefined is specified
list(APPEND OPTIONS "LDFLAGS=\$LDFLAGS -no-undefined")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dg0yt

This patch did not compile. I had to use

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_WINDOWS)

instead of

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" AND VCPKG_TARGET_IS_MINGW)

Now is all green.

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 strange. CI doesn't even test mingw. And no other port needs to tell mingw about this flag. Does libtool convert it to some MSVC flag?

ports/lhasa/portfile.cmake Outdated Show resolved Hide resolved
@Ghabry
Copy link
Contributor Author

Ghabry commented Nov 14, 2023

that patch is directly taken from an upstream commit. There is just no new release since that fix was commited.

@FrankXie05
Copy link
Contributor

Test the usage on x64-windows:

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/FindPkgConfig.cmake:663 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.27/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
  CMakeLists.txt:20 (pkg_check_modules)


-- Configuring incomplete, errors occurred!

@Ghabry
Copy link
Contributor Author

Ghabry commented Apr 2, 2024

I was told by @dg0yt to remove the pkg-config dependency. 🤔

Technically pkg-config is not a dependency for the library. You can e.g. manually link it through a makefile.

@dg0yt
Copy link
Contributor

dg0yt commented Apr 2, 2024

I was told by @dg0yt to remove the pkg-config dependency. 🤔

Technically pkg-config is not a dependency for the library. You can e.g. manually link it through a makefile.

You need

vcpkg_find_acquire_program(PKGCONFIG)

vcpkg_cmake_configure(
    ...
    OPTIONS
        ...
         "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"

@Ghabry
Copy link
Contributor Author

Ghabry commented Apr 3, 2024

I use vcpkg_configure_make, not vcpkg_cmake_configure. How do I correctly provide the argument to it? I looked through all 30 ports that call vcpkg_find_acquire_program(PKGCONFIG) and all of them use CMake, not Make.

@BillyONeal
Copy link
Member

I think @dg0yt was speaking to @FrankXie05 ?

@BillyONeal BillyONeal added the info:reviewed Pull Request changes follow basic guidelines label Jun 27, 2024
@BillyONeal
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

FrankXie05
FrankXie05 previously approved these changes Jun 28, 2024
@dg0yt
Copy link
Contributor

dg0yt commented Jun 28, 2024

I use vcpkg_configure_make, not vcpkg_cmake_configure. How do I correctly provide the argument to it? I looked through all 30 ports that call vcpkg_find_acquire_program(PKGCONFIG) and all of them use CMake, not Make.

hm, maybe an ugly corner.

I guess the ports with vcpkg_configure_make just lack explicit handling. pkg-config comes from the system or from msys2, just as make, so it just works if it is not missing.

It only confirms that the new port doesn't need a pkgconf dependency.

Comment on lines 1 to 6
The package lhasa can be imported via CMake FindPkgConfig module:

find_package(PkgConfig)
pkg_check_modules(LHASA REQUIRED IMPORTED_TARGET liblhasa)

target_link_libraries(main PRIVATE PkgConfig::LHASA)
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to review the heuristically output which is shown when no usage file gets installed. Formatting and wording were changed.

Copy link
Member

@BillyONeal BillyONeal Jun 28, 2024

Choose a reason for hiding this comment

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

Yeah, despite the name 'info:reviewed' here I just set it to make sure I looked at it after confirmation that the merge succeeded build since I resurrected a PR that is a year old

* Update usage text
* Use the patch from upstream
@BillyONeal BillyONeal removed the info:reviewed Pull Request changes follow basic guidelines label Jun 29, 2024
Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

I would like @dg0yt 's question #32793 (comment) answered before merging

@JavierMatosD JavierMatosD marked this pull request as draft October 8, 2024 20:14
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants