dnf5 app, dnf5 plugins: Do not export private symbols
This commit is contained in:
parent
263486469b
commit
62b8503e52
|
@ -2,6 +2,9 @@ if(NOT WITH_DNF5_PLUGINS)
|
|||
return()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
|
||||
include_directories("${PROJECT_SOURCE_DIR}/dnf5/include/")
|
||||
# These plugins use symbols from dnf5 program, hence the symbold are undefined
|
||||
# at link time and cannot pass "-z defs" linker check. Disable the check.
|
||||
|
|
|
@ -5,6 +5,8 @@ endif()
|
|||
|
||||
find_package(Threads)
|
||||
|
||||
add_definitions(-DDNF_BUILD_APPLICATION)
|
||||
|
||||
# set gettext domain for translations
|
||||
set(GETTEXT_DOMAIN dnf5)
|
||||
add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\")
|
||||
|
@ -28,6 +30,8 @@ add_executable(dnf5 ${DNF5_SOURCES})
|
|||
|
||||
# Enable symbol export. Needed for loadable modules (dnf5 plugins).
|
||||
set_property(TARGET dnf5 PROPERTY ENABLE_EXPORTS 1)
|
||||
# Export only explicitly marked symbols.
|
||||
set_target_properties(dnf5 PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
target_link_libraries(dnf5 PRIVATE common libdnf5 libdnf5-cli Threads::Threads)
|
||||
install(TARGETS dnf5 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
|
|
@ -20,6 +20,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
|||
#ifndef DNF5_CONTEXT_HPP
|
||||
#define DNF5_CONTEXT_HPP
|
||||
|
||||
#include "defs.h"
|
||||
#include "version.hpp"
|
||||
|
||||
#include <libdnf5-cli/argument_parser.hpp>
|
||||
|
@ -44,7 +45,7 @@ namespace dnf5 {
|
|||
|
||||
class Plugins;
|
||||
|
||||
class Context : public libdnf5::cli::session::Session {
|
||||
class DNF_API Context : public libdnf5::cli::session::Session {
|
||||
public:
|
||||
enum class LoadAvailableRepos { NONE, ENABLED, ALL };
|
||||
|
||||
|
@ -164,12 +165,12 @@ public:
|
|||
const std::vector<std::pair<std::vector<std::string>, bool>> & get_libdnf_plugins_enablement() const;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
class DNF_LOCAL Impl;
|
||||
std::unique_ptr<Impl> p_impl;
|
||||
};
|
||||
|
||||
|
||||
class Command : public libdnf5::cli::session::Command {
|
||||
class DNF_API Command : public libdnf5::cli::session::Command {
|
||||
public:
|
||||
using libdnf5::cli::session::Command::Command;
|
||||
|
||||
|
@ -183,7 +184,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class RpmTransCB : public libdnf5::rpm::TransactionCallbacks {
|
||||
class DNF_API RpmTransCB : public libdnf5::rpm::TransactionCallbacks {
|
||||
public:
|
||||
RpmTransCB(Context & context);
|
||||
~RpmTransCB();
|
||||
|
@ -252,25 +253,25 @@ public:
|
|||
void verify_stop([[maybe_unused]] uint64_t total) override;
|
||||
|
||||
private:
|
||||
void new_progress_bar(int64_t total, const std::string & descr);
|
||||
DNF_LOCAL void new_progress_bar(int64_t total, const std::string & descr);
|
||||
|
||||
static bool is_time_to_print();
|
||||
DNF_LOCAL static bool is_time_to_print();
|
||||
|
||||
static std::chrono::time_point<std::chrono::steady_clock> prev_print_time;
|
||||
DNF_LOCAL static std::chrono::time_point<std::chrono::steady_clock> prev_print_time;
|
||||
|
||||
libdnf5::cli::progressbar::MultiProgressBar multi_progress_bar;
|
||||
libdnf5::cli::progressbar::DownloadProgressBar * active_progress_bar{nullptr};
|
||||
Context & context;
|
||||
};
|
||||
|
||||
void run_transaction(libdnf5::rpm::Transaction & transaction);
|
||||
DNF_API void run_transaction(libdnf5::rpm::Transaction & transaction);
|
||||
|
||||
/// Returns the names of matching packages and paths of matching package file names and directories.
|
||||
/// If `nevra_for_same_name` is true, it returns a full nevra for packages with the same name.
|
||||
/// Only files whose names match `file_name_regex` are returned.
|
||||
/// NOTE: This function is intended to be used only for autocompletion purposes as the argument parser's
|
||||
/// complete hook argument. It does the base setup and repos loading inside.
|
||||
std::vector<std::string> match_specs(
|
||||
DNF_API std::vector<std::string> match_specs(
|
||||
Context & ctx,
|
||||
const std::string & pattern,
|
||||
bool installed,
|
||||
|
|
|
@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
|||
#define DNF5_PLUGIN_IPLUGIN_HPP
|
||||
|
||||
#include "context.hpp"
|
||||
#include "defs.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
@ -35,7 +36,7 @@ struct PluginVersion {
|
|||
};
|
||||
|
||||
/// @brief A base class for implementing DNF5 plugins that provide one or more commands to users.
|
||||
class IPlugin {
|
||||
class DNF_PLUGIN_API IPlugin {
|
||||
public:
|
||||
explicit IPlugin(Context & context);
|
||||
virtual ~IPlugin();
|
||||
|
@ -83,21 +84,22 @@ extern "C" {
|
|||
|
||||
/// Returns the version of the API required by the plugin.
|
||||
/// Same result as IPlugin::get_api_version(), but can be called without creating an IPlugin instance.
|
||||
dnf5::PluginAPIVersion dnf5_plugin_get_api_version(void);
|
||||
DNF_PLUGIN_API dnf5::PluginAPIVersion dnf5_plugin_get_api_version(void);
|
||||
|
||||
/// Returns the name of the plugin. It can be called at any time.
|
||||
/// Same result as IPlugin::get_name(), but can be called without creating an IPlugin instance.
|
||||
const char * dnf5_plugin_get_name(void);
|
||||
DNF_PLUGIN_API const char * dnf5_plugin_get_name(void);
|
||||
|
||||
/// Returns the version of the plugin. It can be called at any time.
|
||||
/// Same result as IPlugin::get_version(), but can be called without creating an IPlugin instance.
|
||||
dnf5::PluginVersion dnf5_plugin_get_version(void);
|
||||
DNF_PLUGIN_API dnf5::PluginVersion dnf5_plugin_get_version(void);
|
||||
|
||||
/// Creates a new plugin instance. Passes the API version to the plugin.
|
||||
dnf5::IPlugin * dnf5_plugin_new_instance(dnf5::ApplicationVersion application_version, dnf5::Context & context);
|
||||
DNF_PLUGIN_API dnf5::IPlugin * dnf5_plugin_new_instance(
|
||||
dnf5::ApplicationVersion application_version, dnf5::Context & context);
|
||||
|
||||
/// Deletes plugin instance.
|
||||
void dnf5_plugin_delete_instance(dnf5::IPlugin * plugin_instance);
|
||||
DNF_PLUGIN_API void dnf5_plugin_delete_instance(dnf5::IPlugin * plugin_instance);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,13 +20,14 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
|||
#ifndef DNF5_OFFLINE_HPP
|
||||
#define DNF5_OFFLINE_HPP
|
||||
|
||||
#include <dnf5/context.hpp>
|
||||
#include "context.hpp"
|
||||
#include "defs.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace dnf5::offline {
|
||||
|
||||
void log_status(
|
||||
DNF_API void log_status(
|
||||
Context & context,
|
||||
const std::string & message,
|
||||
const std::string & message_id,
|
||||
|
|
|
@ -20,27 +20,29 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
|||
#ifndef DNF5_COMMANDS_SHARED_OPTIONS_HPP
|
||||
#define DNF5_COMMANDS_SHARED_OPTIONS_HPP
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <dnf5/context.hpp>
|
||||
#include <libdnf5-cli/session.hpp>
|
||||
#include <libdnf5/utils/bgettext/bgettext-lib.h>
|
||||
|
||||
namespace dnf5 {
|
||||
|
||||
class AllowErasingOption : public libdnf5::cli::session::BoolOption {
|
||||
class DNF_API AllowErasingOption : public libdnf5::cli::session::BoolOption {
|
||||
public:
|
||||
explicit AllowErasingOption(libdnf5::cli::session::Command & command);
|
||||
~AllowErasingOption();
|
||||
};
|
||||
|
||||
|
||||
class SkipBrokenOption : public libdnf5::cli::session::BoolOption {
|
||||
class DNF_API SkipBrokenOption : public libdnf5::cli::session::BoolOption {
|
||||
public:
|
||||
explicit SkipBrokenOption(dnf5::Command & command);
|
||||
~SkipBrokenOption();
|
||||
};
|
||||
|
||||
|
||||
class SkipUnavailableOption : public libdnf5::cli::session::BoolOption {
|
||||
class DNF_API SkipUnavailableOption : public libdnf5::cli::session::BoolOption {
|
||||
public:
|
||||
explicit SkipUnavailableOption(dnf5::Command & command);
|
||||
~SkipUnavailableOption();
|
||||
|
@ -49,25 +51,25 @@ public:
|
|||
|
||||
/// Create two options (`--allow-downgrade` and `--no-allow-downgrade`) for a command provided as an argument command.
|
||||
/// The values are stored in the `allow_downgrade` configuration option
|
||||
void create_allow_downgrade_options(dnf5::Command & command);
|
||||
DNF_API void create_allow_downgrade_options(dnf5::Command & command);
|
||||
|
||||
/// Create the `--destdir` option for a command provided as an argument.
|
||||
/// The values are stored in the `destdir` configuration option
|
||||
void create_destdir_option(dnf5::Command & command);
|
||||
DNF_API void create_destdir_option(dnf5::Command & command);
|
||||
|
||||
/// Create the `--downloadonly` option for a command provided as an argument.
|
||||
/// The values are stored in the `downloadonly` configuration option
|
||||
void create_downloadonly_option(dnf5::Command & command);
|
||||
DNF_API void create_downloadonly_option(dnf5::Command & command);
|
||||
|
||||
/// Create the `--store` option for a command provided as an argument.
|
||||
/// The value is stored in Context::transaction_store_path.
|
||||
void create_store_option(dnf5::Command & command);
|
||||
DNF_API void create_store_option(dnf5::Command & command);
|
||||
|
||||
/// Create the `--offline` option for a command provided as an argument.
|
||||
void create_offline_option(dnf5::Command & command);
|
||||
DNF_API void create_offline_option(dnf5::Command & command);
|
||||
|
||||
/// Create the `--json` option for a command provided as an argument.
|
||||
void create_json_option(dnf5::Command & command);
|
||||
DNF_API void create_json_option(dnf5::Command & command);
|
||||
|
||||
} // namespace dnf5
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
|||
#ifndef DNF5_CONFIG_HPP
|
||||
#define DNF5_CONFIG_HPP
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace dnf5 {
|
||||
|
@ -49,11 +51,11 @@ static constexpr PluginAPIVersion PLUGIN_API_VERSION{.major = 2, .minor = 0};
|
|||
|
||||
/// @return Application version
|
||||
/// @since 5.0
|
||||
ApplicationVersion get_application_version() noexcept;
|
||||
DNF_API ApplicationVersion get_application_version() noexcept;
|
||||
|
||||
/// @return API version implemented in the application
|
||||
/// @since 5.0
|
||||
PluginAPIVersion get_plugin_api_version() noexcept;
|
||||
DNF_API PluginAPIVersion get_plugin_api_version() noexcept;
|
||||
|
||||
} // namespace dnf5
|
||||
|
||||
|
|
Loading…
Reference in New Issue