Compare commits

...

5 Commits

Author SHA1 Message Date
7d50897335 libcalamares: add compat and packages headers to be installed;
Use case would be customization of default modules, eg packagechooser requires compat/Variant.h and packages/Globals.h to compile in the calamares-extension repo
2024-01-01 01:27:10 +01:00
Adriaan de Groot
8a199aaaf9 [packagechooser] Split out helper for AppStreamQt
- add a CMake helper for finding variations of AppStreamQt
- adapt packagechooser and packagechooserq
- adopt a slightly more modern CMake style here
2023-12-31 01:07:08 +01:00
Adriaan de Groot
02aa49d442 CMake: drop "view" alias for module type
Allowing aliases and not using a canonical name for
them (e.g. mapping "view" to "viewmodule") is annoying
since the target name depends on which alias is passed
in to the function. Drop one of the two aliases.
2023-12-31 01:07:08 +01:00
Adriaan de Groot
f847f90842 Changes: document some recent updates and contributions 2023-12-30 20:55:16 +01:00
Adriaan de Groot
fa2b96e9cc [partition] Fix build 2023-12-30 20:55:04 +01:00
7 changed files with 101 additions and 44 deletions

View File

@@ -11,13 +11,16 @@ the history of the 3.2 series (2018-05 - 2022-08).
# 3.3.1 (unreleased)
This release contains contributions from (alphabetically by first name):
- Nobody yet!
- Adriaan de Groot
- Aleksey Samoilov
- Emir Sari
## Core ##
- No changes of note.
## Modules ##
- No changes of note.
- The *displaymanager* module configuration for `greetd` has some more
options now. (thanks Aleksey)
# 3.3.0 (2023-12-12)

View File

@@ -0,0 +1,74 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2023 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
###
#
# Finds AppStream-Qt suitable for the Qt version that is in use.
# Creates target calamares::appstreamqt to alias whatever is found.
# Sets AppStreamQt_FOUND appropriately, regardless of the underlying
# variables (e.g. might be AppStreamQt6_FOUND).
#
option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
if(TARGET calaappstream)
if(TARGET calamares::appstreamqt)
message(STATUS "AppStreamQt has already been found")
set(AppStreamQt_FOUND TRUE)
else()
message(STATUS "AppStreamQt has been searched-for and not found")
set(AppStreamQt_FOUND FALSE)
endif()
return()
endif()
if(NOT BUILD_APPSTREAM)
return()
endif()
### FIND APPSTREAM
#
# First, look for a Qt-versioned variety of the package.
# If that is not found, look for an unversioned one.
set(HAVE_APPSTREAM OFF)
find_package(AppStream${qtname})
# Not everyone renames the variables consistently
if(AppStream${qtname}_FOUND OR AppStreamQt_FOUND)
set(_appstream_name AppStream${qtname})
set(HAVE_APPSTREAM ON)
else()
find_package(AppStreamQt)
if(AppStreamQt_FOUND)
set(_appstream_name AppStreamQt)
# TODO: how to check underlying Qt version?
set(HAVE_APPSTREAM ON)
endif()
endif()
if(NOT _appstream_name)
# Placeholder name
set(_appstream_name AppStreamQt)
endif()
set(_appstream_dependency_type OPTIONAL)
if(BUILD_APPSTREAM)
set(_appstream_dependency_type REQUIRED)
endif()
set_package_properties(
${_appstream_name}
PROPERTIES
DESCRIPTION "Support for AppStream (cache) data"
URL "https://github.com/ximion/appstream"
PURPOSE "AppStream provides package data"
TYPE ${_appstream_dependency_type}
)
add_library(calaappstream INTERFACE) # Always, but might not be populated
if(HAVE_APPSTREAM)
target_compile_definitions(calaappstream INTERFACE HAVE_APPSTREAM_VERSION=${${_appstream_name}_VERSION_MAJOR})
target_link_libraries(calaappstream INTERFACE ${_appstream_name})
add_library(calamares::appstreamqt ALIAS calaappstream)
endif()
set(AppStreamQt_FOUND ${HAVE_APPSTREAM})

View File

@@ -19,7 +19,7 @@
#
# calamares_add_plugin(
# module-name
# TYPE <view|job>
# TYPE <viewmodule|job>
# EXPORT_MACRO macro-name
# SOURCES source-file...
# UI ui-file...
@@ -35,7 +35,7 @@
# [WEIGHT w]
# )
#
# Function parameters:
# Function optional parameters:
# - COMPILE_DEFINITIONS
# Definitions are set on the resulting module with a suitable
# flag (i.e. `-D`) so only state the name (optionally, also the value)
@@ -65,6 +65,9 @@
# SKIPPED_MODULES is set in the parent (i.e. caller's) scope with the
# reason why. This should rarely be a concern as AddModuleSubdirectory
# already handles skip-reasons and collects them for reporting.
#
# The target defined this way is called "calamares_<TYPE>_<module-name>",
# e.g. "calamares_viewmodule_packagechooserq".
include( CMakeParseArguments )
@@ -126,7 +129,7 @@ function( calamares_add_plugin )
set( target "calamares_${PLUGIN_TYPE}_${PLUGIN_NAME}" )
# automatic library linkage
if(PLUGIN_TYPE STREQUAL "view" OR PLUGIN_TYPE STREQUAL "viewmodule")
if(PLUGIN_TYPE STREQUAL "viewmodule")
list(APPEND PLUGIN_LINK_PRIVATE_LIBRARIES Calamares::calamaresui)
elseif(PLUGIN_TYPE STREQUAL "job")
list(APPEND PLUGIN_LINK_PRIVATE_LIBRARIES Calamares::calamares)

View File

@@ -190,7 +190,7 @@ install(
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach(subdir geoip locale modulesystem network partition utils)
foreach(subdir geoip locale modulesystem network partition utils compat packages)
file(GLOB subdir_headers "${subdir}/*.h")
install(FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir})
endforeach()

View File

@@ -23,23 +23,7 @@ endif()
### OPTIONAL AppStream support in PackageModel
#
#
option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
if(BUILD_APPSTREAM)
find_package(AppStreamQt)
set_package_properties(
AppStreamQt
PROPERTIES
DESCRIPTION "Support for AppStream (cache) data"
URL "https://github.com/ximion/appstream"
PURPOSE "AppStream provides package data"
TYPE OPTIONAL
)
if(AppStreamQt_FOUND)
add_definitions(-DHAVE_APPSTREAM_VERSION=${AppStreamQt_VERSION_MAJOR})
list(APPEND _extra_libraries AppStreamQt)
list(APPEND _extra_src ItemAppStream.cpp)
endif()
endif()
include(AppStreamHelper)
calamares_add_plugin(packagechooser
TYPE viewmodule
@@ -59,6 +43,11 @@ calamares_add_plugin(packagechooser
SHARED_LIB
)
if(AppStreamQt_FOUND)
target_link_libraries(calamares_viewmodule_packagechooser PRIVATE calamares::appstreamqt)
target_sources(calamares_viewmodule_packagechooser PRIVATE ItemAppStream.cpp)
endif()
calamares_add_test(
packagechoosertest
GUI

View File

@@ -10,9 +10,8 @@ if(NOT WITH_QML)
endif()
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core)
# Add optional libraries here
set(USER_EXTRA_LIB)
set(_extra_libraries "")
set(_extra_src "")
# include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser )
set(_packagechooser ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser)
@@ -34,23 +33,7 @@ endif()
### OPTIONAL AppStream support in PackageModel
#
#
option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
if(BUILD_APPSTREAM)
find_package(AppStreamQt)
set_package_properties(
AppStreamQt
PROPERTIES
DESCRIPTION "Support for AppStream (cache) data"
URL "https://github.com/ximion/appstream"
PURPOSE "AppStream provides package data"
TYPE OPTIONAL
)
if(AppStreamQt_FOUND)
add_definitions(-DHAVE_APPSTREAM_VERSION=${AppStreamQt_VERSION_MAJOR})
list(APPEND _extra_libraries AppStreamQt)
list(APPEND _extra_src ${_packagechooser}/ItemAppStream.cpp)
endif()
endif()
include(AppStreamHelper)
calamares_add_plugin(packagechooserq
TYPE viewmodule
@@ -67,3 +50,8 @@ calamares_add_plugin(packagechooserq
${_extra_libraries}
SHARED_LIB
)
if(AppStreamQt_FOUND)
target_link_libraries(calamares_viewmodule_packagechooserq PRIVATE calamares::appstreamqt)
target_sources(calamares_viewmodule_packagechooserq PRIVATE ${_packagechooser}/ItemAppStream.cpp)
endif()

View File

@@ -198,7 +198,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
{
if ( isPartitionFreeSpace( partition ) )
{
name = tr( "Free Space", "@title );
name = tr( "Free Space", "@title" );
}
else
{