Skip to content

New package: Cockatrice-2.10.2#54508

Closed
jason1987d wants to merge 1 commit intovoid-linux:masterfrom
jason1987d:Cockatrice
Closed

New package: Cockatrice-2.10.2#54508
jason1987d wants to merge 1 commit intovoid-linux:masterfrom
jason1987d:Cockatrice

Conversation

@jason1987d
Copy link
Copy Markdown
Contributor

Testing the changes

  • I tested the changes in this PR: YES

New package

Local build testing

  • I built this PR locally for my native architecture, x86_64-libc

@jason1987d
Copy link
Copy Markdown
Contributor Author

Apologies for the build failures on other architectures. Doing some research, found the arch pkgbuild lists support for only i686 and x86_64, consistent with what I'm seeing here. Will update.

@Rutpiv
Copy link
Copy Markdown
Contributor

Rutpiv commented Feb 27, 2025

Hello, I've looked into the build process using CMake, and it appears that the issue might be more related to crossbuilding than to the supported architectures. Specifically, CMake doesn't seem to find qt6 at this line and then fails after reaching this line, returning an error that qt was not found.

Additionally, I noticed on Repology that there are ARM builds in the Arch derivatives, and I believe the package compiles on these architectures when not crossbuilt. Given this, it might be better to set nocross=yes in the template rather than restricting it to i686 x86_64.

@Rutpiv
Copy link
Copy Markdown
Contributor

Rutpiv commented Feb 27, 2025

I've noticed that the build fails on musl. On my system, compiling for musl, if I add the following snippet:

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
    makedepends+=" libexecinfo-devel"
fi

the build passes the previously failing part.

@jason1987d jason1987d force-pushed the Cockatrice branch 2 times, most recently from 6837ae7 to 17a03ea Compare February 28, 2025 00:00
@classabbyamp classabbyamp added the new-package This PR adds a new package label Feb 28, 2025
@Rutpiv
Copy link
Copy Markdown
Contributor

Rutpiv commented Feb 28, 2025

During my initial testing I hadn't completed a full build, and only noticed the libexecinfo linking error when reviewing CI logs later. After reproducing the issue locally with a complete build, I resolved it by introducing an ENABLE_LIBEXECINFO flag to conditionally activate the existing FreeBSD linking logic in CMake through this patch:

CMake patch for libexecinfo handling
diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt
index 2b34536..9f55dba 100644
--- a/servatrice/CMakeLists.txt
+++ b/servatrice/CMakeLists.txt
@@ -30,7 +30,7 @@ if(WIN32)
 endif(WIN32)
 
 # Under FreeBSD we need libexecinfo to use backtrace_symbols_fd()
-if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD")
+if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD" OR (ENABLE_LIBEXECINFO))
   find_package(Libexecinfo REQUIRED)
   set(SYSTEM_LIBRARIES ${EXECINFO_LIBRARY} ${SYSTEM_LIBRARIES})
 endif()
@@ -105,7 +105,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 # Build servatrice binary and link it
 add_executable(servatrice MACOSX_BUNDLE ${servatrice_MOC_SRCS} ${servatrice_RESOURCES_RCC} ${servatrice_SOURCES})
 
-if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD")
+if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD" OR (ENABLE_LIBEXECINFO))
   target_link_libraries(servatrice cockatrice_common Threads::Threads ${SERVATRICE_QT_MODULES} ${LIBEXECINFO_LIBRARY})
 else()
   target_link_libraries(servatrice cockatrice_common Threads::Threads ${SERVATRICE_QT_MODULES})

Key improvements:

  1. Reused Existing Logic: The patch doesn't create new linking behavior - it simply extends the existing FreeBSD-specific libexecinfo handling to musl via a new ENABLE_LIBEXECINFO flag
  2. Cross-Compilation Fixes: Adjusted Qt6 detection paths for non-native builds
  3. CI Compatibility: Removed problematic -DTEST=1 due to flaky test downloads in cross compilation
  4. Template Refinement: Updated package dependencies and configuration flags
Final template configuration
# Template file for 'Cockatrice'
pkgname=Cockatrice
version=2.10.0
revision=1
build_style=cmake
configure_args="-DWITH_SERVER=1 -DWITH_CLIENT=1 -DWITH_ORACLE=1"
hostmakedepends="qt6-tools qt6-base pkg-config extra-cmake-modules protobuf zlib"
makedepends="qt6-base-devel liblzma-devel protobuf-devel qt6-svg-devel qt6-tools-devel
 qt6-websockets-devel qt6-multimedia-devel abseil-cpp-devel"
short_desc="Cross-platform virtual tabletop for multiplayer card games"
maintainer="Jason Elswick <jason@jasondavid.us>"
license="GPL-2.0-only"
homepage="https://github.com/Cockatrice/Cockatrice"
distfiles="https://github.com/Cockatrice/${pkgname}/archive/refs/tags/2025-02-10-Release-${version}.tar.gz"
checksum=7c2855c7277f9f57bb92a43eb24fe4d488d6ddb8f46929f03eb9c09a026dded8

if [ -n "$CROSS_BUILD" ]; then
    configure_args+="-DQt6_DIR=${XBPS_CROSS_BASE}/usr/lib/cmake/Qt6"
fi

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
    # Musl does not provide backtrace_symbols_fd(), so libexecinfo is required  
    makedepends+=" libexecinfo-devel"
    configure_args+=" -DENABLE_LIBEXECINFO=1"
fi

Verification: Successfully built for:

  • x86_64
  • x86_64-musl
  • aarch64
  • aarch64-musl

@jason1987d
Copy link
Copy Markdown
Contributor Author

jason1987d commented Feb 28, 2025

I have now changed the template to match what you have with the patch file as well. Thank you for taking a look, I didn't expect so many detailed and quick responses, there must have been demand to build this before. I am not a CMake or musl expert, but am learning more because of all this. The templates I had researched across the few other distros where this was built all had not only different versions of Cockatrice, but different sets of architectures listed.

I had also attempted to build 2.9.x series before, and even had discussion with developers on their discord, but nothing they suggested could truly compile and had just thought to check for any new versions.

Is the lack of tests acceptable here, since your template suggestion doesn't build them? I had not had any issues with tests failing on any builds I have done, but is there desire to potentially add googletest as a void package?

@Rutpiv
Copy link
Copy Markdown
Contributor

Rutpiv commented Feb 28, 2025

Thank you for your response.

I wasn’t entirely sure how the musl configuration should work, so I based my approach on other templates in the repository.

Regarding the cross-compiling issue, here’s the error log I encountered:

Cross-compiling issue
-- Downloading googletest
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Warning (dev) at /usr/libexec/xbps-src/share/cmake-3.30/Modules/ExternalProject/shared_internal_commands.cmake:1282 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  /usr/libexec/xbps-src/share/cmake-3.30/Modules/ExternalProject.cmake:3035 (_ep_add_download_command)
  CMakeLists.txt:6 (ExternalProject_Add)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /builddir/Cockatrice-2.10.0/build/gtest-download
[1/9] Creating directories for 'googletest'
[2/9] Performing download step (download, verify and extract) for 'googletest'
FAILED: googletest-prefix/src/googletest-stamp/googletest-download /builddir/Cockatrice-2.10.0/build/gtest-download/googletest-prefix/src/googletest-stamp/googletest-download 
cd /builddir/Cockatrice-2.10.0/build && /usr/libexec/xbps-src/bin/cmake -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /builddir/Cockatrice-2.10.0/build/gtest-download/googletest-prefix/src/googletest-stamp/download-googletest.cmake && /usr/libexec/xbps-src/bin/cmake -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /builddir/Cockatrice-2.10.0/build/gtest-download/googletest-prefix/src/googletest-stamp/verify-googletest.cmake && /usr/libexec/xbps-src/bin/cmake -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /builddir/Cockatrice-2.10.0/build/gtest-download/googletest-prefix/src/googletest-stamp/extract-googletest.cmake && /usr/libexec/xbps-src/bin/cmake -E touch /builddir/Cockatrice-2.10.0/build/gtest-download/googletest-prefix/src/googletest-stamp/googletest-download
-- Downloading...
   dst='/builddir/Cockatrice-2.10.0/build/gtest-download/googletest-prefix/src/release-1.11.0.zip'
   timeout='none'
   inactivity timeout='none'
-- Using src='https://github.com/google/googletest/archive/release-1.11.0.zip'
CMake Error at gtest-download/googletest-prefix/src/googletest-stamp/download-googletest.cmake:163 (message):
  Each download failed!

    error: downloading 'https://github.com/google/googletest/archive/release-1.11.0.zip' failed
          status_code: 1
          status_string: "Unsupported protocol, xbps-src's cmake has no network"
          log:
          --- LOG BEGIN ---
          Protocol "https" not supported

  Closing connection



          --- LOG END ---
          
    


ninja: build stopped: subcommand failed.
CMake Error at tests/CMakeLists.txt:32 (add_subdirectory):
  The source directory

    /builddir/Cockatrice-2.10.0/build/gtest-src

  does not contain a CMakeLists.txt file.


CMake Error at tests/CMakeLists.txt:36 (target_include_directories):
  Cannot specify include directories for target "gtest" which is not built by
  this project.


-- Configuring incomplete, errors occurred!
=> ERROR: Cockatrice-2.10.0_1: do_configure: 'CFLAGS="-DNDEBUG ${CFLAGS/ -pipe / }" CXXFLAGS="-DNDEBUG ${CXXFLAGS/ -pipe / }" cmake ${cmake_args} ${configure_args} ${LIBS:+-DCMAKE_C_STANDARD_LIBRARIES="$LIBS"} ${LIBS:+-DCMAKE_CXX_STANDARD_LIBRARIES="$LIBS"} ${wrksrc}/${build_wrksrc}' exited with 1
=> ERROR:   in do_configure() at common/build-style/cmake.sh:77

I resolved this error by using the gtest package (Void’s package name for GoogleTest).
After reading your comment about googletest, I checked the repository and discovered that Void already provides it under the package name gtest. Initially, I compiled with the repository’s version (1.12.1), which worked seamlessly for cross-compiling. To test further, I updated the package to version 1.16.0, and it also compiled successfully. This confirms that relying on the system’s gtest (instead of downloading googletest during compilation) resolves the issue.

To re-enable tests in the template, add -DTEST=1 to configure_args and include gtest-devel in makedepends.

@jason1987d
Copy link
Copy Markdown
Contributor Author

Good catch, did not see the gtest, I only searched for 'googletest' in packages. Thank you for your help, it tested/compiled again on my end.

@jason1987d jason1987d changed the title New package: Cockatrice-2.10.0 New package: Cockatrice-2.10.2 Apr 29, 2025
@Rutpiv
Copy link
Copy Markdown
Contributor

Rutpiv commented May 27, 2025

Hi,

While updating gtest, I tested the crossbuild of the Cockatrice package for armv6l with the new version of gtest and noticed that the test binaries weren’t actually running during crossbuild.

Because of that, I modified the build system logic to only enable tests on xbps-src when not crossbuilding and explicitly requested with -Q.

By observing the CI system, I believe it doesn’t run crossbuilds with -Q, so this change should help reduce build time. Since gtest-devel is now in checkdepends instead of makedepends, it won’t be installed during crossbuilds either, which helps reduce installation time and avoids pulling unnecessary dependencies in environments where tests can’t run anyway.

The updated template is below:

Template Updated
# Template file for 'Cockatrice'
pkgname=Cockatrice
version=2.10.2
revision=1
build_style=cmake
configure_args="-DWITH_SERVER=1 -DWITH_CLIENT=1 -DWITH_ORACLE=1"
hostmakedepends="qt6-tools qt6-base pkg-config extra-cmake-modules protobuf zlib"
makedepends="qt6-base-devel liblzma-devel protobuf-devel qt6-svg-devel qt6-tools-devel
	qt6-websockets-devel qt6-multimedia-devel abseil-cpp-devel"
checkdepends="gtest-devel"
short_desc="Cross-platform virtual tabletop for multiplayer card games"
maintainer="Jason Elswick <jason@jasondavid.us>"
license="GPL-2.0-only"
homepage="https://github.com/Cockatrice/Cockatrice"
distfiles="https://github.com/Cockatrice/Cockatrice/archive/refs/tags/2025-04-03-Release-${version}.tar.gz"
checksum=73cabec34604261b3ec2beb66b6a11faff0b0d1ca50f25cc58a45325a39225d4

if [ -n "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" -DTEST=1"
fi

if [ -n "$CROSS_BUILD" ]; then
	configure_args+=" -DQt6_DIR=${XBPS_CROSS_BASE}/usr/lib/cmake/Qt6"
fi

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
	makedepends+=" libexecinfo-devel"
	configure_args+=" -DENABLE_LIBEXECINFO=1"
fi

@github-actions
Copy link
Copy Markdown

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@github-actions github-actions bot added the Stale label Aug 26, 2025
@github-actions github-actions bot closed this Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-package This PR adds a new package Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants