Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Writing my first ebuild for CasparCG/server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
nagmat84
Guru
Guru


Joined: 27 Mar 2007
Posts: 308

PostPosted: Tue Apr 22, 2025 2:20 pm    Post subject: [SOLVED] Writing my first ebuild for CasparCG/server Reply with quote

I want to use CasparCG/server for which no Gentoo ebuild exists. I wanted to do it properly and create an ebuild for it. This is the first time that I ever try to create an ebuild. The configuration phase dies with the following message
Code:
CMake Warning (dev) at CMakeModules/Bootstrap_Linux.cmake:27 (FIND_PACKAGE):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

Call Stack (most recent call first):
  CMakeLists.txt:47 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/lib64/cmake/Boost-1.85.0/BoostConfig.cmake:141 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/boost_system-1.85.0/boost_system-config.cmake

  but it set boost_system_FOUND to FALSE so package "boost_system" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_system.so.1.85.0 (shared, Boost_USE_STATIC_LIBS=ON)

Call Stack (most recent call first):
  /usr/lib64/cmake/Boost-1.85.0/BoostConfig.cmake:262 (boost_find_component)
  /usr/share/cmake/Modules/FindBoost.cmake:610 (find_package)
  CMakeModules/Bootstrap_Linux.cmake:27 (FIND_PACKAGE)
  CMakeLists.txt:47 (include)

Maybe someone is willing to support a newbie to create his first ebuild script and may help me to figure out what is going on?

This is my custom ebuild file so far
Code:
EAPI=8

inherit cmake

DESCRIPTION="CasparCG Server plays out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006."
HOMEPAGE="https://casparcg.com/"

# Upon download, rename unspecific "vX.Y.Z.-stable.tar.gz" to a file whose name contains the full package name plus version.
SRC_URI="https://github.com/CasparCG/server/archive/refs/tags/v${PV}-stable.tar.gz -> ${P}.tar.gz"

# The tar-archive contains a subdirectory with the sources "server-x.y.z-stable/src" whose name differs from the package name.
# Overwrite the source directory "$S" with the correct directory.
S="${WORKDIR}/server-${PV}-stable/src"

# Always download the source from upstream, do not try to download it from a Gentoo mirror.
RESTRICT="mirror"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND=">=dev-libs/boost-1.67.0:*"
DEPEND="${RDEPEND}"
My ebuild does not contain much yet, in particular it does not yet overwrite any of the emerge phases, as I wanted to take it step-by-step and only overwrite what is necessary. For the same reason, the dependencies are probably far from complete.

I assume the problematic line in the upstream sources is in "src/CMakeModules/Bootstrap_Linux.cmake:"
Code:
if (USE_STATIC_BOOST)
        SET (Boost_USE_STATIC_LIBS ON)
endif()
FIND_PACKAGE (Boost 1.67.0 COMPONENTS system thread chrono filesystem log_setup log locale regex date_time coroutine REQUIRED)
The following package is installed on my system
Code:
$ equery uses boost
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-libs/boost-1.85.0-r1:
 U I
 - - abi_x86_32                : 32-bit (x86) libraries
 + + bzip2                     : Enable bzip2 compression support
 + + context                   : Build and install the Boost.Context (and Boost.Fiber) library and all other Boost libraries that depend on it
 - - debug                     : Build and install only the debug version of the Boost libraries. Only enable this flag if you're developing against boost.
 - - doc                       : Install the full API documentation documentation. This takes over 200MB of extra disk space.
 + + icu                       : Enable ICU (Internationalization Components for Unicode) support, using dev-libs/icu
 - - lzma                      : Support for LZMA compression algorithm
 - - mpi                       : Add MPI (Message Passing Interface) layer to the apps that support it
 + + nls                       : Build libboost_locale. This library requires compatible C library interfaces, which might not be provided by uClibc or other embedded libraries.
 - - numpy                     : Optionally build NumPy extensions when Boost.Python is enabled
 - - python                    : Add optional support/bindings for the Python language
 - - python_targets_python3_10 : Build with Python 3.10
 - - python_targets_python3_11 : Build with Python 3.11
 + + python_targets_python3_12 : Build with Python 3.12
 + + python_targets_python3_13 : Build with Python 3.13
 + + stacktrace                : Build the full Boost.Stacktrace dynamic library instead of relying on the header-only implementation
 - - tools                     : Build and install the boost tools (bcp, quickbook, inspect, wave)
 + + zlib                      : Add support for zlib compression
 - - zstd                      : Enable support for ZSTD compression

My considerations:
  • From what I understand from CMake 4.0.1 Documentation - FindBoost the version 1.67.0 is a minimal version, so 1.85.0 on my system should be good
  • Something seems to set "USE_STATIC_BOOST" and hence "Boost_USE_STATIC_LIBS" gets enabled, however there are only *.so-files on my system. Static libs would be in *.a-files. Right? So this might be the culprit. If this assumption is correct, how do I use the eclass "cmake" to correctly disable "USE_STATIC_BOOST"? How does it get enabled in the first place anyway?
  • Off-topic, but might become relevant later: The CMakeList.txt is not located in the root source directory, but in another subdirectory called "src". That's why I set S="${WORKDIR}/server-${PV}-stable/src". But I am not sure whether this is the right thing to do, because there are other directories next to "src" which seem to be relevant, too. In particular, Emerge sets the build directory to ${WORKDIR}/server-${PV}-stable/src_build now, instead of ${WORKDIR}/server-${PV}-stable_build. I wonder if this might become problematic during the install phase later, but I am not that far yet.


Last edited by nagmat84 on Wed Apr 23, 2025 6:02 am; edited 1 time in total
Back to top
View user's profile Send private message
nagmat84
Guru
Guru


Joined: 27 Mar 2007
Posts: 308

PostPosted: Tue Apr 22, 2025 2:44 pm    Post subject: Reply with quote

I was able to go some steps further. I had to add
Code:
MYCMAKEARGS=" -DUSE_STATIC_BOOST=OFF -DUSE_SYSTEM_FFMPEG=ON "
to the ebuild. The eclass cmake uses the variable MYCMAKEARGS.

The first option enables using shared libraries for boost. The upstream documentation claims that it was disabled by default but the CMakeList.txt says otherwise.

The seconds option is necessary as without it the build system tries to download sources for FFmpeg itself which is not allowed due to sandboxing. (What a mess of a build script which tries to download additional sources.) The option "USE_SYSTEM_FFMPEG" is not documented upstream, but I found it in CMakeLists.txt.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum