ricochet.pro 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. # Ricochet - https://ricochet.im/
  2. # Copyright (C) 2014, John Brooks <john.brooks@dereferenced.net>
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions are
  6. # met:
  7. #
  8. # * Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # * Redistributions in binary form must reproduce the above
  12. # copyright notice, this list of conditions and the following disclaimer
  13. # in the documentation and/or other materials provided with the
  14. # distribution.
  15. #
  16. # * Neither the names of the copyright owners nor the names of its
  17. # contributors may be used to endorse or promote products derived from
  18. # this software without specific prior written permission.
  19. #
  20. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. lessThan(QT_MAJOR_VERSION,5)|lessThan(QT_MINOR_VERSION,1) {
  32. error("Qt 5.1 or greater is required. You can build your own, or get the SDK at https://qt-project.org/downloads")
  33. }
  34. TARGET = ricochet
  35. TEMPLATE = app
  36. QT += core gui network quick widgets
  37. CONFIG += c++11
  38. VERSION = 1.1.4
  39. # Use CONFIG+=no-hardened to disable compiler hardening options
  40. !CONFIG(no-hardened) {
  41. CONFIG += hardened
  42. include(hardened.pri)
  43. }
  44. # Pass DEFINES+=RICOCHET_NO_PORTABLE for a system-wide installation
  45. CONFIG(release,debug|release):DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
  46. contains(DEFINES, RICOCHET_NO_PORTABLE) {
  47. unix:!macx {
  48. target.path = /usr/bin
  49. shortcut.path = /usr/share/applications
  50. shortcut.files = src/ricochet.desktop
  51. icon.path = /usr/share/icons/hicolor/48x48/apps/
  52. icon.files = icons/ricochet.png
  53. scalable_icon.path = /usr/share/icons/hicolor/scalable/apps/
  54. scalable_icon.files = icons/ricochet.svg
  55. INSTALLS += target shortcut icon scalable_icon
  56. QMAKE_CLEAN += contrib/usr.bin.ricochet
  57. contains(DEFINES, APPARMOR) {
  58. apparmor_profile.extra = cp -f $${_PRO_FILE_PWD_}/contrib/usr.bin.ricochet-apparmor $${_PRO_FILE_PWD_}/contrib/usr.bin.ricochet
  59. apparmor_profile.files = contrib/usr.bin.ricochet
  60. QMAKE_CLEAN += contrib/usr.bin.ricochet
  61. !isEmpty(APPARMORDIR) {
  62. apparmor_profile.path = $${APPARMORDIR}/
  63. } else {
  64. apparmor_profile.path = /etc/apparmor.d/
  65. }
  66. INSTALLS += apparmor_profile
  67. }
  68. exists(tor) {
  69. message(Adding bundled Tor to installations)
  70. bundletor.path = /usr/lib/ricochet/tor/
  71. bundletor.files = tor/*
  72. INSTALLS += bundletor
  73. DEFINES += BUNDLED_TOR_PATH=\\\"/usr/lib/ricochet/tor/\\\"
  74. }
  75. }
  76. }
  77. macx {
  78. CONFIG += bundle force_debug_plist
  79. QT += macextras
  80. # Qt 5.4 introduces a bug that breaks QMAKE_INFO_PLIST when qmake has a relative path.
  81. # Work around by copying Info.plist directly.
  82. greaterThan(QT_MAJOR_VERSION,5)|greaterThan(QT_MINOR_VERSION,4) {
  83. QMAKE_INFO_PLIST = src/Info.plist
  84. } else:equals(QT_MAJOR_VERSION,5):lessThan(QT_MINOR_VERSION,4) {
  85. QMAKE_INFO_PLIST = src/Info.plist
  86. } else {
  87. CONFIG += no_plist
  88. QMAKE_POST_LINK += cp $${_PRO_FILE_PWD_}/src/Info.plist $${OUT_PWD}/$${TARGET}.app/Contents/;
  89. }
  90. exists(tor) {
  91. # Copy the entire tor/ directory, which should contain tor/tor (the binary itself)
  92. QMAKE_POST_LINK += cp -R $${_PRO_FILE_PWD_}/tor $${OUT_PWD}/$${TARGET}.app/Contents/MacOS/;
  93. }
  94. icons.files = icons/Ricochet.icns
  95. icons.path = Contents/Resources/
  96. QMAKE_BUNDLE_DATA += icons
  97. }
  98. CONFIG += debug_and_release
  99. # Create a pdb for release builds as well, to enable debugging
  100. win32-msvc2008|win32-msvc2010 {
  101. QMAKE_CXXFLAGS_RELEASE += /Zi
  102. QMAKE_LFLAGS_RELEASE += /DEBUG /OPT:REF,ICF
  103. }
  104. INCLUDEPATH += src
  105. win32|mac {
  106. # For mac, this is necessary because homebrew does not link openssl .pc to
  107. # /usr/local/lib/pkgconfig (presumably because it used to be a system
  108. # package).
  109. #
  110. # Unfortunately, it is no longer really a system package, and we really
  111. # need to know where it is.
  112. isEmpty(OPENSSLDIR): error(You must pass OPENSSLDIR=path/to/openssl to qmake on this platform)
  113. }
  114. unix {
  115. !isEmpty(OPENSSLDIR) {
  116. INCLUDEPATH += $${OPENSSLDIR}/include
  117. LIBS += -L$${OPENSSLDIR}/lib -lcrypto
  118. } else {
  119. CONFIG += link_pkgconfig
  120. PKGCONFIG += libcrypto
  121. }
  122. }
  123. win32 {
  124. INCLUDEPATH += $${OPENSSLDIR}/include
  125. win32-g++ {
  126. LIBS += -L$${OPENSSLDIR}/lib -lcrypto
  127. } else {
  128. LIBS += -L$${OPENSSLDIR}/lib -llibeay32
  129. }
  130. # required by openssl
  131. LIBS += -luser32 -lgdi32 -ladvapi32
  132. }
  133. # Exclude unneeded plugins from static builds
  134. QTPLUGIN.playlistformats = -
  135. QTPLUGIN.imageformats = -
  136. QTPLUGIN.printsupport = -
  137. QTPLUGIN.mediaservice = -
  138. # Include Linux input plugins, which are missing by default, to provide complex input support. See issue #60.
  139. unix:!macx:QTPLUGIN.platforminputcontexts = composeplatforminputcontextplugin ibusplatforminputcontextplugin
  140. DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
  141. SOURCES += src/main.cpp \
  142. src/ui/MainWindow.cpp \
  143. src/ui/ContactsModel.cpp \
  144. src/tor/TorControl.cpp \
  145. src/tor/TorControlSocket.cpp \
  146. src/tor/TorControlCommand.cpp \
  147. src/tor/ProtocolInfoCommand.cpp \
  148. src/tor/AuthenticateCommand.cpp \
  149. src/tor/SetConfCommand.cpp \
  150. src/tor/AddOnionCommand.cpp \
  151. src/utils/StringUtil.cpp \
  152. src/core/ContactsManager.cpp \
  153. src/core/ContactUser.cpp \
  154. src/tor/GetConfCommand.cpp \
  155. src/tor/HiddenService.cpp \
  156. src/utils/CryptoKey.cpp \
  157. src/utils/SecureRNG.cpp \
  158. src/core/OutgoingContactRequest.cpp \
  159. src/core/IncomingRequestManager.cpp \
  160. src/core/ContactIDValidator.cpp \
  161. src/core/UserIdentity.cpp \
  162. src/core/IdentityManager.cpp \
  163. src/core/ConversationModel.cpp \
  164. src/tor/TorProcess.cpp \
  165. src/tor/TorManager.cpp \
  166. src/tor/TorSocket.cpp \
  167. src/ui/LinkedText.cpp \
  168. src/utils/Settings.cpp \
  169. src/utils/PendingOperation.cpp \
  170. src/ui/LanguagesModel.cpp
  171. HEADERS += src/ui/MainWindow.h \
  172. src/ui/ContactsModel.h \
  173. src/tor/TorControl.h \
  174. src/tor/TorControlSocket.h \
  175. src/tor/TorControlCommand.h \
  176. src/tor/ProtocolInfoCommand.h \
  177. src/tor/AuthenticateCommand.h \
  178. src/tor/SetConfCommand.h \
  179. src/tor/AddOnionCommand.h \
  180. src/utils/StringUtil.h \
  181. src/core/ContactsManager.h \
  182. src/core/ContactUser.h \
  183. src/tor/GetConfCommand.h \
  184. src/tor/HiddenService.h \
  185. src/utils/CryptoKey.h \
  186. src/utils/SecureRNG.h \
  187. src/core/OutgoingContactRequest.h \
  188. src/core/IncomingRequestManager.h \
  189. src/core/ContactIDValidator.h \
  190. src/core/UserIdentity.h \
  191. src/core/IdentityManager.h \
  192. src/core/ConversationModel.h \
  193. src/tor/TorProcess.h \
  194. src/tor/TorProcess_p.h \
  195. src/tor/TorManager.h \
  196. src/tor/TorSocket.h \
  197. src/ui/LinkedText.h \
  198. src/utils/Settings.h \
  199. src/utils/PendingOperation.h \
  200. src/ui/LanguagesModel.h
  201. SOURCES += src/protocol/Channel.cpp \
  202. src/protocol/ControlChannel.cpp \
  203. src/protocol/Connection.cpp \
  204. src/protocol/OutboundConnector.cpp \
  205. src/protocol/AuthHiddenServiceChannel.cpp \
  206. src/protocol/ChatChannel.cpp \
  207. src/protocol/ContactRequestChannel.cpp
  208. HEADERS += src/protocol/Channel.h \
  209. src/protocol/Channel_p.h \
  210. src/protocol/ControlChannel.h \
  211. src/protocol/Connection.h \
  212. src/protocol/Connection_p.h \
  213. src/protocol/OutboundConnector.h \
  214. src/protocol/AuthHiddenServiceChannel.h \
  215. src/protocol/ChatChannel.h \
  216. src/protocol/ContactRequestChannel.h
  217. include(protobuf.pri)
  218. PROTOS += src/protocol/ControlChannel.proto \
  219. src/protocol/AuthHiddenService.proto \
  220. src/protocol/ChatChannel.proto \
  221. src/protocol/ContactRequestChannel.proto
  222. # QML
  223. RESOURCES += src/ui/qml/qml.qrc \
  224. icons/icons.qrc \
  225. sounds/sounds.qrc
  226. win32:RC_ICONS = icons/ricochet.ico
  227. OTHER_FILES += src/ui/qml/*
  228. lupdate_only {
  229. SOURCES += src/ui/qml/*.qml
  230. }
  231. # Translations
  232. TRANSLATIONS += \
  233. ricochet_en \
  234. ricochet_it \
  235. ricochet_es \
  236. ricochet_da \
  237. ricochet_pl \
  238. ricochet_pt_BR \
  239. ricochet_de \
  240. ricochet_bg \
  241. ricochet_cs \
  242. ricochet_fi \
  243. ricochet_fr \
  244. ricochet_ru \
  245. ricochet_uk \
  246. ricochet_tr \
  247. ricochet_nl_NL \
  248. ricochet_fil_PH \
  249. ricochet_sv \
  250. ricochet_he \
  251. ricochet_sl \
  252. ricochet_zh \
  253. ricochet_et_EE \
  254. ricochet_it_IT \
  255. ricochet_nb \
  256. ricochet_pt_PT \
  257. ricochet_sq \
  258. ricochet_zh_HK \
  259. ricochet_ja
  260. # Only build translations when creating the primary makefile.
  261. !build_pass: {
  262. contains(QMAKE_HOST.os,Windows):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease.exe
  263. else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
  264. for (translation, TRANSLATIONS) {
  265. system($$QMAKE_LRELEASE translation/$${translation}.ts -qm translation/$${translation}.qm)
  266. }
  267. }
  268. RESOURCES += translation/embedded.qrc