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

[libdvdcss] add new port of version 1.4.2 (d0b6a291) for libmpv #40693

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

Conversation

capric8416
Copy link
Contributor

@capric8416 capric8416 commented Aug 29, 2024

1. descriptions

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

libmpv is very hard to build on windows with msvc or with msys2 gcc, but it can be build on latest arch and ubuntu linux, so i download release from https://github.com/shinchiro/mpv-winbuild-cmake.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 29, 2024

The upstream build system is autotools, and vcpkg supports that with vcpkg_configure_make etc.

@capric8416
Copy link
Contributor Author

The upstream build system is autotools, and vcpkg supports that with vcpkg_configure_make etc.

I added a CMakeLists.txt file to support find_package in CMake and configured MSVC link flags to support UWP. autotools cannot accomplish these tasks.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 29, 2024

The upstream build system is autotools, and vcpkg supports that with vcpkg_configure_make etc.

I added a CMakeLists.txt file to support find_package in CMake and configured MSVC link flags to support UWP. autotools cannot accomplish these tasks.

vcpkg builds several autotools ports for uwp.
CMake config can be written independent of CMake. Of course it is not as convenient as a direct export. If not coming from upstream, it would need to be prefixed as unofficial.
But this upstream provides pkgconfig files, and we can often adapt and use them for MSVC (single config).

@capric8416
Copy link
Contributor Author

unofficial

OK, I have marked it as unofficial.

PS D:\__develop__\MediaPorts\vcpkg> .\vcpkg.exe install libdvdcss:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
    libdvdcss:[email protected]
Detecting compiler hash for triplet x64-windows-static...
Compiler found: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from C:\Users\wtoe\AppData\Local\vcpkg\archives in 872 us. Use --debug to see more details.
Installing 1/1 libdvdcss:[email protected]...
Building libdvdcss:[email protected]...
-- Using cached D:/__develop__/MediaPorts/vcpkg/downloads/libdvdcss-d0b6a291c24eda3727ad5c7a14956fc1fc82446d.tar.gz
-- Cleaning sources at D:/__develop__/MediaPorts/vcpkg/buildtrees/libdvdcss/src/c1fc82446d-7d1bd9aa9f.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source D:/__develop__/MediaPorts/vcpkg/downloads/libdvdcss-d0b6a291c24eda3727ad5c7a14956fc1fc82446d.tar.gz
-- Applying patch 0001-fix-uwp.diff
-- Using source at D:/__develop__/MediaPorts/vcpkg/buildtrees/libdvdcss/src/c1fc82446d-7d1bd9aa9f.clean
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.2.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.5.3-3-x86_64.pkg.tar.zst.
-- Using msys root at D:/__develop__/MediaPorts/vcpkg/downloads/tools/msys2/1e74ca60daa10104
-- Installing: D:/__develop__/MediaPorts/vcpkg/packages/libdvdcss_x64-windows-static/share/libdvdcss/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 74.2 ms.
Elapsed time to handle libdvdcss:x64-windows-static: 24 s
libdvdcss:x64-windows-static package ABI: 562e8197142eb3a8c2ad408c2fbd37c4c83f6bc580fc2d3ec073593f07da4e2a
Total install time: 24 s
libdvdcss provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(libdvdcss CONFIG REQUIRED)
  target_link_libraries(main PRIVATE unofficial::libdvdcss::libdvdcss)

@dg0yt
Copy link
Contributor

dg0yt commented Aug 29, 2024

I'm still opposed to vendoring a build system when it is not necessary.

@capric8416
Copy link
Contributor Author

I'm still opposed to vendoring a build system when it is not necessary.

I found 248 CMakeLists.txt in ports dir

PS D:\__develop__\MediaPorts\vcpkg> find ./ports/ | findstr "CMakeLists.txt" | wc -l
248

for example: vulkan, usockets, spdk, lua, live555, libass, imgui, angle

@dg0yt
Copy link
Contributor

dg0yt commented Aug 29, 2024

I found 248 CMakeLists.txt in ports dir

So what? Either it is still necessary, or it wasn't cleaned up. #40677 removes one of them.

@LilyWangLL LilyWangLL added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Aug 29, 2024
new file mode 100644
index 0000000..0a32e72
--- /dev/null
+++ b/msvc/uwpapi.cpp
Copy link
Member

Choose a reason for hiding this comment

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

This is way way too big of a patch to not be accepted by upstream; it would be better to just say "supports": "!uwp" if upstream explicitly refuses to support that.

@LilyWangLL
Copy link
Contributor

libdvdcss has been added by PR #40720.

@LilyWangLL LilyWangLL marked this pull request as draft September 10, 2024 06:13
@LilyWangLL
Copy link
Contributor

2. test ok

  • ✅ 2.1. vcpkg search works
PS D:\__develop__\MediaPorts\vcpkg> .\vcpkg.exe search libdvdcss
libdvdcss                1.4.2            Accessing DVDs like a block device library
  • ✅ 2.2. vcpkg install works
log
PS D:\__develop__\MediaPorts\vcpkg> .\vcpkg.exe install libdvdcss:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
    libdvdcss:[email protected]
Detecting compiler hash for triplet x64-windows-static...
-- Using %HTTP(S)_PROXY% in environment variables.
Compiler found: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from C:\Users\wtoe\AppData\Local\vcpkg\archives in 618 us. Use --debug to see more details.
Installing 1/1 libdvdcss:[email protected]...
Building libdvdcss:[email protected]...
-- Using cached D:/__develop__/MediaPorts/vcpkg/downloads/libdvdcss-d0b6a291c24eda3727ad5c7a14956fc1fc82446d.tar.gz
-- Cleaning sources at D:/__develop__/MediaPorts/vcpkg/buildtrees/libdvdcss/src/c1fc82446d-3d5050f957.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source D:/__develop__/MediaPorts/vcpkg/downloads/libdvdcss-d0b6a291c24eda3727ad5c7a14956fc1fc82446d.tar.gz
-- Using source at D:/__develop__/MediaPorts/vcpkg/buildtrees/libdvdcss/src/c1fc82446d-3d5050f957.clean
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.2.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.5.3-3-x86_64.pkg.tar.zst.
-- Using msys root at D:/__develop__/MediaPorts/vcpkg/downloads/tools/msys2/1e74ca60daa10104
-- Installing: D:/__develop__/MediaPorts/vcpkg/packages/libdvdcss_x64-windows-static/share/libdvdcss/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 67.3 ms.
Elapsed time to handle libdvdcss:x64-windows-static: 21 s
libdvdcss:x64-windows-static package ABI: 32cc3ea797b5c664a69200ab1aa978307d80b0fdc3225f270a0161dd19bf5027
Total install time: 21 s
libdvdcss provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(libdvdcss CONFIG REQUIRED)
  target_link_libraries(main PRIVATE libdvdcss::libdvdcss)

PS D:\__develop__\MediaPorts\vcpkg> ls .\installed\x64-windows-static\share\libdvdcss\

    Directory: D:\__develop__\MediaPorts\vcpkg\installed\x64-windows-static\share\libdvdcss

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---            2022/6/5    20:52          18092 copyright
-a---           2024/8/29    10:19           1009 libdvdcss-config.cmake
-a---           2024/8/29    10:19            896 libdvdcss-targets-debug.cmake
-a---           2024/8/29    10:19            894 libdvdcss-targets-release.cmake
-a---           2024/8/29    10:19           4185 libdvdcss-targets.cmake
-a---           2024/8/29    10:19           1253 vcpkg_abi_info.txt
-a---           2024/8/29    10:19           5374 vcpkg.spdx.json

PS D:\__develop__\MediaPorts\vcpkg> ls .\installed\x64-windows-static\lib\

    Directory: D:\__develop__\MediaPorts\vcpkg\installed\x64-windows-static\lib

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           2024/8/29    10:19         418288 libdvdcss.lib

PS D:\__develop__\MediaPorts\vcpkg> ls .\installed\x64-windows-static\include\dvdcss\

    Directory: D:\__develop__\MediaPorts\vcpkg\installed\x64-windows-static\include\dvdcss

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---            2022/6/5    20:52           3685 dvdcss.h
-a---           2024/8/29    10:19           1289 version.h

  • ✅ 2.3. vcpkg manifest mode with cmake works
log
PS D:\__develop__\MediaPorts\test_libdvdcss> .\2_configure.bat
-- Building for: Visual Studio 17 2022
-- Running vcpkg install
Fetching registry information from https://github.com/MediaPorts/vcpkg (libdvdcss)...
Detecting compiler hash for triplet x64-windows-static...
-- Using %HTTP(S)_PROXY% in environment variables.
Compiler found: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
    libdvdcss:[email protected] -- C:\Users\wtoe\AppData\Local\vcpkg\registries\git-trees\7dc8b5b8ed2211f9e66a7bc5036df481163a4b13
  * vcpkg-cmake:x64-windows-static@2024-04-23 -- C:\Users\wtoe\AppData\Local\vcpkg\registries\git-trees\e74aa1e8f93278a8e71372f1fa08c3df420eb840
  * vcpkg-cmake-config:x64-windows-static@2024-05-23 -- C:\Users\wtoe\AppData\Local\vcpkg\registries\git-trees\97a63e4bc1a17422ffe4eff71da53b4b561a7841
Additional packages (*) will be modified to complete this operation.
Restored 3 package(s) from C:\Users\wtoe\AppData\Local\vcpkg\archives in 29.5 ms. Use --debug to see more details.
Installing 1/3 vcpkg-cmake-config:x64-windows-static@2024-05-23...
Elapsed time to handle vcpkg-cmake-config:x64-windows-static: 2.53 ms
vcpkg-cmake-config:x64-windows-static package ABI: 613963862364b3cb19157095a9eb52b071de7fe7e0141690c7b812d32c297da9
Installing 2/3 vcpkg-cmake:x64-windows-static@2024-04-23...
Elapsed time to handle vcpkg-cmake:x64-windows-static: 3.56 ms
vcpkg-cmake:x64-windows-static package ABI: 2372b10c79a33ebcf358ec0651765333ab9259cdd26e29b78164276ddced77e9
Installing 3/3 libdvdcss:[email protected]...
Elapsed time to handle libdvdcss:x64-windows-static: 4.78 ms
libdvdcss:x64-windows-static package ABI: a7d7f000fc9c18c9c1d15b22b8b70be8a406cd2a1d10c7c0c94deb7ed8e51c86
Total install time: 10.9 ms
libdvdcss provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(libdvdcss CONFIG REQUIRED)
  target_link_libraries(main PRIVATE libdvdcss::libdvdcss)

-- Running vcpkg install - done
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.40.33812.0
-- The CXX compiler identification is MSVC 19.40.33812.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (8.6s)
-- Generating done (0.1s)
-- Build files have been written to: D:/__develop__/MediaPorts/test_libdvdcss/project/build
  • ✅ test dvdcss api on windows ok
log
PS D:\__develop__\MediaPorts\test_libdvdcss> .\3_build.bat
MSBuild version 17.10.4+10fbfbf2e for .NET Framework

  1>Checking Build System
  Building Custom Rule D:/__develop__/MediaPorts/test_libdvdcss/src/CMakeLists.txt
  main.cpp
     Creating library D:/__develop__/MediaPorts/test_libdvdcss/project/build/src/Debug/server.lib and object D:/__develop__/MediaPorts/test_libdvdcss/project/build/src/Debug/server.exp
  server.vcxproj -> D:\__develop__\MediaPorts\test_libdvdcss\project\output\Windows\AMD64\Debug\server.exe
  Building Custom Rule D:/__develop__/MediaPorts/test_libdvdcss/CMakeLists.txt
PS D:\__develop__\MediaPorts\test_libdvdcss> D:\__develop__\MediaPorts\test_libdvdcss\project\output\Windows\AMD64\Debug\server.exe
dvdcss version: 1.4.2
dvdcss_open(/dev/null) error
  • ✅ test dvdcss api on linux ok
log
capric@capric-pc-89pe3oc:/mnt/d/__develop__/MediaPorts/test_libdvdcss$ cmake -S . -B project/build_linux -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
-- Running vcpkg install
Fetching registry information from https://github.com/MediaPorts/vcpkg (libdvdcss)...
A suitable version of cmake was not found (required v3.29.2).
Downloading https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-linux-x86_64.tar.gz
Extracting cmake...
Detecting compiler hash for triplet x64-linux...
Compiler found: /usr/bin/c++
The following packages will be built and installed:
    libdvdcss:[email protected] -- /home/capric/.cache/vcpkg/registries/git-trees/7dc8b5b8ed2211f9e66a7bc5036df481163a4b13
  * vcpkg-cmake:x64-linux@2024-04-23 -- /home/capric/.cache/vcpkg/registries/git-trees/e74aa1e8f93278a8e71372f1fa08c3df420eb840
  * vcpkg-cmake-config:x64-linux@2024-05-23 -- /home/capric/.cache/vcpkg/registries/git-trees/97a63e4bc1a17422ffe4eff71da53b4b561a7841
Additional packages (*) will be modified to complete this operation.
Restored 0 package(s) from /home/capric/.cache/vcpkg/archives in 12.9 us. Use --debug to see more details.
Installing 1/3 vcpkg-cmake-config:x64-linux@2024-05-23...
Building vcpkg-cmake-config:x64-linux@2024-05-23...
/home/capric/.cache/vcpkg/registries/git-trees/97a63e4bc1a17422ffe4eff71da53b4b561a7841: info: installing overlay port from here
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/vcpkg-port-config.cmake
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake-config_x64-linux/share/vcpkg-cmake-config/copyright
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Stored binaries in 1 destinations in 45.4 ms.
Elapsed time to handle vcpkg-cmake-config:x64-linux: 801 ms
vcpkg-cmake-config:x64-linux package ABI: 7d68d31be38ed9baa12247cbdec1129ea73427af4b8f6564e2e936229e7f36cd
Installing 2/3 vcpkg-cmake:x64-linux@2024-04-23...
Building vcpkg-cmake:x64-linux@2024-04-23...
/home/capric/.cache/vcpkg/registries/git-trees/e74aa1e8f93278a8e71372f1fa08c3df420eb840: info: installing overlay port from here
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 54.4 ms.
Elapsed time to handle vcpkg-cmake:x64-linux: 979 ms
vcpkg-cmake:x64-linux package ABI: d48c4de719adf967df9f3747d5f05650ff876b8de6ce3882659af2b60b01cd1e
Installing 3/3 libdvdcss:[email protected]...
Building libdvdcss:[email protected]...
/home/capric/.cache/vcpkg/registries/git-trees/7dc8b5b8ed2211f9e66a7bc5036df481163a4b13: info: installing overlay port from here
-- Using cached /mnt/d/__develop__/MediaPorts/vcpkg/downloads/libdvdcss-d0b6a291c24eda3727ad5c7a14956fc1fc82446d.tar.gz
-- Cleaning sources at /mnt/d/__develop__/MediaPorts/vcpkg/buildtrees/libdvdcss/src/c1fc82446d-3d5050f957.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /mnt/d/__develop__/MediaPorts/vcpkg/downloads/libdvdcss-d0b6a291c24eda3727ad5c7a14956fc1fc82446d.tar.gz
-- Using source at /mnt/d/__develop__/MediaPorts/vcpkg/buildtrees/libdvdcss/src/c1fc82446d-3d5050f957.clean
-- Configuring x64-linux
-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Installing: /mnt/d/__develop__/MediaPorts/vcpkg/packages/libdvdcss_x64-linux/share/libdvdcss/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 88.3 ms.
Elapsed time to handle libdvdcss:x64-linux: 23 s
libdvdcss:x64-linux package ABI: 625b57433b36ea4357d665642a25dbb9c49ff527e6425ee878f26334f476ac77
Total install time: 25 s
libdvdcss provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(libdvdcss CONFIG REQUIRED)
  target_link_libraries(main PRIVATE libdvdcss::libdvdcss)

-- Running vcpkg install - done
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (111.0s)
-- Generating done (0.1s)
-- Build files have been written to: /mnt/d/__develop__/MediaPorts/test_libdvdcss/project/build_linux
capric@capric-pc-89pe3oc:/mnt/d/__develop__/MediaPorts/test_libdvdcss$ cmake --build project/build_linux
[ 50%] Building CXX object src/CMakeFiles/server.dir/main.cpp.o
[100%] Linking CXX executable /mnt/d/__develop__/MediaPorts/test_libdvdcss/project/output/Linux/x86_64/server
[100%] Built target server
capric@capric-pc-89pe3oc:/mnt/d/__develop__/MediaPorts/test_libdvdcss$ /mnt/d/__develop__/MediaPorts/test_libdvdcss/project/output/Linux/x86_64/server
dvdcss version: 1.4.2
dvdcss_open(/dev/null) error

@LilyWangLL
Copy link
Contributor

@capric8416 Thanks for your PR, I updated the description of this PR, move the test log to a new comment, and update the check list of description. Please double confirm the check list, this is needed to do when adding the new port, the old list applied to modify an existing port.

@dg0yt
Copy link
Contributor

dg0yt commented Sep 10, 2024

#40898 adds ports for pristine libdvdnav and libdvdread based on autotools, and integrates them with ffmpeg.
(This is done to stress the use-the-upstream-build-system recommendation. But I don't plan to do the remaining work for libmpv.)

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