-
Notifications
You must be signed in to change notification settings - Fork 74
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
Draft: Document rules for tool ports #46
Draft
Neumann-A
wants to merge
1
commit into
microsoft:main
Choose a base branch
from
Neumann-A:add_tool_port_docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: Authoring Tool Ports | ||
description: Learn to create a Tool Port for usage in other ports. | ||
ms.date: 11/30/2022 | ||
--- | ||
# Authoring tool ports | ||
|
||
Ports providing a binary or tool for other ports are tool ports. For example the `vcpkg-tool-meson` port exposes the required meson python script to run meson based builds in a versioned manner. Tool ports are generally ment to replace `vcpkg_find_acquire_program` calls since the latter is not versioned and triggers an CI world rebuild if changed. | ||
|
||
Tool ports are implemented in different ways depending on their expected usage. | ||
1. If a tool is expected to be provided in binary form and not ment for the user to be used the port should be named `vcpkg-tool-<toolname>`. The port should work like `vcpkg_find_acquire_program` and only download/provide the tool if another port requests its usage. This is done via `vcpkg-port-config.cmake` which has to included all logic to find or provide the tool. The artifacts of the tool have to be put into `${DOWNLOADS}/tools/<tool_name>-<tool_version>`. (This means that the tool port is actually just a [script port](./authoring-script-ports.md)) | ||
2. If a tool is required to be build from source but is not to be used by the user the tools build artifacts should be stored into `${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}`. Furthermore a `vcpkg-port-config.cmake` needs to be installed setting a variable to path of the relevant tool. | ||
3. If a tool is expected to be used outside of vcpkg and inside the users `CMakeLists.txt`. The tools build artifacts are installed to `${CURRENT_PACKAGES_DIR}/tools/${PORT}` and the port name should follow the normal vcpkg naming rules. A `vcpkg-port-config.cmake` is required to be installed like in case 2. | ||
|
||
Most (if not all) tool ports are required to be marked with `"supports" : "native"`. Furthermore `VCPKG_FORCE_SYSTEM_BINARIES` should be honored if possible with a version check if the system provided binary fullfills the version requirements of the tool port itself (if any). | ||
For 1. this means to do a simple `find_program`. For case 2./3. this means not building/providing the tool from within vcpkg but still fullfilling the set variables in `vcpkg-port-config.cmake` of the tool port. | ||
|
||
If a tool port is a dependency in another port, the tool port should is requried to be marked with `"host" : true` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
Do you have an example and should
tools
features also installvcpkg-port-config.cmake
files?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 probably falls into case 3. I thought about dropping the
vcpkg-port-config.cmake
for that case unless it is expected to be referenced by aportfile
directly. (or simply install an emptyvcpkg-port-config.cmake
).Maybe it comes down to define a rule how to reference tool paths from portfiles in this case. Everything which is external to the port itself should be indirectly referenced via a
vcpkg-port-config.cmake
while a port referencing itself (e.g. code generators) is allowed to directly access it host build artifacts.I can also imaging a
vcpkg_find_program
call which drops the acquire component but is aware of additional files being installed by ports.