[libcalamares] Make symbols visible as needed

This commit is contained in:
Adriaan de Groot 2024-02-19 01:21:25 +01:00
parent 84b0262f31
commit a6591fcaf3
21 changed files with 76 additions and 59 deletions

View File

@ -12,6 +12,8 @@
#ifndef CALAMARES_GLOBALSTORAGE_H
#define CALAMARES_GLOBALSTORAGE_H
#include "DllMacro.h"
#include <QMutex>
#include <QObject>
#include <QString>
@ -42,7 +44,7 @@ namespace Calamares
* has locking. All methods are thread-safe, use data() to make a snapshot
* copy for use outside of the thread-safe API.
*/
class GlobalStorage : public QObject
class DLLEXPORT GlobalStorage : public QObject
{
Q_OBJECT
public:

View File

@ -11,6 +11,7 @@
#ifndef CALAMARES_PROCESSJOB_H
#define CALAMARES_PROCESSJOB_H
#include "DllMacro.h"
#include "Job.h"
#include <chrono>
@ -22,7 +23,7 @@ class ProcessJob : public Job
{
Q_OBJECT
public:
explicit ProcessJob( const QString& command,
explicit DLLEXPORT ProcessJob( const QString& command,
const QString& workingPath,
bool runInChroot = false,
std::chrono::seconds secondsTimeout = std::chrono::seconds( 30 ),

View File

@ -39,7 +39,7 @@ class Private;
class RegionalZonesModel;
class ZonesModel;
class TimeZoneData : public QObject, TranslatableString
class DLLEXPORT TimeZoneData : public QObject, TranslatableString
{
friend class RegionalZonesModel;
friend class ZonesModel;

View File

@ -36,7 +36,7 @@ namespace Locale
* - `ca@valencia` is the Catalan dialect spoken in Valencia.
* There is no Qt code for it.
*/
class Translation : public QObject
class DLLEXPORT Translation : public QObject
{
Q_OBJECT

View File

@ -11,6 +11,7 @@
#ifndef MODULESYSTEM_DESCRIPTOR_H
#define MODULESYSTEM_DESCRIPTOR_H
#include "DllMacro.h"
#include "utils/NamedEnum.h"
#include <QVariantMap>
@ -30,7 +31,7 @@ enum class Type
Job,
View
};
const NamedEnumTable< Type >& typeNames();
DLLEXPORT const NamedEnumTable< Type >& typeNames();
/**
* @brief The Interface enum represents the interface through which the module
@ -43,8 +44,7 @@ enum class Interface
Python, // Jobs only
Process, // Deprecated interface
};
const NamedEnumTable< Interface >& interfaceNames();
DLLEXPORT const NamedEnumTable< Interface >& interfaceNames();
/**
* @brief Description of a module (obtained from module.desc)
@ -53,7 +53,7 @@ const NamedEnumTable< Interface >& interfaceNames();
* determine which specialized fields make sense for a given
* descriptor (e.g. a Python module has no shared-library path).
*/
class Descriptor
class DLLEXPORT Descriptor
{
public:
///@brief an invalid, and empty, descriptor

View File

@ -11,6 +11,8 @@
#ifndef MODULESYSTEM_INSTANCEKEY_H
#define MODULESYSTEM_INSTANCEKEY_H
#include "DllMacro.h"
#include <QDebug>
#include <QList>
#include <QString>
@ -36,7 +38,7 @@ namespace ModuleSystem
* This is supported by the *instances* configuration entry
* in `settings.conf`.
*/
class InstanceKey
class DLLEXPORT InstanceKey
{
public:
/// @brief Create an instance key from explicit module and id.
@ -102,7 +104,7 @@ private:
using InstanceKeyList = QList< InstanceKey >;
QDebug& operator<<( QDebug& s, const Calamares::ModuleSystem::InstanceKey& i );
DLLEXPORT QDebug& operator<<( QDebug& s, const Calamares::ModuleSystem::InstanceKey& i );
inline QDebug&
operator<<( QDebug&& s, const Calamares::ModuleSystem::InstanceKey& i )
{

View File

@ -10,6 +10,7 @@
#ifndef CALAMARES_REQUIREMENTSCHECKER_H
#define CALAMARES_REQUIREMENTSCHECKER_H
#include "DllMacro.h"
#include "modulesystem/Requirement.h"
#include <QFutureWatcher>
@ -28,7 +29,7 @@ class RequirementsModel;
* Asynchronously checks the requirements for each module, and
* emits progress signals as appropriate.
*/
class RequirementsChecker : public QObject
class DLLEXPORT RequirementsChecker : public QObject
{
Q_OBJECT

View File

@ -84,7 +84,7 @@ struct RequestStatus
State status;
};
QDebug& operator<<( QDebug& s, const RequestStatus& e );
DLLEXPORT QDebug& operator<<( QDebug& s, const RequestStatus& e );
class DLLEXPORT Manager : public QObject
{

View File

@ -10,6 +10,7 @@
#ifndef LIBCALAMARES_PACKAGES_GLOBALS_H
#define LIBCALAMARES_PACKAGES_GLOBALS_H
#include "DllMacro.h"
#include "GlobalStorage.h"
#include "modulesystem/InstanceKey.h"
@ -24,7 +25,7 @@ namespace Packages
*
* Returns @c true if anything was changed, @c false otherwise.
*/
bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
DLLEXPORT bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
const Calamares::ModuleSystem::InstanceKey& module,
const QVariantList& installPackages,
const QVariantList& tryInstallPackages );
@ -33,7 +34,7 @@ bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
* This replaces previously-set install-packages lists. Use this with
* plain lists of package names. It does not support try-install.
*/
bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
DLLEXPORT bool setGSPackageAdditions( Calamares::GlobalStorage* gs,
const Calamares::ModuleSystem::InstanceKey& module,
const QStringList& installPackages );
// void setGSPackageRemovals( const Calamares::ModuleSystem::InstanceKey& key, const QVariantList& removePackages );

View File

@ -16,6 +16,8 @@
#ifndef PARTITION_KPMMANAGER_H
#define PARTITION_KPMMANAGER_H
#include "DllMacro.h"
#include <memory>
class CoreBackend;
@ -39,7 +41,7 @@ class InternalManager;
* environment variable KPMCORE_BACKEND. Setting it to
* "dummy" will load the dummy plugin instead.
*/
class KPMManager
class DLLEXPORT KPMManager
{
public:
KPMManager();

View File

@ -19,6 +19,8 @@
#ifndef PARTITION_PARTITIONITERATOR_H
#define PARTITION_PARTITIONITERATOR_H
#include "DllMacro.h"
class Device;
class Partition;
class PartitionTable;
@ -39,7 +41,7 @@ namespace Partition
*
* A nullptr is valid, for an empty iterator.
*/
class PartitionIterator
class DLLEXPORT PartitionIterator
{
public:
::Partition* operator*() const;

View File

@ -18,6 +18,8 @@
#ifndef PARTITION_PARTITIONQUERY_H
#define PARTITION_PARTITIONQUERY_H
#include "DllMacro.h"
#include <QList>
#include <functional>
@ -36,23 +38,23 @@ using ::Partition;
using ::PartitionTable;
/** @brief Get partition table */
const PartitionTable* getPartitionTable( const Partition* partition );
DLLEXPORT const PartitionTable* getPartitionTable( const Partition* partition );
/** @brief Is this a free-space area? */
bool isPartitionFreeSpace( const Partition* );
DLLEXPORT bool isPartitionFreeSpace( const Partition* );
/** @brief Is this partition newly-to-be-created?
*
* Returns true if the partition is planned to be created by the installer as
* opposed to already existing on the disk.
*/
bool isPartitionNew( const Partition* );
DLLEXPORT bool isPartitionNew( const Partition* );
/**
* Iterates on all devices and return the first partition which is (already)
* mounted on @p mountPoint.
*/
Partition* findPartitionByCurrentMountPoint( const QList< Device* >& devices, const QString& mountPoint );
DLLEXPORT Partition* findPartitionByCurrentMountPoint( const QList< Device* >& devices, const QString& mountPoint );
// TODO: add this distinction
// Partition* findPartitionByIntendedMountPoint( const QList< Device* >& devices, const QString& mountPoint );
@ -61,13 +63,13 @@ Partition* findPartitionByCurrentMountPoint( const QList< Device* >& devices, co
* Iterates on all devices and partitions and returns a pointer to the Partition object
* for the given path, or nullptr if a Partition for the given path cannot be found.
*/
Partition* findPartitionByPath( const QList< Device* >& devices, const QString& path );
DLLEXPORT Partition* findPartitionByPath( const QList< Device* >& devices, const QString& path );
/**
* Iterates on all devices and partitions and returns a list of pointers to the Partition
* objects that satisfy the conditions defined in the criterion function.
*/
QList< Partition* > findPartitions( const QList< Device* >& devices,
DLLEXPORT QList< Partition* > findPartitions( const QList< Device* >& devices,
std::function< bool( Partition* ) > criterionFunction );
} // namespace Partition
} // namespace Calamares

View File

@ -12,6 +12,7 @@
#ifndef PARTITION_PARTITIONSIZE_H
#define PARTITION_PARTITIONSIZE_H
#include "DllMacro.h"
#include "utils/NamedSuffix.h"
#include "utils/Units.h"
@ -42,7 +43,7 @@ enum class SizeUnit
* the available drive space are on). This class handles parsing
* of such strings from the config file.
*/
class PartitionSize : public NamedSuffix< SizeUnit, SizeUnit::None >
class DLLEXPORT PartitionSize : public NamedSuffix< SizeUnit, SizeUnit::None >
{
public:
PartitionSize()

View File

@ -12,7 +12,7 @@
// This file is called PythonJob.h because it would otherwise
// clashwith the Job.h in libcalamares proper.
#include "DllMacro.h"
#include "Job.h"
#include <QVariantMap>
@ -27,7 +27,7 @@ class Job : public ::Calamares::Job
{
Q_OBJECT
public:
explicit Job( const QString& scriptFile,
explicit DLLEXPORT Job( const QString& scriptFile,
const QString& workingPath,
const QVariantMap& moduleConfiguration = QVariantMap(),
QObject* parent = nullptr );
@ -48,7 +48,7 @@ public:
* a character literal or something that lives longer than the
* job. Pass in @c nullptr to switch off pre-run code.
*/
static void setInjectedPreScript( const char* script );
static DLLEXPORT void setInjectedPreScript( const char* script );
/** @brief Accessors for JobProxy */
QString workingPath() const;

View File

@ -11,6 +11,7 @@
#ifndef UTILS_COMMANDLIST_H
#define UTILS_COMMANDLIST_H
#include "DllMacro.h"
#include "Job.h"
#include <QStringList>
@ -58,13 +59,13 @@ struct CommandLine
* This will normally be a Calamares::String::DictionaryExpander
* instance, which handles the ROOT and USER variables.
*/
CommandLine expand( KMacroExpanderBase& expander ) const;
DLLEXPORT CommandLine expand( KMacroExpanderBase& expander ) const;
/** @brief As above, with a default macro-expander.
*
* The default macro-expander assumes RunInHost (e.g. ROOT will
* expand to the RootMountPoint set in Global Storage).
*/
CommandLine expand() const;
DLLEXPORT CommandLine expand() const;
private:
QString first;
@ -82,7 +83,7 @@ using CommandList_t = QList< CommandLine >;
* Documentation for the format of commands can be found in
* `shellprocess.conf`.
*/
class CommandList : protected CommandList_t
class DLLEXPORT CommandList : protected CommandList_t
{
public:
/** @brief empty command-list with timeout to apply to entries. */

View File

@ -228,7 +228,7 @@ struct RedactedCommand
const QStringList& list;
};
QDebug& operator<<( QDebug& s, const RedactedCommand& l );
DLLEXPORT QDebug& operator<<( QDebug& s, const RedactedCommand& l );
/** @brief When logging "private" identifiers, keep them consistent but private
*
@ -236,7 +236,7 @@ QDebug& operator<<( QDebug& s, const RedactedCommand& l );
* it logs the same way, but without revealing the actual contents.
* This can be applied to user names, UUIDs, etc.
*/
struct RedactedName
struct DLLEXPORT RedactedName
{
RedactedName( const char* context, const QString& s );
RedactedName( const QString& context, const QString& s );
@ -312,7 +312,7 @@ operator<<( QDebug& s, const DebugListT< T >& c )
}
/** @brief supporting method for outputting a DebugMap */
QString toString( const QVariant& v );
DLLEXPORT QString toString( const QVariant& v );
/** @brief output operator for DebugMap */
inline QDebug&

View File

@ -12,6 +12,8 @@
#ifndef UTILS_PLUGINFACTORY_H
#define UTILS_PLUGINFACTORY_H
#include "DllMacro.h"
#include <QObject>
#define CalamaresPluginFactory_iid "io.calamares.PluginFactory"
@ -24,7 +26,7 @@
* the function is set when registerPlugin() is called in a subclass.
*
*/
class CalamaresPluginFactory : public QObject
class DLLEXPORT CalamaresPluginFactory : public QObject
{
Q_OBJECT
public:
@ -104,9 +106,7 @@ protected:
{ \
pluginRegistrations; \
} \
name::~name() \
{ \
}
name::~name() {}
Q_DECLARE_INTERFACE( CalamaresPluginFactory, CalamaresPluginFactory_iid )

View File

@ -81,7 +81,7 @@ DLLEXPORT void setAllowLocalTranslation( bool allow );
* but use the macros `CALAMARES_RETRANSLATE*` to set things up
* in code -- the macros will connect to the Retranslator's signals.
*/
class Retranslator : public QObject
class DLLEXPORT Retranslator : public QObject
{
Q_OBJECT
public:

View File

@ -40,7 +40,7 @@ namespace String
* `expand()` implicitly clears the errors before starting
* a new expansion, as well.
*/
class DictionaryExpander : public KWordMacroExpander
class DLLEXPORT DictionaryExpander : public KWordMacroExpander
{
public:
DictionaryExpander();

View File

@ -60,7 +60,7 @@ public:
* @param timeout Timeout passed to the process runner, for explaining
* error code -4 (timeout).
*/
static Calamares::JobResult
static DLLEXPORT Calamares::JobResult
explainProcess( int errorCode, const QString& command, const QString& output, std::chrono::seconds timeout );
/// @brief Convenience wrapper for explainProcess()

View File

@ -21,6 +21,8 @@
#ifndef UTILS_YAML_H
#define UTILS_YAML_H
#include "DllMacro.h"
#include <QStringList>
#include <QVariant>
#include <QVariantList>
@ -48,7 +50,7 @@ class QFileInfo;
#endif
/// @brief Appends all the elements of @p node to the string list @p v
void operator>>( const ::YAML::Node& node, QStringList& v );
DLLEXPORT void operator>>( const ::YAML::Node& node, QStringList& v );
namespace Calamares
{
@ -60,29 +62,29 @@ namespace YAML
* malformed in some way, returns an empty map and sets
* @p *ok to false. Otherwise sets @p *ok to true.
*/
QVariantMap load( const QString& filename, bool* ok = nullptr );
DLLEXPORT QVariantMap load( const QString& filename, bool* ok = nullptr );
/** Convenience overload. */
QVariantMap load( const QFileInfo&, bool* ok = nullptr );
DLLEXPORT QVariantMap load( const QFileInfo&, bool* ok = nullptr );
QVariant toVariant( const ::YAML::Node& node );
QVariant scalarToVariant( const ::YAML::Node& scalarNode );
QVariantList sequenceToVariant( const ::YAML::Node& sequenceNode );
QVariantMap mapToVariant( const ::YAML::Node& mapNode );
DLLEXPORT QVariant toVariant( const ::YAML::Node& node );
DLLEXPORT QVariant scalarToVariant( const ::YAML::Node& scalarNode );
DLLEXPORT QVariantList sequenceToVariant( const ::YAML::Node& sequenceNode );
DLLEXPORT QVariantMap mapToVariant( const ::YAML::Node& mapNode );
/// @brief Returns all the elements of @p listNode in a StringList
QStringList toStringList( const ::YAML::Node& listNode );
DLLEXPORT QStringList toStringList( const ::YAML::Node& listNode );
/// @brief Save a @p map to @p filename as YAML
bool save( const QString& filename, const QVariantMap& map );
DLLEXPORT bool save( const QString& filename, const QVariantMap& map );
/**
* Given an exception from the YAML parser library, explain
* what is going on in terms of the data passed to the parser.
* Uses @p label when labeling the data source (e.g. "netinstall data")
*/
void explainException( const ::YAML::Exception& e, const QByteArray& data, const char* label );
void explainException( const ::YAML::Exception& e, const QByteArray& data, const QString& label );
void explainException( const ::YAML::Exception& e, const QByteArray& data );
DLLEXPORT void explainException( const ::YAML::Exception& e, const QByteArray& data, const char* label );
DLLEXPORT void explainException( const ::YAML::Exception& e, const QByteArray& data, const QString& label );
DLLEXPORT void explainException( const ::YAML::Exception& e, const QByteArray& data );
} // namespace YAML
} // namespace Calamares