vcpkg/ports/glib-networking/portfile.cmake
vipcxj 002c5b0659
[gstreamer,libsoup,libpsl,glib-networking] enable soup plugins of gstreamer (#36679)
<!-- If your PR fixes issues, please note that here by adding "Fixes
#NNNNNN." for each fixed issue on separate lines. -->

<!-- If you are still working on the PR, open it as a Draft:
https://github.blog/2019-02-14-introducing-draft-pull-requests/. -->

Update port gstreamer

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] The "supports" clause reflects platforms that may be fixed by this
new version.
- [ ] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [ ] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.

Add port libsoup,libpsl,glib-networking
- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] 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.
- [x] 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](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [x] The versioning scheme in `vcpkg.json` matches what upstream says.
- [x] The license declaration in `vcpkg.json` matches what upstream
says.
- [x] The installed as the "copyright" file matches what upstream says.
- [x] The source code of the component installed comes from an
authoritative source.
- [x] The generated "usage text" is accurate. See
[adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md)
for context.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is in the new port's versions file.
- [x] Only one version is added to each modified port's versions file.

I found the offical tutorials not work because the uridecodebin plugin
can not handle https uri. Then I found that soup plugins is disabled. So
I update the gstreamer to enable it. The gstreamer compiled successfuly
without new port which I add. However the soup plugins will not work
without libsoup. So I add the port libsoup. And it depend on libpsl and
glib-networking. The glib-networking is a gio module. To make it work,
we should set env GIO_MODULE_DIR to the plugins dir which
glib-networking dll live in. And now I uridecodebin works properly.
By the way, how vcpkg deal with plugin dll? I put them to a plugins dir
just like gstreamer. However to use them is a hard work. For a gio
module, we have to set the env GIO_MODULE_DIR to the dyamic library
location.
2024-02-28 18:02:23 -08:00

65 lines
2.6 KiB
CMake

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.gnome.org
OUT_SOURCE_PATH SOURCE_PATH
REPO GNOME/glib-networking
REF "${VERSION}"
SHA512 "35b6b05afab29da4f4d54f559ded3cc6a16376f188afdb72689b7d9bcba71b9963317bcbd1101327137ae31ee51e25438f9bfa267e23d6076706a64c3594cbb5"
HEAD_REF main
)
vcpkg_list(SET FEATURE_OPTIONS)
if (gnutls IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS -Dgnutls=enabled)
else()
list(APPEND FEATURE_OPTIONS -Dgnutls=disabled)
endif()
if (openssl IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS -Dopenssl=enabled)
else()
list(APPEND FEATURE_OPTIONS -Dopenssl=disabled)
endif()
if (libproxy IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS -Dlibproxy=enabled)
else()
list(APPEND FEATURE_OPTIONS -Dlibproxy=disabled)
endif()
if (environment-proxy IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS -Denvironment_proxy=enabled)
else()
list(APPEND FEATURE_OPTIONS -Denvironment_proxy=disabled)
endif()
vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-Dgnome_proxy=disabled
ADDITIONAL_BINARIES
"gio-querymodules = '${CURRENT_HOST_INSTALLED_DIR}/tools/glib/gio-querymodules${CMAKE_EXECUTABLE_SUFFIX}'"
)
vcpkg_install_meson()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/gio/modules/pkgconfig")
file(GLOB MODULE_FILES "${CURRENT_PACKAGES_DIR}/lib/gio/modules/*")
file(COPY ${MODULE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/plugins/${PORT}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/gio/modules/pkgconfig")
file(GLOB MODULE_DEBUG_FILES "${CURRENT_PACKAGES_DIR}/debug/lib/gio/modules/*")
file(COPY ${MODULE_DEBUG_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/plugins/${PORT}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib")
if(libproxy IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES glib-pacrunner SEARCH_DIR "${CURRENT_PACKAGES_DIR}/libexec")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/libexec" "${CURRENT_PACKAGES_DIR}/debug/libexec")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/services/org.gtk.GLib.PACRunner.service" "${CURRENT_PACKAGES_DIR}/libexec/glib-pacrunner" "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}/glib-pacrunner")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")