| 1 |
Build from Source Code |
| 2 |
====================== |
| 3 |
|
| 4 |
This page describes how to build the application from source code. |
| 5 |
|
| 6 |
Get the Source Code |
| 7 |
------------------- |
| 8 |
|
| 9 |
Download the source code from git repository |
| 10 |
|
| 11 |
:: |
| 12 |
|
| 13 |
git clone https://github.com/hluk/CopyQ.git |
| 14 |
|
| 15 |
or download the latest source code archive from: |
| 16 |
|
| 17 |
- `latest release <https://github.com/hluk/CopyQ/releases>`__ |
| 18 |
- `master branch in zip <https://github.com/hluk/CopyQ/archive/master.zip>`__ |
| 19 |
- `master branch in tar.gz <https://github.com/hluk/CopyQ/archive/master.tar.gz>`__ |
| 20 |
|
| 21 |
Install Dependencies |
| 22 |
-------------------- |
| 23 |
|
| 24 |
The build requires: |
| 25 |
|
| 26 |
- `CMake <https://cmake.org/download/>`__ |
| 27 |
- `Qt <https://download.qt.io/archive/qt/>`__ |
| 28 |
|
| 29 |
Optional (enabled by default, disable with the corresponding CMake option): |
| 30 |
|
| 31 |
- `QCA <https://invent.kde.org/libraries/qca>`__ (Qt Cryptographic |
| 32 |
Architecture) -- for tab encryption (``-DWITH_QCA_ENCRYPTION=OFF`` to |
| 33 |
disable) |
| 34 |
- `QtKeychain <https://github.com/frankosterfeld/qtkeychain>`__ -- for storing |
| 35 |
encryption passwords in the system keychain (``-DWITH_KEYCHAIN=OFF`` to |
| 36 |
disable) |
| 37 |
- `KNotifications <https://invent.kde.org/frameworks/knotifications>`__ -- for |
| 38 |
native notifications (``-DWITH_NATIVE_NOTIFICATIONS=OFF`` to disable) |
| 39 |
- `miniaudio <https://miniaud.io/>`__ -- for built-in audio playback |
| 40 |
(``playSound``) (``-DWITH_AUDIO=OFF`` to disable) |
| 41 |
|
| 42 |
Conditional: |
| 43 |
|
| 44 |
- `ECM <https://invent.kde.org/frameworks/extra-cmake-modules>`__ (Extra CMake |
| 45 |
Modules) -- for native notifications and Wayland clipboard support |
| 46 |
- `KGuiAddons <https://invent.kde.org/frameworks/kguiaddons>`__ -- for Wayland |
| 47 |
clipboard support |
| 48 |
|
| 49 |
Debian / Ubuntu |
| 50 |
^^^^^^^^^^^^^^^ |
| 51 |
On **Debian** and derivatives you can install all build dependencies with: |
| 52 |
|
| 53 |
:: |
| 54 |
|
| 55 |
sudo apt install \ |
| 56 |
build-essential \ |
| 57 |
cmake \ |
| 58 |
extra-cmake-modules \ |
| 59 |
git \ |
| 60 |
libminiaudio-dev \ |
| 61 |
libqt6svg6-dev \ |
| 62 |
libqt6waylandclient6 \ |
| 63 |
libwayland-dev \ |
| 64 |
libxfixes-dev \ |
| 65 |
libxtst-dev \ |
| 66 |
qt6-base-dev \ |
| 67 |
qt6-base-dev-tools \ |
| 68 |
qt6-base-private-dev \ |
| 69 |
qt6-declarative-dev \ |
| 70 |
qt6-l10n-tools \ |
| 71 |
qt6-tools-dev \ |
| 72 |
qt6-tools-dev-tools \ |
| 73 |
qt6-wayland \ |
| 74 |
qt6-wayland-dev \ |
| 75 |
qt6-wayland-dev-tools \ |
| 76 |
qtkeychain-qt6-dev |
| 77 |
|
| 78 |
|
| 79 |
On Debian 13 or Ubuntu 24.04 and newer, you can also install `QCA` packages: |
| 80 |
|
| 81 |
:: |
| 82 |
|
| 83 |
sudo apt install \ |
| 84 |
libqca-qt6-dev \ |
| 85 |
libqca-qt6-plugins |
| 86 |
|
| 87 |
On Debian 13 or Ubuntu 25.04 and newer, you can also install `KF6` packages: |
| 88 |
|
| 89 |
:: |
| 90 |
|
| 91 |
sudo apt install \ |
| 92 |
libkf6guiaddons-dev |
| 93 |
|
| 94 |
Fedora / RHEL / CentOS |
| 95 |
^^^^^^^^^^^^^^^^^^^^^^ |
| 96 |
On **Fedora** and derivatives you can install all build dependencies with: |
| 97 |
|
| 98 |
:: |
| 99 |
|
| 100 |
sudo dnf install \ |
| 101 |
cmake \ |
| 102 |
extra-cmake-modules \ |
| 103 |
gcc-c++ \ |
| 104 |
git \ |
| 105 |
kf6-kguiaddons-devel \ |
| 106 |
kf6-knotifications-devel \ |
| 107 |
kf6-kstatusnotifieritem-devel \ |
| 108 |
libSM-devel \ |
| 109 |
libXfixes-devel \ |
| 110 |
libXtst-devel \ |
| 111 |
miniaudio-devel \ |
| 112 |
qca-qt6-devel \ |
| 113 |
qca-qt6-ossl \ |
| 114 |
qt6-qtbase-devel \ |
| 115 |
qt6-qtbase-private-devel \ |
| 116 |
qt6-qtdeclarative-devel \ |
| 117 |
qt6-qtsvg-devel \ |
| 118 |
qt6-qttools-devel \ |
| 119 |
qt6-qtwayland-devel \ |
| 120 |
qtkeychain-qt6-devel \ |
| 121 |
wayland-devel |
| 122 |
|
| 123 |
miniaudio (manual download) |
| 124 |
^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 125 |
|
| 126 |
If your distribution does not package miniaudio, you can download the single |
| 127 |
header file directly into the source tree: |
| 128 |
|
| 129 |
:: |
| 130 |
|
| 131 |
curl -sSLo src/miniaudio.h \ |
| 132 |
https://raw.githubusercontent.com/mackron/miniaudio/0.11.25/miniaudio.h |
| 133 |
|
| 134 |
CMake will find it automatically. Alternatively, place ``miniaudio.h`` anywhere |
| 135 |
and point CMake to it with ``-DMINIAUDIO_INCLUDE_DIR=/path/to/dir``. |
| 136 |
|
| 137 |
|
| 138 |
Build and Install |
| 139 |
----------------- |
| 140 |
|
| 141 |
Build the source code with CMake and make or using an IDE of your choice (see next sections). |
| 142 |
|
| 143 |
:: |
| 144 |
|
| 145 |
cd CopyQ |
| 146 |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local . |
| 147 |
# Add -DWITH_QCA_ENCRYPTION=OFF for systems without `QCA` packages |
| 148 |
# Add -DWITH_NATIVE_NOTIFICATIONS=OFF for systems without `KF6` packages |
| 149 |
# Add -DWITH_AUDIO=OFF to disable audio support (or if miniaudio is unavailable) |
| 150 |
make |
| 151 |
make install |
| 152 |
|
| 153 |
Qt Creator |
| 154 |
---------- |
| 155 |
|
| 156 |
Qt Creator is IDE focused on developing C++ and Qt applications. |
| 157 |
|
| 158 |
Install Qt Creator from your package manager or by selecting it from Qt installation utility. |
| 159 |
|
| 160 |
Set up Qt library, C++ compiler and CMake. |
| 161 |
|
| 162 |
.. seealso:: |
| 163 |
|
| 164 |
`Adding Kits <https://doc.qt.io/qtcreator/creator-targets.html>`__ |
| 165 |
|
| 166 |
Open file ``CMakeLists.txt`` in repository clone to create new project. |
| 167 |
|
| 168 |
Visual Studio |
| 169 |
------------- |
| 170 |
|
| 171 |
You need to install Qt for given version Visual Studio. |
| 172 |
|
| 173 |
In Visual Studio 2017 open folder containing repository clone using "File - Open - Folder". |
| 174 |
|
| 175 |
In older versions, create solution manually by running ``cmake -G "Visual Studio 14 2015 Win64" .`` |
| 176 |
(select appropriate generator name) in repository clone folder. |
| 177 |
|
| 178 |
.. seealso:: |
| 179 |
|
| 180 |
`CMake - Visual Studio Generators <https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators>`__ |
| 181 |
|
| 182 |
Building and Packaging for OS X |
| 183 |
------------------------------- |
| 184 |
|
| 185 |
On OS X, required Qt 6 libraries and utilities can be easily installed with `Homebrew <https://brew.sh/>`__. |
| 186 |
|
| 187 |
:: |
| 188 |
|
| 189 |
cd CopyQ |
| 190 |
git -C "utils/github/homebrew" init . |
| 191 |
git -C "utils/github/homebrew" add . |
| 192 |
git -C "utils/github/homebrew" commit -m "Initial" |
| 193 |
|
| 194 |
brew tap copyq/kde utils/github/homebrew/ |
| 195 |
# if the above "brew tap" command produces an error like |
| 196 |
# "Error: Tap copyq/kde remote mismatch" |
| 197 |
# then run |
| 198 |
# brew untap --force copyq/kde |
| 199 |
# and re-run the above "brew tap" command |
| 200 |
|
| 201 |
brew install qt6 copyq/kde/kf6-knotifications copyq/kde/kf6-kstatusnotifieritem |
| 202 |
|
| 203 |
Build with the following commands: |
| 204 |
|
| 205 |
:: |
| 206 |
|
| 207 |
cmake -DCMAKE_PREFIX_PATH="$(brew --prefix qt6)" . |
| 208 |
cmake --build . |
| 209 |
cpack |
| 210 |
|
| 211 |
This will produce a self-contained application bundle ``CopyQ.app`` |
| 212 |
which can then be copied or moved into ``/Applications``. |
| 213 |
|
| 214 |
NOTE: If no Items are shown when you start CopyQ and open "File - Preferences - Items", |
| 215 |
then your CopyQ plugins were not installed. If you saw warning messages like this:: |
| 216 |
|
| 217 |
/<some_path>/install_name_tool: warning: changes being made to the file will invalidate the code signature in: /<some_path>/CopyQ/_CPack_Packages/Darwin/DragNDrop/copyq-6.2.0-Darwin/CopyQ.app/Contents/Plugins/<some_file>.dylib |
| 218 |
|
| 219 |
when you ran the above "cpack" command, then you have likely encountered |
| 220 |
`issue 1903 <https://github.com/hluk/CopyQ/issues/1903/>`__. |
| 221 |
|
| 222 |
In that case you may codesign the CopyQ app again using the following command, |
| 223 |
un-install the previous CopyQ app, and install the re-signed ``CopyQ.app``:: |
| 224 |
|
| 225 |
codesign --force --deep --sign - $PWD/_CPack_Packages/Darwin/DragNDrop/copyq-*-Darwin/CopyQ.app |