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

build: enable building for Fedora40 and Ubuntu 24.04 #1815

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

pstorz
Copy link
Member

@pstorz pstorz commented May 14, 2024

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

This was linked to issues May 16, 2024
@pstorz pstorz force-pushed the dev/pstorz/master/fedora40-ubuntu24 branch from 1957240 to 6f21422 Compare May 21, 2024 09:58
@pstorz pstorz requested a review from arogge May 21, 2024 11:27
@pstorz pstorz force-pushed the dev/pstorz/master/fedora40-ubuntu24 branch from 354bf6b to 197747a Compare May 22, 2024 17:28
Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

I have a few remarks concerning the CPM integration. But overall this looks good!

Comment on lines +33 to +34
set(FETCHCONTENT_FULLY_DISCONNECTED CACHE STRING "OFF" FORCE)
mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED)
Copy link
Member

Choose a reason for hiding this comment

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

I guess it is sufficient to simply check if this was set and then force local packages only.
That way everybody can build in fully disconnected mode, but things will fail in a nice way (i.e. find_package() should throw an error).
In the meantime we will need to manually turn off FETCHCONTENT_FULLY_DISCONNECTED for some of the package managers.

Suggested change
set(FETCHCONTENT_FULLY_DISCONNECTED CACHE STRING "OFF" FORCE)
mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED)
if(FETCHCONTENT_FULLY_DISCONNECTED)
message(WARNING "Detected FETCHCONTENT_FULLY_DISCONNECTED.")
message(WARNING "As this will break fetching, only local packages will be considered!")
set(CPM_LOCAL_PACKAGES_ONLY ON)
endif()

However, this section should be moved after the include(CPM) so that CMake already knows CPM_LOCAL_PACKAGES_ONLY is an option.

As an alternative we could also decide to just fail with a bad combination of parameters:

if(FETCHCONTENT_FULLY_DISCONNECTED AND NOT CPM_LOCAL_PACKAGES_ONLY)
  message(FATAL_ERROR "When FETCHCONTENT_FULLY_DISCONNECTED is enabled, CPM_LOCAL_PACKAGES_ONLY must be enabled, too!")
endif()

Comment on lines 31 to 33
if(PS)
set(PSCMD ${PS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(PS)
set(PSCMD ${PS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(PSCMD ${PS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

(adapt following lines, too)

@@ -24,12 +24,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set(AWK ${GAWK})
endif()

# ps is required for systemtests
Copy link
Member

Choose a reason for hiding this comment

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

this should go before find_program(PS).


find_program(PS ps)
find_program(PS ps REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

If ps is optional for the build, but required for systemtests, it may make sense to leave this file as is, but to add find_program(PS ps REQUIRED) to systemtests/CMakeLists.txt so it is only actually required to build systemtests (i.e. not when building MacOS or a ULC).
CMake will not search the program twice, so it won't hurt.

@@ -38,7 +40,8 @@ include(BareosVersionFromGit)
include(BareosExtractVersionInfo)
include(BareosGetDistInfo)
include(RemoveNDebugFlag)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CPM)
Copy link
Member

Choose a reason for hiding this comment

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

we might want to unconditionally enable CPM_USE_LOCAL_PACKAGES so find_package() is always tried first:

Suggested change
include(CPM)
include(CPM)
set(CPM_USE_LOCAL_PACKAGES ON)

@@ -35,7 +35,7 @@ if(USE_SYSTEM_FMT)
set_target_properties(fmt::fmt PROPERTIES IMPORTED_GLOBAL TRUE)
message(STATUS "Using system fmt ${fmt_VERSION}")
else()
add_subdirectory(fmt EXCLUDE_FROM_ALL)
CPMAddPackage("gh:fmtlib/fmt#10.2.1")
Copy link
Member

Choose a reason for hiding this comment

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

You can add the package like this:

Suggested change
CPMAddPackage("gh:fmtlib/fmt#10.2.1")
CPMAddPackage(
NAME fmt
VERSION 6.2.1
GITUB_REPOSITORY "fmtlib/fmt"
GIT_TAG "10.2.1"
EXCLUDE_FROM_ALL
)

This will select any local version 6.2.1 or newer, if it exists, and will download and use 10.2.1 from GitHub otherwise.

However, the CMake-code for that should be in the toplevel CMakeLists.txt. Considering the amount of things we're probably going to add here, it may make sense to create an individual file and include() that from the toplevel CMakeLists.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build for Ubuntu 24.04 LTS Build for Fedora 40
2 participants