status-desktop/Makefile
Michael Bradley, Jr c03a086c01 feat: command-line option can be used to specify app's data directory
In the repo:
```
$ bin/nim_status_client --help
```
In the packaged app (macOS example):
```
$ cd /Applications/Status.app/Contents/MacOS
$ ./nim_status_client --help
```
Output:
```
Usage:

nim_status_client [OPTIONS]...

The following options are available:

 -d, --dataDir      Status Desktop data directory.
```

**Using the option**

```
$ cd ~/status-ci-builds/master/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir:"${HOME}/status-dirs/master"
```
In another terminal:
```
$ cd ~/status-ci-builds/PR-4242/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir:"${HOME}/status-dirs/PR-4242"
```

The path supplied can be relative or absolute, and can be specified with
`--dataDir:[path]`, `--dataDir=[path]`, `-d:[path]`, or `-d=[path]`.

Either `:` or `=` must be used, i.e. this *will not* work: `--dataDir [path]`
or `-d [path]`.

The name of the option follows Nim's partial case-insensitivity rules, so
`--dataDir`, `--datadir`, and `--data_dir` are all equivalent. See
[Identifier equality][ieq] in the Nim Manual.

It is possible to run the same build in multiple terminals by supplying
different `--dataDir`, i.e. this works:
```
$ cd /Applications/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir="${HOME}/temp/some1"
```
In another terminal:
```
$ cd /Applications/Status.app/Contents/MacOS
$ ./nim_status_client --dataDir="${HOME}/temp/some2"
```

**Windows**

It is recommended to use a Git Bash or MSYS2 terminal when invoking
`bin/nim_status_client.exe` (development build) or `bin/Status.exe` (production
build) on the command-line. The reason is that if the exe is invoked in a
session of `cmd.exe` it will return to the prompt immediately; the app will run
but there will be no output in the terminal. In any case, the `--dataDir`
option will take effect whether the exe is invoked in `cmd.exe` or a
recommended terminal.

For development builds, when invoking `bin/nim_status_client.exe` directly
instead of via `make run`, because e.g. you wish to use the `--dataDir` option,
it is required to first setup the `PATH` environment variable correctly. See
the `run-windows` target in this repo's Makefile for more information.

**Linux**

The `--dataDir` option may be passed to command-line invocation of a
production (AppImage) build in the same way as passing it to a development
build:

```
$ Status.AppImage --dataDir:/path/to/wherever
```

For development builds, when invoking `bin/nim_status_client` directly instead
of via `make run`, because e.g. you wish to use the `--dataDir` option, it is
required to setup the `LD_LIBRARY_PATH` environment variable correctly. See the
`run-linux` target in this repo's Makefile for more information.

---

BREAKING CHANGE: The `qt` subdir of the app's data directory is now a sibling
of the status-go directory rather than a subdir of the status-go directory:

```
Status (app data directory)
├── data (status-go directory)
├── qt
└── tmp
```

Because app settings are stored in the `qt` directory that means that existing
installations will lose their customized settings.

At app startup, it would be possible to detect `Status/data/qt` and if
`Status/qt` doesn't exist yet then copy `Status/data/qt` to
`Status/qt`. However, there was some concern that behavior could lead to
problems later on if we forget the workaround is in place. So for now that
settings preservation strategy has not been implemented, but it might be before
this commit is merged pending full team awareness/consensus.

---

Command-line option support is provided by
[nim-confutils](https://github.com/status-im/nim-confutils).

The environment variable `NIM_STATUS_CLIENT_DEV` has been removed in favor of
passing a "define" option to the Nim compiler: `-d:development` for development
builds (e.g. `make V=1`) and `-d:production` for packaged builds (e.g. `make
V=1 pkg`). Passing the correct option is handled automatically by the Makefile.

A make variable named `RELEASE` has been introduced, which defaults to
`false`. Presently the `RELEASE` variable should not be set on the command-line
nor in CI as more work needs to be done to toggle the proper compiler flags. In
the case of Status Desktop, "release vs. debug" is a concern orthogonal to
"production vs. development". At present, production builds and development
builds are all debug builds, but that will likely change in the future: we can
have non-release CI production builds and local development builds be debug
builds, while release builds in CI would be production builds with
`RELEASE=true` (the compiled executable will be fully optimized).

Prior to the changes in this PR, symmetry is somewhat lacking between
development and production (packaged) builds with respect to the concept of the
"data directory". In development builds the root of the repo effectively serves
as the `Status` directory used by production builds, e.g. on macOS
`~/Library/Application Support/Status`. Also, there's a bit of confusion as to
whether "data directory" refers to a directory for the desktop app's overall
data (including status-go data) or to the specific directory used by status-go.

This PR attempts to provide symmetry and reduce confusion:
* The term "data directory" means the directory used by the desktop app to
store multiple kinds of data and is not a reference to the subdirectory used by
status-go.
* For development builds the "data directory" defaults to `./Status/` relative
to the root of the repo.
* For production builds the "data directory" default is the same as before,
e.g. on macOS it's ` ~/Library/Application Support/Status/`.

The directory used by status-go is `Status/data/`. To be clear, that should be
referred to as the "status-go directory" and not the app's "data directory". It
would nice if we could rename it from `Status/data/` to `Status/status-go/`. We
can do that, I already checked that it works correctly; however, for existing
installations it would require that at app launch we check for the presence of
`Status/data/` and rename it to `Status/status-go`. While simple enough to do,
I was concerned that there might be edge cases where the directory rename could
cause a problem (e.g. if another copy of the app is running) so chose for now
to stick with the status-go directory being `Status/data/`.

---

**NOTES**

More work needs to be done to ensure that all data written by the app is
contained in the default or cli-specified data directory. Currently, both
development and production (packaged) builds are writing to common directories
outside of the data directory, e.g. located within `~/Library/` on
macOS. Changing that behavior seems like it will mainly involve changing
defaults related to Qt components such as the web engine. See:
https://github.com/status-im/status-desktop/issues/1141.

In general, additional refactoring could be done in the future. For
example, implementing `StatusDesktopConfig` in
`src/status/libstatus/accounts/constants.nim` (as done in this PR) works fine
for now, but better code organization is desirable.

---

Closes #2268

[ieq]: https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality
2021-04-26 09:40:58 -05:00

464 lines
15 KiB
Makefile

# Copyright (c) 2019-2020 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.
SHELL := bash # the shell used internally by Make
# used inside the included makefiles
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
.PHONY: \
all \
bottles \
check-pkg-target-linux \
check-pkg-target-macos \
check-pkg-target-windows \
clean \
deps \
fleets-remove \
fleets-update \
nim_status_client \
nim_windows_launcher \
pkg \
pkg-linux \
pkg-macos \
pkg-windows \
run \
run-linux \
run-macos \
run-windows \
set-status-macos-dev-icon \
status-go \
update
ifeq ($(NIM_PARAMS),)
# "variables.mk" was not included, so we update the submodules.
GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
.DEFAULT:
+@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
$(GIT_SUBMODULE_UPDATE); \
echo
# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself:
# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles
#
# After restarting, it will execute its original goal, so we don't have to start a child Make here
# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great?
else # "variables.mk" was included. Business as usual until the end of this file.
all: nim_status_client
# must be included after the default target
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
detected_OS := Windows
else
detected_OS := $(strip $(shell uname))
endif
ifeq ($(detected_OS),Darwin)
CFLAGS := -mmacosx-version-min=10.14
export CFLAGS
CGO_CFLAGS := -mmacosx-version-min=10.14
export CGO_CFLAGS
LIBSTATUS_EXT := dylib
MACOSX_DEPLOYMENT_TARGET := 10.14
export MACOSX_DEPLOYMENT_TARGET
PKG_TARGET := pkg-macos
RUN_TARGET := run-macos
else ifeq ($(detected_OS),Windows)
LIBSTATUS_EXT := dll
PKG_TARGET := pkg-windows
QRCODEGEN_MAKE_PARAMS := CC=gcc
RUN_TARGET := run-windows
SIGNTOOL ?= C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\signtool.exe
VCINSTALLDIR ?= C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\
export VCINSTALLDIR
else
LIBSTATUS_EXT := so
PKG_TARGET := pkg-linux
RUN_TARGET := run-linux
endif
check-pkg-target-linux:
ifneq ($(detected_OS),Linux)
$(error The pkg-linux target must be run on Linux)
endif
check-pkg-target-macos:
ifneq ($(detected_OS),Darwin)
$(error The pkg-macos target must be run on macOS)
endif
check-pkg-target-windows:
ifneq ($(detected_OS),Windows)
$(error The pkg-windows target must be run on Windows)
endif
ifeq ($(detected_OS),Darwin)
bottles/openssl:
./scripts/fetch-brew-bottle.sh openssl
bottles/pcre: bottles/openssl
./scripts/fetch-brew-bottle.sh pcre
bottles: bottles/openssl bottles/pcre
endif
deps: | deps-common bottles
update: | update-common
# Qt5 dirs (we can't indent with tabs here)
ifneq ($(detected_OS),Windows)
QT5_PCFILEDIR := $(shell pkg-config --variable=pcfiledir Qt5Core 2>/dev/null)
QT5_LIBDIR := $(shell pkg-config --variable=libdir Qt5Core 2>/dev/null)
ifeq ($(QT5_PCFILEDIR),)
ifeq ($(QTDIR),)
$(error Cannot find your Qt5 installation. Please run "$(MAKE) QTDIR=/path/to/your/Qt5/installation/prefix ...")
else
QT5_PCFILEDIR := $(QTDIR)/lib/pkgconfig
QT5_LIBDIR := $(QTDIR)/lib
# some manually installed Qt5 instances have wrong paths in their *.pc files, so we pass the right one to the linker here
ifeq ($(detected_OS),Darwin)
NIM_PARAMS += -L:"-framework Foundation -framework Security -framework IOKit -framework CoreServices"
# Fix for failures due to 'can't allocate code signature data for'
NIM_PARAMS += --passL:"-headerpad_max_install_names"
NIM_PARAMS += --passL:"-F$(QT5_LIBDIR)"
export QT5_LIBDIR
else
NIM_PARAMS += --passL:"-L$(QT5_LIBDIR)"
endif
endif
endif
DOTHERSIDE := vendor/DOtherSide/build/lib/libDOtherSideStatic.a
DOTHERSIDE_CMAKE_PARAMS := -DENABLE_DYNAMIC_LIBS=OFF -DENABLE_STATIC_LIBS=ON
DOTHERSIDE_BUILD_CMD := $(MAKE) VERBOSE=$(V) $(HANDLE_OUTPUT)
# order matters here, due to "-Wl,-as-needed"
NIM_PARAMS += --passL:"$(DOTHERSIDE)" --passL:"$(shell PKG_CONFIG_PATH="$(QT5_PCFILEDIR)" pkg-config --libs Qt5Core Qt5Qml Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Widgets Qt5Svg)"
else
DOTHERSIDE := vendor/DOtherSide/build/lib/Release/DOtherSide.dll
DOTHERSIDE_CMAKE_PARAMS := -T"v141" -A x64 -DENABLE_DYNAMIC_LIBS=ON -DENABLE_STATIC_LIBS=OFF
DOTHERSIDE_BUILD_CMD := cmake --build . --config Release $(HANDLE_OUTPUT)
NIM_PARAMS += -L:$(DOTHERSIDE)
NIM_EXTRA_PARAMS := --passL:"-lsetupapi -lhid"
endif
RELEASE ?= false
ifeq ($(RELEASE),false)
# We need `-d:debug` to get Nim's default stack traces
NIM_PARAMS += -d:debug
# Enable debugging symbols in DOtherSide, in case we need GDB backtraces
CFLAGS += -g
CXXFLAGS += -g
else
# Additional optimization flags for release builds are not included at present;
# adding them will involve refactoring config.nims in the root of this repo
NIM_PARAMS += -d:release
endif
NIM_PARAMS += --outdir:./bin
$(DOTHERSIDE): | deps
echo -e $(BUILD_MSG) "DOtherSide"
+ cd vendor/DOtherSide && \
mkdir -p build && \
cd build && \
rm -f CMakeCache.txt && \
cmake $(DOTHERSIDE_CMAKE_PARAMS)\
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_DOCS=OFF \
-DENABLE_TESTS=OFF \
.. $(HANDLE_OUTPUT) && \
$(DOTHERSIDE_BUILD_CMD)
STATUSGO := vendor/status-go/build/bin/libstatus.$(LIBSTATUS_EXT)
STATUSGO_LIBDIR := $(shell pwd)/$(shell dirname "$(STATUSGO)")
export STATUSGO_LIBDIR
status-go: $(STATUSGO)
$(STATUSGO): | deps
echo -e $(BUILD_MSG) "status-go"
+ cd vendor/status-go && \
$(MAKE) statusgo-shared-library $(HANDLE_OUTPUT)
QRCODEGEN := vendor/QR-Code-generator/c/libqrcodegen.a
$(QRCODEGEN): | deps
echo -e $(BUILD_MSG) "QR-Code-generator"
+ cd vendor/QR-Code-generator/c && \
$(MAKE) $(QRCODEGEN_MAKE_PARAMS)
FLEETS := fleets.json
$(FLEETS):
echo -e $(BUILD_MSG) "Getting latest $(FLEETS)"
curl -s https://fleets.status.im/ \
| jq --indent 4 --sort-keys . \
> $(FLEETS)
fleets-remove:
rm -f $(FLEETS)
fleets-update: fleets-remove $(FLEETS)
rcc:
echo -e $(BUILD_MSG) "resources.rcc"
rm -f ./resources.rcc
rm -f ./ui/resources.qrc
./ui/generate-rcc.sh
rcc -binary ui/resources.qrc -o ./resources.rcc
# default token is a free-tier token with limited capabilities and usage
# limits; our docs should include directions for community contributor to setup
# their own Infura account and token instead of relying on this default token
# during development
DEFAULT_TOKEN := 220a1abb4b6943a093c35d0ce4fb0732
INFURA_TOKEN ?= $(DEFAULT_TOKEN)
NIM_PARAMS += -d:INFURA_TOKEN:"$(INFURA_TOKEN)"
RESOURCES_LAYOUT := -d:development
nim_status_client: NIM_PARAMS += $(RESOURCES_LAYOUT)
nim_status_client: | $(DOTHERSIDE) $(STATUSGO) $(QRCODEGEN) $(FLEETS) rcc deps
echo -e $(BUILD_MSG) "$@" && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) --passL:"-L$(STATUSGO_LIBDIR)" --passL:"-lstatus" $(NIM_EXTRA_PARAMS) --passL:"$(QRCODEGEN)" --passL:"-lm" src/nim_status_client.nim && \
[[ $$? = 0 ]] && \
(([[ $(detected_OS) = Darwin ]] && \
install_name_tool -change \
libstatus.dylib \
@rpath/libstatus.dylib \
bin/nim_status_client) || true)
_APPIMAGE_TOOL := appimagetool-x86_64.AppImage
APPIMAGE_TOOL := tmp/linux/tools/$(_APPIMAGE_TOOL)
$(APPIMAGE_TOOL):
echo -e "\e[92mFetching:\e[39m appimagetool"
rm -rf tmp/linux
mkdir -p tmp/linux/tools
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/$(_APPIMAGE_TOOL)
mv $(_APPIMAGE_TOOL) tmp/linux/tools/
chmod +x $(APPIMAGE_TOOL)
STATUS_CLIENT_APPIMAGE ?= pkg/NimStatusClient-x86_64.AppImage
$(STATUS_CLIENT_APPIMAGE): override RESOURCES_LAYOUT := -d:production
$(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop
rm -rf pkg/*.AppImage
rm -rf tmp/linux/dist
mkdir -p tmp/linux/dist/usr/bin
mkdir -p tmp/linux/dist/usr/lib
mkdir -p tmp/linux/dist/usr/qml
# General Files
cp bin/nim_status_client tmp/linux/dist/usr/bin
cp nim-status.desktop tmp/linux/dist/.
cp status.svg tmp/linux/dist/status.svg
cp status.svg tmp/linux/dist/usr/.
cp -R resources.rcc tmp/linux/dist/usr/.
cp -R $(FLEETS) tmp/linux/dist/usr/.
mkdir -p tmp/linux/dist/usr/i18n
cp ui/i18n/* tmp/linux/dist/usr/i18n
# Libraries
cp -r /usr/lib/x86_64-linux-gnu/nss tmp/linux/dist/usr/lib/
cp vendor/status-go/build/bin/libstatus.so tmp/linux/dist/usr/lib/
echo -e $(BUILD_MSG) "AppImage"
linuxdeployqt tmp/linux/dist/nim-status.desktop -no-copy-copyright-files -qmldir=ui -qmlimport=$(QTDIR)/qml -bundle-non-qt-libs
rm tmp/linux/dist/AppRun
cp AppRun tmp/linux/dist/.
mkdir -p pkg
$(APPIMAGE_TOOL) tmp/linux/dist $(STATUS_CLIENT_APPIMAGE)
DMG_TOOL := node_modules/.bin/create-dmg
$(DMG_TOOL):
echo -e "\e[92mInstalling:\e[39m create-dmg"
npm i
MACOS_OUTER_BUNDLE := tmp/macos/dist/Status.app
MACOS_INNER_BUNDLE := $(MACOS_OUTER_BUNDLE)/Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app
STATUS_CLIENT_DMG ?= pkg/Status.dmg
$(STATUS_CLIENT_DMG): override RESOURCES_LAYOUT := -d:production
$(STATUS_CLIENT_DMG): nim_status_client $(DMG_TOOL)
rm -rf tmp/macos pkg/*.dmg
mkdir -p $(MACOS_OUTER_BUNDLE)/Contents/MacOS
mkdir -p $(MACOS_OUTER_BUNDLE)/Contents/Resources
cp Info.plist $(MACOS_OUTER_BUNDLE)/Contents/
cp bin/nim_status_client $(MACOS_OUTER_BUNDLE)/Contents/MacOS/
cp nim_status_client.sh $(MACOS_OUTER_BUNDLE)/Contents/MacOS/
chmod +x $(MACOS_OUTER_BUNDLE)/Contents/MacOS/nim_status_client.sh
cp status.icns $(MACOS_OUTER_BUNDLE)/Contents/Resources/
cp status.svg $(MACOS_OUTER_BUNDLE)/Contents/
cp -R resources.rcc $(MACOS_OUTER_BUNDLE)/Contents/
cp -R $(FLEETS) $(MACOS_OUTER_BUNDLE)/Contents/
mkdir -p $(MACOS_OUTER_BUNDLE)/Contents/i18n
cp ui/i18n/* $(MACOS_OUTER_BUNDLE)/Contents/i18n
echo -e $(BUILD_MSG) "app"
macdeployqt \
$(MACOS_OUTER_BUNDLE) \
-executable=$(MACOS_OUTER_BUNDLE)/Contents/MacOS/nim_status_client \
-qmldir=ui
cp Info.runner.plist $(MACOS_OUTER_BUNDLE)/Contents/Info.plist
macdeployqt \
$(MACOS_INNER_BUNDLE) \
-executable=$(MACOS_INNER_BUNDLE)/Contents/MacOS/QtWebEngineProcess
# if MACOS_CODESIGN_IDENT is not set then the outer and inner .app
# bundles are not signed
ifdef MACOS_CODESIGN_IDENT
scripts/sign-macos-pkg.sh $(MACOS_OUTER_BUNDLE) $(MACOS_CODESIGN_IDENT)
scripts/sign-macos-pkg.sh $(MACOS_INNER_BUNDLE) $(MACOS_CODESIGN_IDENT) \
--entitlements QtWebEngineProcess.plist
endif
echo -e $(BUILD_MSG) "dmg"
mkdir -p pkg
# See: https://github.com/sindresorhus/create-dmg#dmg-icon
# GraphicsMagick must be installed for create-dmg to make the custom
# DMG icon based on app icon, but should otherwise work without it
npx create-dmg \
--identity="NOBODY" \
$(MACOS_OUTER_BUNDLE) \
pkg || true
# We ignore failure above create-dmg can't skip signing.
# To work around that a dummy identity - 'NOBODY' - is specified.
# This causes non-zero exit code despite DMG being created.
# It is just not signed, hence the next command should succeed.
mv "`ls pkg/*.dmg`" $(STATUS_CLIENT_DMG)
ifdef MACOS_CODESIGN_IDENT
scripts/sign-macos-pkg.sh $(STATUS_CLIENT_DMG) $(MACOS_CODESIGN_IDENT)
endif
NIM_WINDOWS_PREBUILT_DLLS ?= tmp/windows/tools/pcre.dll
$(NIM_WINDOWS_PREBUILT_DLLS):
echo -e "\e[92mFetching:\e[39m prebuilt DLLs from nim-lang.org"
rm -rf tmp/windows
mkdir -p tmp/windows/tools
cd tmp/windows/tools && \
wget https://nim-lang.org/download/dlls.zip && \
unzip dlls.zip
nim_windows_launcher: | deps
$(ENV_SCRIPT) nim c -d:debug --outdir:./bin --passL:"-static-libgcc -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive" src/nim_windows_launcher.nim
ifneq ($(WINDOWS_CODESIGN_TIMESTAMP_URL),)
WINDOWS_CODESIGN_TIMESTAMP_PARAM := -t $(WINDOWS_CODESIGN_TIMESTAMP_URL)
endif
STATUS_CLIENT_ZIP ?= pkg/Status.zip
$(STATUS_CLIENT_ZIP): override RESOURCES_LAYOUT := -d:production
$(STATUS_CLIENT_ZIP): nim_status_client nim_windows_launcher $(NIM_WINDOWS_PREBUILT_DLLS)
rm -rf pkg/*.zip
rm -rf tmp/windows/dist
mkdir -p tmp/windows/dist/Status/bin
mkdir -p tmp/windows/dist/Status/resources
mkdir -p tmp/windows/dist/Status/vendor
cp windows-install.txt tmp/windows/dist/Status/INSTALL.txt
unix2dos -k tmp/windows/dist/Status/INSTALL.txt
# cp LICENSE tmp/windows/dist/Status/LICENSE.txt
# unix2dos -k tmp/windows/dist/Status/LICENSE.txt
cp status.ico tmp/windows/dist/Status/resources/
cp status.svg tmp/windows/dist/Status/resources/
cp resources.rcc tmp/windows/dist/Status/resources/
cp $(FLEETS) tmp/windows/dist/Status/resources/
cp bin/nim_status_client.exe tmp/windows/dist/Status/bin/Status.exe
cp bin/nim_windows_launcher.exe tmp/windows/dist/Status/Status.exe
rcedit \
tmp/windows/dist/Status/bin/Status.exe \
--set-icon tmp/windows/dist/Status/resources/status.ico
rcedit \
tmp/windows/dist/Status/Status.exe \
--set-icon tmp/windows/dist/Status/resources/status.ico
cp $(DOTHERSIDE) tmp/windows/dist/Status/bin/
cp $(STATUSGO) tmp/windows/dist/Status/bin/
cp tmp/windows/tools/*.dll tmp/windows/dist/Status/bin/
mkdir -p tmp/windows/dist/Status/resources/i18n
cp ui/i18n/* tmp/windows/dist/Status/resources/i18n
cp "$(shell which libgcc_s_seh-1.dll)" tmp/windows/dist/Status/bin/
cp "$(shell which libwinpthread-1.dll)" tmp/windows/dist/Status/bin/
echo -e $(BUILD_MSG) "deployable folder"
windeployqt \
--compiler-runtime \
--qmldir ui \
--release \
tmp/windows/dist/Status/bin/DOtherSide.dll
mv tmp/windows/dist/Status/bin/vc_redist.x64.exe tmp/windows/dist/Status/vendor/
# if WINDOWS_CODESIGN_PFX_PATH is not set then DLLs, EXEs are not signed
ifdef WINDOWS_CODESIGN_PFX_PATH
find ./tmp/windows/dist/Status -type f \
| /usr/bin/egrep -i "\.(dll|exe)$$" \
| /usr/bin/xargs -I{} /usr/bin/bash -c \
"if ! '$(SIGNTOOL)' verify -pa {} &>/dev/null; then echo {}; fi" \
| /usr/bin/xargs -I{} "$(SIGNTOOL)" \
sign \
-v \
-f $(WINDOWS_CODESIGN_PFX_PATH) \
$(WINDOWS_CODESIGN_TIMESTAMP_PARAM) \
{}
endif
echo -e $(BUILD_MSG) "zip"
mkdir -p pkg
cd tmp/windows/dist/Status && \
7z a ../../../../$(STATUS_CLIENT_ZIP) *
pkg: $(PKG_TARGET)
pkg-linux: check-pkg-target-linux $(STATUS_CLIENT_APPIMAGE)
pkg-macos: check-pkg-target-macos $(STATUS_CLIENT_DMG)
pkg-windows: check-pkg-target-windows $(STATUS_CLIENT_ZIP)
clean: | clean-common
rm -rf bin/* node_modules bottles/* pkg/* tmp/* $(STATUSGO)
+ $(MAKE) -C vendor/DOtherSide/build --no-print-directory clean
run: rcc $(RUN_TARGET)
ICON_TOOL := node_modules/.bin/fileicon
$(ICON_TOOL):
echo -e "\e[92mInstalling:\e[39m fileicon"
npm i
# Currently not in use: https://github.com/status-im/status-desktop/pull/1858
# STATUS_PORT ?= 30306
set-status-macos-dev-icon: $(ICON_TOOL)
npx fileicon set bin/nim_status_client status-dev.icns
run-linux:
echo -e "\e[92mRunning:\e[39m bin/nim_status_client"
LD_LIBRARY_PATH="$(QT5_LIBDIR)":"$(STATUSGO_LIBDIR)" \
./bin/nim_status_client
run-macos: set-status-macos-dev-icon
echo -e "\e[92mRunning:\e[39m bin/nim_status_client"
./bin/nim_status_client
run-windows: $(NIM_WINDOWS_PREBUILT_DLLS)
echo -e "\e[92mRunning:\e[39m bin/nim_status_client.exe"
PATH="$(shell pwd)"/"$(shell dirname "$(DOTHERSIDE)")":"$(STATUSGO_LIBDIR)":"$(shell pwd)"/"$(shell dirname "$(NIM_WINDOWS_PREBUILT_DLLS)")":"$(PATH)" \
./bin/nim_status_client.exe
endif # "variables.mk" was not included