2020-05-25 02:18:37 +00:00
|
|
|
if defined(release):
|
|
|
|
switch("nimcache", "nimcache/release/$projectName")
|
|
|
|
else:
|
|
|
|
switch("nimcache", "nimcache/debug/$projectName")
|
|
|
|
|
|
|
|
--threads:on
|
|
|
|
--opt:speed # -O3
|
|
|
|
--debugger:native # passes "-g" to the C compiler
|
|
|
|
--define:ssl # needed by the stdlib to enable SSL procedures
|
|
|
|
|
|
|
|
if defined(macosx):
|
2020-07-08 16:48:13 +00:00
|
|
|
--dynlibOverrideAll # don't use dlopen()
|
2020-05-25 02:18:37 +00:00
|
|
|
--tlsEmulation:off
|
2020-06-04 20:56:44 +00:00
|
|
|
switch("passL", "-lstdc++")
|
2020-08-06 21:14:06 +00:00
|
|
|
# DYLD_LIBRARY_PATH doesn't always work when running/packaging so set rpath
|
|
|
|
# note: macdeployqt rewrites rpath appropriately when building the .app bundle
|
2020-05-25 02:18:37 +00:00
|
|
|
switch("passL", "-rpath" & " " & getEnv("QT5_LIBDIR"))
|
2020-08-06 21:14:06 +00:00
|
|
|
switch("passL", "-rpath" & " " & getEnv("STATUSGO_LIBDIR"))
|
2022-07-21 11:29:18 +00:00
|
|
|
switch("passL", "-rpath" & " " & getEnv("STATUSKEYCARDGO_LIBDIR"))
|
2024-10-11 15:14:21 +00:00
|
|
|
switch("passL", "-rpath" & " " & getEnv("STATUSQ_INSTALL_PATH") & "/StatusQ")
|
2020-08-06 21:14:06 +00:00
|
|
|
# statically link these libs
|
2021-09-24 16:12:47 +00:00
|
|
|
switch("passL", "bottles/openssl@1.1/lib/libcrypto.a")
|
|
|
|
switch("passL", "bottles/openssl@1.1/lib/libssl.a")
|
2020-06-04 20:56:44 +00:00
|
|
|
switch("passL", "bottles/pcre/lib/libpcre.a")
|
2020-05-25 02:18:37 +00:00
|
|
|
# https://code.videolan.org/videolan/VLCKit/-/issues/232
|
|
|
|
switch("passL", "-Wl,-no_compact_unwind")
|
2024-09-03 16:27:16 +00:00
|
|
|
# set the minimum supported macOS version to 12.0
|
|
|
|
switch("passC", "-mmacosx-version-min=12.0")
|
2020-07-08 16:48:13 +00:00
|
|
|
elif defined(windows):
|
build: implement packaging steps for the Windows build
Implement a `pkg-windows` target that ultimately results in `Status.zip` being
written to `pkg/`.
Note: this commit does not introduce code signing for the Windows build since
that piece is still a work in progress.
`pkg-windows` creates a portable folder in `tmp/windows/dist` with the help of
[`windeployqt`][windeployqt], which copies the needed portions of Qt into the
folder.
Since DLL resolution is relatively inflexible, a launcher `Status.exe` is
created at the top-level of the folder; the launcher opens `bin/Status.exe`
while adding the portable folder's `bin/` to the `PATH`, allowing
`bin/Status.exe` to resolve the DLLs in that folder.
A few additional tools need to be installed (e.g. with [scoop][scoop]) and
availble in `PATH`:
* 7-zip
* dos2unix (provides unix2dos)
* findutils
* go
* rcedit
* wget
The above list builds on the tools list in PR #521, and the other requirements
and instructions in that PR's description still apply.
**Why not build an installer?**
When starting work on packaging for the Windows build, my initial plan was to
build an installer, and for that purpose I researched the [WiX Toolset][wix],
the [Qt Installer Framework][qtif], and some other options.
I found that building an installer is a bit complex. I then recalled, from
personal experience, that [Cmder][cmder]'s [Mini download][mini] is
installer-less. You simply unzip the download and place the `cmder_mini` folder
wherever you prefer. Such an approach was also recommended to me in one of the
Nim language's community chats.
In addition to being simpler, the installer-less approach also gives
installation of Status Desktop a lower profile than an installer-application
would since nothing is written to the Windows registry, added to the *Add or
remove programs* list, etc. I think that's a benefit given the privacy-security
focus of Status, but others may feel differently so please provide feedback on
this point!
[windeployqt]: https://doc.qt.io/qt-5/windows-deployment.html
[scoop]: https://scoop.sh/
[wix]: https://wixtoolset.org/
[qtif]: https://doc.qt.io/qtinstallerframework/index.html
[cmder]: https://cmder.net/
[mini]: https://github.com/cmderdev/cmder/releases/download/v1.3.15/cmder_mini.zip
2020-07-15 22:45:56 +00:00
|
|
|
--app:gui
|
2020-07-08 16:48:13 +00:00
|
|
|
--tlsEmulation:off
|
|
|
|
switch("passL", "-Wl,-as-needed")
|
2020-05-25 02:18:37 +00:00
|
|
|
else:
|
2020-07-08 16:48:13 +00:00
|
|
|
--dynlibOverrideAll # don't use dlopen()
|
2020-06-04 20:56:44 +00:00
|
|
|
# dynamically link these libs, since we're opting out of dlopen()
|
2024-05-23 22:20:07 +00:00
|
|
|
switch("passL", "-l:libcrypto.so.1.1")
|
|
|
|
switch("passL", "-l:libssl.so.1.1")
|
2020-06-04 20:56:44 +00:00
|
|
|
# don't link libraries we're not actually using
|
|
|
|
switch("passL", "-Wl,-as-needed")
|
2020-05-25 02:18:37 +00:00
|
|
|
|
2024-09-20 18:50:36 +00:00
|
|
|
--define:chronicles_line_numbers # useful when debugging=
|
|
|
|
switch("define", "chronicles_timestamps=RfcUtcTime")
|
2020-06-23 00:50:51 +00:00
|
|
|
|
|
|
|
# The compiler doth protest too much, methinks, about all these cases where it can't
|
|
|
|
# do its (N)RVO pass: https://github.com/nim-lang/RFCs/issues/230
|
|
|
|
switch("warning", "ObservableStores:off")
|
|
|
|
|
|
|
|
# Too many false positives for "Warning: method has lock level <unknown>, but another method has 0 [LockLevel]"
|
|
|
|
switch("warning", "LockLevel:off")
|
2023-03-15 09:03:30 +00:00
|
|
|
|
|
|
|
# No clean workaround for this warning in certain cases, waiting for better upstream support
|
|
|
|
switch("warning", "BareExcept:off")
|
2024-03-20 20:08:43 +00:00
|
|
|
|
|
|
|
# We assume this as a good practive to keep `else` even if all cases are covered
|
|
|
|
switch("warning", "UnreachableElse:off")
|
|
|
|
|
|
|
|
# Those are popular to miss in our app, and quickly make build log unreadable, so we want to prevent them
|
|
|
|
switch("warningAsError", "UseBase:on")
|
|
|
|
switch("warningAsError", "UnusedImport:on")
|
2024-04-03 13:47:41 +00:00
|
|
|
switch("warningAsError", "Deprecated:on")
|
|
|
|
switch("warningAsError", "HoleEnumConv:on")
|
2024-03-20 20:08:43 +00:00
|
|
|
|
|
|
|
# Workaround for https://github.com/nim-lang/Nim/issues/23429
|
|
|
|
switch("warning", "UseBase:on")
|
|
|
|
switch("warning", "UnusedImport:on")
|
2024-04-03 13:47:41 +00:00
|
|
|
switch("warning", "Deprecated:on")
|
|
|
|
switch("warning", "HoleEnumConv:on")
|
2024-06-28 07:12:04 +00:00
|
|
|
|
|
|
|
when defined(gcc):
|
|
|
|
# GCC 14+ introduces new strictness for pointer types that not all nim libraries are compatible with
|
|
|
|
switch("passc", "-Wno-error=incompatible-pointer-types")
|
|
|
|
|