2020-05-14 10:58:08 -04:00
# 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.
2020-05-06 17:26:32 -04:00
2020-05-14 10:58:08 -04:00
SHELL := bash # the shell used internally by Make
2020-05-06 17:43:20 -04:00
2020-05-14 10:58:08 -04:00
# 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 \
2020-06-04 15:56:44 -05:00
bottles \
2022-11-08 10:11:53 +01:00
check -qt -dir \
2020-07-15 17:45:56 -05:00
check -pkg -target -linux \
check -pkg -target -macos \
check -pkg -target -windows \
2020-05-14 10:58:08 -04:00
clean \
2022-07-14 18:58:20 +02:00
compile -translations \
2020-05-14 10:58:08 -04:00
deps \
2020-12-10 10:56:32 -06:00
fleets -remove \
fleets -update \
2020-05-25 04:18:37 +02:00
nim_status_client \
2020-07-15 17:45:56 -05:00
nim_windows_launcher \
2020-06-04 15:56:44 -05:00
pkg \
pkg -linux \
pkg -macos \
2020-07-08 11:48:13 -05:00
pkg -windows \
2020-05-25 04:18:37 +02:00
run \
2020-08-06 16:14:06 -05:00
run -linux \
run -macos \
2020-07-08 11:48:13 -05:00
run -windows \
2022-12-19 19:55:40 +01:00
tests -nim -linux \
2020-06-18 18:44:22 +02:00
status -go \
2022-07-21 13:29:18 +02:00
status -keycard -go \
2022-11-21 17:23:32 +01:00
statusq -sanity -checker \
run -statusq -sanity -checker \
2020-05-14 10:58:08 -04:00
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.
2020-05-25 04:18:37 +02:00
all : nim_status_client
2020-05-14 10:58:08 -04:00
# must be included after the default target
-include $( BUILD_SYSTEM_DIR ) /makefiles/targets.mk
2020-05-25 04:18:37 +02:00
ifeq ( $( OS ) ,Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
detected_OS := Windows
else
detected_OS := $( strip $( shell uname))
endif
2020-07-08 11:48:13 -05:00
ifeq ( $( detected_OS ) ,Darwin)
2021-04-13 14:03:19 -05:00
CFLAGS := -mmacosx-version-min= 10.14
2020-06-04 15:56:44 -05:00
export CFLAGS
2021-04-13 14:03:19 -05:00
CGO_CFLAGS := -mmacosx-version-min= 10.14
2020-07-08 11:48:13 -05:00
export CGO_CFLAGS
2020-08-06 16:14:06 -05:00
LIBSTATUS_EXT := dylib
2021-04-13 14:03:19 -05:00
MACOSX_DEPLOYMENT_TARGET := 10.14
2020-07-08 11:48:13 -05:00
export MACOSX_DEPLOYMENT_TARGET
PKG_TARGET := pkg-macos
2020-08-06 16:14:06 -05:00
RUN_TARGET := run-macos
2020-07-08 11:48:13 -05:00
else ifeq ( $( detected_OS ) ,Windows)
2020-08-06 16:14:06 -05:00
LIBSTATUS_EXT := dll
2020-07-08 11:48:13 -05:00
PKG_TARGET := pkg-windows
2020-07-15 17:45:56 -05:00
QRCODEGEN_MAKE_PARAMS := CC = gcc
2020-07-08 11:48:13 -05:00
RUN_TARGET := run-windows
2020-07-15 17:45:56 -05:00
VCINSTALLDIR ?= C:\\ Program Files ( x86) \\ Microsoft Visual Studio\\ 2017\\ BuildTools\\ VC\\
export VCINSTALLDIR
2020-06-04 15:56:44 -05:00
else
2020-08-06 16:14:06 -05:00
LIBSTATUS_EXT := so
2020-06-04 15:56:44 -05:00
PKG_TARGET := pkg-linux
2020-08-06 16:14:06 -05:00
RUN_TARGET := run-linux
2020-06-04 15:56:44 -05:00
endif
2022-11-08 10:11:53 +01:00
check-qt-dir :
2022-12-26 12:22:25 +03:00
ifeq ( $( shell qmake -v 2>/dev /null ) ,)
$( error Cannot find your Qt 5 installation . Please make sure to export correct Qt installation binaries path to PATH env )
2022-11-08 10:11:53 +01:00
endif
2020-07-15 17:45:56 -05:00
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
2021-04-15 16:14:30 -05:00
ifeq ( $( detected_OS ) ,Darwin)
2021-09-16 17:32:00 -05:00
BOTTLES_DIR := $( shell pwd ) /bottles
2022-12-09 13:26:02 +03:00
BOTTLES := $( addprefix $( BOTTLES_DIR) /,openssl@1.1 pcre)
2020-06-04 15:56:44 -05:00
2021-09-16 17:32:00 -05:00
$(BOTTLES) : | $( BOTTLES_DIR )
2023-01-23 16:24:56 +03:00
echo -e "\033[92mFetching:\033[39m $( notdir $@ ) bottle"
2021-09-16 17:32:00 -05:00
./scripts/fetch-brew-bottle.sh $( notdir $@ )
2020-06-04 15:56:44 -05:00
2021-09-16 17:32:00 -05:00
$(BOTTLES_DIR) :
2023-01-23 16:24:56 +03:00
echo -e "\033[92mUpdating:\033[39m macOS Homebrew"
2021-09-16 17:32:00 -05:00
if [[ $$ ( stat -f %u /usr/local/var/homebrew) -ne " $$ {UID}" ]] ; then \
echo "Missing permissions to update Homebrew formulae!" >& 2; \
else \
brew update >/dev/null; \
mkdir -p $( BOTTLES_DIR) ; \
fi
2021-09-10 15:47:07 +03:00
2021-09-16 17:32:00 -05:00
bottles : $( BOTTLES )
2021-04-15 16:14:30 -05:00
endif
2020-06-04 15:56:44 -05:00
2022-11-14 13:00:39 +01:00
deps : | check -qt -dir deps -common bottles
2020-05-25 04:18:37 +02:00
2022-11-14 13:00:39 +01:00
update : | check -qt -dir update -common
2020-05-25 04:18:37 +02:00
2022-08-11 11:14:22 +02:00
QML_DEBUG ?= false
QML_DEBUG_PORT ?= 49152
ifneq ( $( QML_DEBUG ) , false)
DOTHERSIDE_CMAKE_PARAMS := -DCMAKE_BUILD_TYPE= Debug -DQML_DEBUG_PORT= $( QML_DEBUG_PORT)
DOTHERSIDE_BUILD_CMD := cmake --build . --config Debug $( HANDLE_OUTPUT)
else
DOTHERSIDE_CMAKE_PARAMS := -DCMAKE_BUILD_TYPE= Release
DOTHERSIDE_BUILD_CMD := cmake --build . --config Release $( HANDLE_OUTPUT)
endif
2023-01-04 17:05:07 +01:00
MONITORING ?= false
ifneq ( $( MONITORING ) , false)
DOTHERSIDE_CMAKE_PARAMS := ${ DOTHERSIDE_CMAKE_PARAMS } -DMONITORING:BOOL= ON -DMONITORING_QML_ENTRY_POINT:STRING= "/../monitoring/Main.qml"
endif
2020-05-25 04:18:37 +02:00
# Qt5 dirs (we can't indent with tabs here)
2020-07-08 11:48:13 -05:00
ifneq ( $( detected_OS ) ,Windows)
2022-12-26 12:22:25 +03:00
QT5_LIBDIR := $( shell qmake -query QT_INSTALL_LIBS 2>/dev/null)
QT5_QMLDIR := $( shell qmake -query QT_INSTALL_QML 2>/dev/null)
QT5_INSTALL_PREFIX := $( shell qmake -query QT_INSTALL_PREFIX 2>/dev/null)
QT5_PKGCONFIG_INSTALL_PREFIX := $( shell pkg-config --variable= prefix Qt5Core 2>/dev/null)
ifeq ( $( QT5_INSTALL_PREFIX) ,$( QT5_PKGCONFIG_INSTALL_PREFIX) )
QT5_PCFILEDIR := $( shell pkg-config --variable= pcfiledir Qt5Core 2>/dev/null)
else
QT5_PCFILEDIR := $( QT5_LIBDIR) /pkgconfig
2022-11-08 10:11:53 +01:00
# 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 AppKit -framework Security -framework IOKit -framework CoreServices -framework LocalAuthentication"
# 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
2020-05-25 04:18:37 +02:00
else
2022-11-08 10:11:53 +01:00
NIM_PARAMS += --passL:"-L $( QT5_LIBDIR) "
2020-05-25 04:18:37 +02:00
endif
endif
2020-07-08 11:48:13 -05:00
DOTHERSIDE := vendor/DOtherSide/build/lib/libDOtherSideStatic.a
2022-08-11 11:14:22 +02:00
DOTHERSIDE_CMAKE_PARAMS += -DENABLE_DYNAMIC_LIBS= OFF -DENABLE_STATIC_LIBS= ON
2020-07-08 11:48:13 -05:00
# order matters here, due to "-Wl,-as-needed"
2022-02-09 18:35:59 +01:00
NIM_PARAMS += --passL:" $( DOTHERSIDE) " --passL:" $( shell PKG_CONFIG_PATH = " $( QT5_PCFILEDIR) " pkg-config --libs Qt5Core Qt5Qml Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Widgets Qt5Svg Qt5Multimedia) "
2020-07-08 11:48:13 -05:00
else
2022-08-11 11:14:22 +02:00
ifneq ( $( QML_DEBUG ) , false)
DOTHERSIDE := vendor/DOtherSide/build/lib/Debug/DOtherSide.dll
else
DOTHERSIDE := vendor/DOtherSide/build/lib/Release/DOtherSide.dll
endif
DOTHERSIDE_CMAKE_PARAMS += -T"v141" -A x64 -DENABLE_DYNAMIC_LIBS= ON -DENABLE_STATIC_LIBS= OFF
2020-07-08 11:48:13 -05:00
NIM_PARAMS += -L:$( DOTHERSIDE)
NIM_EXTRA_PARAMS := --passL:"-lsetupapi -lhid"
2020-05-25 04:18:37 +02:00
endif
2021-09-23 09:38:38 -04:00
ifeq ( $( detected_OS ) ,Darwin)
ifeq ( "$(shell sysctl -nq hw.optional.arm64)" , "1" )
# Building on M1 is still not supported, so in the meantime we crosscompile to amd64
DOTHERSIDE_CMAKE_PARAMS += -DCMAKE_OSX_ARCHITECTURES= x86_64
NIM_PARAMS += --cpu:amd64 --os:MacOSX --passL:"-arch x86_64" --passC:"-arch x86_64"
endif
endif
2021-04-19 07:20:07 -05:00
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
2021-07-19 09:05:15 +03:00
RCC_PARAMS = --no-compress
2021-04-19 07:20:07 -05:00
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
2020-05-25 04:18:37 +02:00
2021-06-17 14:41:11 -04:00
# App version
VERSIONFILE = VERSION
DESKTOP_VERSION = ` cat $( VERSIONFILE) `
NIM_PARAMS += -d:DESKTOP_VERSION= " $( DESKTOP_VERSION) "
2022-03-24 12:51:24 +01:00
GIT_COMMIT = ` git log --pretty= format:'%h' -n 1`
NIM_PARAMS += -d:GIT_COMMIT= " $( GIT_COMMIT) "
2022-06-30 11:11:40 -04:00
OUTPUT_CSV ?= false
ifeq ( $( OUTPUT_CSV ) , true)
NIM_PARAMS += -d:output_csv
$( shell touch .update.timestamp)
endif
2020-05-14 10:58:08 -04:00
$(DOTHERSIDE) : | deps
echo -e $( BUILD_MSG) "DOtherSide"
+ cd vendor/DOtherSide && \
2020-06-04 15:56:44 -05:00
mkdir -p build && \
cd build && \
2020-05-25 04:18:37 +02:00
rm -f CMakeCache.txt && \
2020-07-08 11:48:13 -05:00
cmake $( DOTHERSIDE_CMAKE_PARAMS) \
2020-06-18 18:44:22 +02:00
-DENABLE_DOCS= OFF \
-DENABLE_TESTS= OFF \
.. $( HANDLE_OUTPUT) && \
2020-07-08 11:48:13 -05:00
$( DOTHERSIDE_BUILD_CMD)
2020-05-14 10:58:08 -04:00
2022-02-03 15:23:51 +01:00
STATUSGO := vendor/status-go/build/bin/libstatus.$( LIBSTATUS_EXT)
2020-08-06 16:14:06 -05:00
STATUSGO_LIBDIR := $( shell pwd ) /$( shell dirname " $( STATUSGO) " )
export STATUSGO_LIBDIR
2020-05-14 10:58:08 -04:00
2020-06-18 18:44:22 +02:00
status-go : $( STATUSGO )
2020-05-14 16:19:01 -04:00
$(STATUSGO) : | deps
echo -e $( BUILD_MSG) "status-go"
2022-02-03 15:23:51 +01:00
+ cd vendor/status-go && \
2020-08-06 16:14:06 -05:00
$( MAKE) statusgo-shared-library $( HANDLE_OUTPUT)
2020-05-14 16:19:01 -04:00
2022-07-21 13:29:18 +02:00
STATUSKEYCARDGO := vendor/status-keycard-go/build/libkeycard/libkeycard.$( LIBSTATUS_EXT)
STATUSKEYCARDGO_LIBDIR := $( shell pwd ) /$( shell dirname " $( STATUSKEYCARDGO) " )
export STATUSKEYCARDGO_LIBDIR
2021-09-28 11:06:19 +03:00
2022-07-21 13:29:18 +02:00
status-keycard-go : $( STATUSKEYCARDGO )
$(STATUSKEYCARDGO) : | deps
echo -e $( BUILD_MSG) "status-keycard-go"
+ cd vendor/status-keycard-go && \
$( MAKE) build-lib $( HANDLE_OUTPUT)
2021-09-28 11:06:19 +03:00
2020-06-23 13:17:58 -04:00
QRCODEGEN := vendor/QR-Code-generator/c/libqrcodegen.a
$(QRCODEGEN) : | deps
echo -e $( BUILD_MSG) "QR-Code-generator"
+ cd vendor/QR-Code-generator/c && \
2020-07-08 11:48:13 -05:00
$( MAKE) $( QRCODEGEN_MAKE_PARAMS)
2020-06-23 13:17:58 -04:00
2020-12-10 10:56:32 -06:00
FLEETS := fleets.json
$(FLEETS) :
echo -e $( BUILD_MSG) "Getting latest $( FLEETS) "
2020-11-03 15:42:55 -04:00
curl -s https://fleets.status.im/ \
| jq --indent 4 --sort-keys . \
2020-12-10 10:56:32 -06:00
> $( FLEETS)
2020-11-03 15:42:55 -04:00
2020-12-10 10:56:32 -06:00
fleets-remove :
rm -f $( FLEETS)
2020-11-06 11:50:58 -04:00
2020-12-10 10:56:32 -06:00
fleets-update : fleets -remove $( FLEETS )
2020-10-29 20:53:34 -05:00
2021-09-21 11:28:25 -05:00
# When modifying files that are not tracked in UI_SOURCES (see below),
# e.g. ui/shared/img/*.svg, REBUILD_UI=true can be supplied to `make` to ensure
# a rebuild of resources.rcc: `make REBUILD_UI=true run`
REBUILD_UI ?= false
ifeq ( $( REBUILD_UI ) ,true)
$( shell touch ui /main .qml )
endif
2021-09-16 16:17:10 -05:00
ifeq ( $( detected_OS ) ,Darwin)
UI_SOURCES := $( shell find -E ui -type f -iregex '.*(qmldir|qml|qrc)$$' -not -iname 'resources.qrc' )
else
UI_SOURCES := $( shell find ui -type f -regextype egrep -iregex '.*(qmldir|qml|qrc)$$' -not -iname 'resources.qrc' )
endif
2021-09-21 11:28:25 -05:00
UI_RESOURCES := resources.rcc
2022-11-14 13:00:39 +01:00
$(UI_RESOURCES) : $( UI_SOURCES ) | check -qt -dir
2020-07-08 11:48:13 -05:00
echo -e $( BUILD_MSG) "resources.rcc"
2020-07-07 13:13:41 -05:00
rm -f ./resources.rcc
rm -f ./ui/resources.qrc
2021-07-19 09:05:15 +03:00
go run ui/generate-rcc.go -source= ui -output= ui/resources.qrc
rcc -binary $( RCC_PARAMS) ui/resources.qrc -o ./resources.rcc
2020-06-30 17:35:24 -04:00
2021-09-16 16:17:10 -05:00
rcc : $( UI_RESOURCES )
2022-07-14 18:58:20 +02:00
TS_SOURCES := $( shell find ui/i18n -iname '*.ts' ) # ui/i18n/qml_*.ts
QM_BINARIES := $( shell find ui/i18n -iname "*.ts" | sed 's/\.ts/\.qm/' | sed 's/ui/bin/' ) # bin/i18n/qml_*.qm
$(QM_BINARIES) : TS_FILE = $( shell echo $ @ | sed 's /\.qm /\.ts /' | sed 's /bin /ui /')
2022-11-14 13:00:39 +01:00
$(QM_BINARIES) : $( TS_SOURCES ) | check -qt -dir
2022-07-14 18:58:20 +02:00
mkdir -p bin/i18n
lrelease -removeidentical $( TS_FILE) -qm $@
compile-translations : $( QM_BINARIES )
2020-10-29 20:53:34 -05:00
# 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) "
2022-02-10 14:22:41 +01:00
DEFAULT_OPENSEA_API_KEY := ""
OPENSEA_API_KEY ?= $( DEFAULT_OPENSEA_API_KEY)
NIM_PARAMS += -d:OPENSEA_API_KEY:" $( OPENSEA_API_KEY) "
2021-07-21 10:26:31 +02:00
DEFAULT_TENOR_API_KEY := DU7DWZ27STB2
TENOR_API_KEY ?= $( DEFAULT_TENOR_API_KEY)
NIM_PARAMS += -d:TENOR_API_KEY:" $( TENOR_API_KEY) "
2022-08-15 09:46:19 -04:00
# used to override the default number of kdf iterations for sqlcipher
KDF_ITERATIONS ?= 0
ifeq ( $( shell test $( KDF_ITERATIONS ) -gt 0; echo $$ ?) ,0)
NIM_PARAMS += -d:KDF_ITERATIONS:" $( KDF_ITERATIONS) "
endif
2021-09-14 15:39:29 -04:00
NIM_PARAMS += -d:chronicles_sinks= textlines[ stdout] ,textlines[ nocolors,dynamic] ,textlines[ file,nocolors] -d:chronicles_runtime_filtering= on -d:chronicles_default_output_device= dynamic
2021-06-29 14:42:18 -04:00
2021-04-19 07:20:07 -05:00
RESOURCES_LAYOUT := -d:development
2021-09-21 11:28:25 -05:00
# When modifying files that are not tracked in NIM_SOURCES (see below),
# e.g. vendor/*.nim, REBUILD_NIM=true can be supplied to `make` to ensure a
# rebuild of bin/nim_status_client: `make REBUILD_NIM=true run`
# Note: it is not necessary to supply REBUILD_NIM=true after `make update`
# because that target bumps .update.timestamp
REBUILD_NIM ?= false
ifeq ( $( REBUILD_NIM ) ,true)
$( shell touch .update .timestamp )
endif
.update.timestamp :
touch .update.timestamp
NIM_SOURCES := .update.timestamp $( shell find src -type f)
2021-09-16 16:17:10 -05:00
ifeq ( $( detected_OS ) ,Windows)
NIM_STATUS_CLIENT := bin/nim_status_client.exe
else
NIM_STATUS_CLIENT := bin/nim_status_client
endif
$(NIM_STATUS_CLIENT) : NIM_PARAMS += $( RESOURCES_LAYOUT )
2022-11-14 13:00:39 +01:00
$(NIM_STATUS_CLIENT) : $( NIM_SOURCES ) $( DOTHERSIDE ) | check -qt -dir $( STATUSGO ) $( STATUSKEYCARDGO ) $( QRCODEGEN ) $( FLEETS ) rcc $( QM_BINARIES ) deps
2020-05-14 10:58:08 -04:00
echo -e $( BUILD_MSG) " $@ " && \
2022-07-21 13:29:18 +02:00
$( ENV_SCRIPT) nim c $( NIM_PARAMS) --passL:"-L $( STATUSGO_LIBDIR) " --passL:"-lstatus" --passL:"-L $( STATUSKEYCARDGO_LIBDIR) " --passL:"-lkeycard" $( NIM_EXTRA_PARAMS) --passL:" $( QRCODEGEN) " --passL:"-lm" src/nim_status_client.nim && \
2020-09-03 11:06:36 -05:00
[[ $$ ? = 0 ]] && \
(([[ $( detected_OS) = Darwin ]] && \
2020-08-06 16:14:06 -05:00
install_name_tool -change \
libstatus.dylib \
@rpath/libstatus.dylib \
2021-10-06 14:36:55 +03:00
bin/nim_status_client && \
install_name_tool -change \
libkeycard.dylib \
@rpath/libkeycard.dylib \
2020-09-03 11:06:36 -05:00
bin/nim_status_client) || true )
2022-09-14 11:44:15 -04:00
ifeq ( $( detected_OS ) ,Darwin)
ifeq ( "$(wildcard ./node_modules/.bin/fileicon)" , "" )
2023-01-23 16:24:56 +03:00
echo -e "\033[92mInstalling : \033[39m fileicon "
2022-09-14 11:44:15 -04:00
npm i
endif
endif
2020-05-14 16:19:01 -04:00
2021-12-15 10:13:06 +01:00
nim_status_client : force -rebuild -status -go $( NIM_STATUS_CLIENT )
2021-09-16 16:17:10 -05:00
2020-06-04 15:56:44 -05:00
_APPIMAGE_TOOL := appimagetool-x86_64.AppImage
APPIMAGE_TOOL := tmp/linux/tools/$( _APPIMAGE_TOOL)
$(APPIMAGE_TOOL) :
2023-01-23 16:24:56 +03:00
echo -e "\033[92mFetching:\033[39m appimagetool"
2020-06-04 15:56:44 -05:00
rm -rf tmp/linux
mkdir -p tmp/linux/tools
2021-08-04 17:41:31 +02:00
wget -nv https://github.com/AppImage/AppImageKit/releases/download/continuous/$( _APPIMAGE_TOOL)
2020-06-04 15:56:44 -05:00
mv $( _APPIMAGE_TOOL) tmp/linux/tools/
chmod +x $( APPIMAGE_TOOL)
2021-04-21 15:13:21 -05:00
STATUS_CLIENT_APPIMAGE ?= pkg/Status.AppImage
2021-06-04 14:44:39 -05:00
STATUS_CLIENT_TARBALL ?= pkg/Status.tar.gz
2021-08-04 17:41:31 +02:00
STATUS_CLIENT_TARBALL_FULL ?= $( shell realpath $( STATUS_CLIENT_TARBALL))
2020-06-04 15:56:44 -05:00
2022-01-21 00:28:31 +01:00
ifeq ( $( detected_OS ) ,Linux)
FCITX5_QT := vendor/fcitx5-qt/build/qt5/platforminputcontext/libfcitx5platforminputcontextplugin.so
FCITX5_QT_CMAKE_PARAMS := -DCMAKE_BUILD_TYPE= Release -DBUILD_ONLY_PLUGIN= ON -DENABLE_QT4= OFF -DENABLE_QT5= ON
FCITX5_QT_BUILD_CMD := cmake --build . --config Release $( HANDLE_OUTPUT)
endif
2022-11-14 13:00:39 +01:00
$(FCITX5_QT) : | check -qt -dir deps
2022-01-21 00:28:31 +01:00
echo -e $( BUILD_MSG) "fcitx5-qt"
+ cd vendor/fcitx5-qt && \
mkdir -p build && \
cd build && \
rm -f CMakeCache.txt && \
cmake $( FCITX5_QT_CMAKE_PARAMS) \
.. $( HANDLE_OUTPUT) && \
$( FCITX5_QT_BUILD_CMD)
2023-01-03 21:17:13 +01:00
PRODUCTION_PARAMETERS := -d:production
2022-03-25 16:48:26 +01:00
$(STATUS_CLIENT_APPIMAGE) : override RESOURCES_LAYOUT := $( PRODUCTION_PARAMETERS )
2022-01-21 00:28:31 +01:00
$(STATUS_CLIENT_APPIMAGE) : nim_status_client $( APPIMAGE_TOOL ) nim -status .desktop $( FCITX 5_QT )
2020-06-04 15:56:44 -05:00
rm -rf pkg/*.AppImage
2020-07-15 17:45:56 -05:00
rm -rf tmp/linux/dist
2020-06-04 15:56:44 -05:00
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
2021-09-16 18:48:25 +03:00
mkdir -p tmp/linux/dist/usr/bin/dictionaries
cp -R spellchecking/dictionaries tmp/linux/dist/usr/bin/dictionaries
2020-06-04 15:56:44 -05:00
cp nim-status.desktop tmp/linux/dist/.
cp status.svg tmp/linux/dist/status.svg
2020-06-30 17:35:24 -04:00
cp status.svg tmp/linux/dist/usr/.
cp -R resources.rcc tmp/linux/dist/usr/.
2020-12-10 10:56:32 -06:00
cp -R $( FLEETS) tmp/linux/dist/usr/.
2020-08-10 16:19:15 -04:00
mkdir -p tmp/linux/dist/usr/i18n
2022-07-14 18:58:20 +02:00
cp bin/i18n/* tmp/linux/dist/usr/i18n
2020-06-04 15:56:44 -05:00
2020-08-06 16:14:06 -05:00
# Libraries
2020-10-07 11:24:24 -04:00
cp -r /usr/lib/x86_64-linux-gnu/nss tmp/linux/dist/usr/lib/
2021-04-21 15:13:21 -05:00
cp -P /usr/lib/x86_64-linux-gnu/libgst* tmp/linux/dist/usr/lib/
cp -r /usr/lib/x86_64-linux-gnu/gstreamer-1.0 tmp/linux/dist/usr/lib/
cp -r /usr/lib/x86_64-linux-gnu/gstreamer1.0 tmp/linux/dist/usr/lib/
2022-02-03 15:23:51 +01:00
cp vendor/status-go/build/bin/libstatus.so tmp/linux/dist/usr/lib/
cp vendor/status-go/build/bin/libstatus.so.0 tmp/linux/dist/usr/lib/
2022-07-21 13:29:18 +02:00
cp $( STATUSKEYCARDGO) tmp/linux/dist/usr/lib/
2020-08-06 16:14:06 -05:00
2020-06-04 15:56:44 -05:00
echo -e $( BUILD_MSG) "AppImage"
2022-12-26 12:22:25 +03:00
linuxdeployqt tmp/linux/dist/nim-status.desktop -no-copy-copyright-files -qmldir= ui -qmlimport= $( QT5_QMLDIR) -bundle-non-qt-libs
2020-06-04 15:56:44 -05:00
2022-01-21 00:28:31 +01:00
# Qt plugins
cp $( FCITX5_QT) tmp/linux/dist/usr/plugins/platforminputcontexts/
2020-06-04 15:56:44 -05:00
rm tmp/linux/dist/AppRun
cp AppRun tmp/linux/dist/.
mkdir -p pkg
2020-06-18 18:44:22 +02:00
$( APPIMAGE_TOOL) tmp/linux/dist $( STATUS_CLIENT_APPIMAGE)
2021-08-04 17:41:31 +02:00
# if LINUX_GPG_PRIVATE_KEY_FILE is not set then we don't generate a signature
ifdef LINUX_GPG_PRIVATE_KEY_FILE
scripts/sign-linux-file.sh $( STATUS_CLIENT_APPIMAGE )
endif
2020-06-04 15:56:44 -05:00
2021-06-04 14:44:39 -05:00
$(STATUS_CLIENT_TARBALL) : $( STATUS_CLIENT_APPIMAGE )
2021-08-04 17:41:31 +02:00
cd $( shell dirname $( STATUS_CLIENT_APPIMAGE)) && \
tar czvf $( STATUS_CLIENT_TARBALL_FULL) --ignore-failed-read \
$( shell basename $( STATUS_CLIENT_APPIMAGE)) { ,.asc}
ifdef LINUX_GPG_PRIVATE_KEY_FILE
scripts/sign-linux-file.sh $( STATUS_CLIENT_TARBALL )
endif
2021-06-04 14:44:39 -05:00
2020-06-04 15:56:44 -05:00
DMG_TOOL := node_modules/.bin/create-dmg
$(DMG_TOOL) :
2023-01-23 16:24:56 +03:00
echo -e "\033[92mInstalling:\033[39m create-dmg"
2020-06-04 15:56:44 -05:00
npm i
2020-09-22 10:12:48 -05:00
MACOS_OUTER_BUNDLE := tmp/macos/dist/Status.app
MACOS_INNER_BUNDLE := $( MACOS_OUTER_BUNDLE) /Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app
2020-06-04 15:56:44 -05:00
2020-06-18 18:44:22 +02:00
STATUS_CLIENT_DMG ?= pkg/Status.dmg
2020-06-04 15:56:44 -05:00
2022-03-25 16:48:26 +01:00
$(STATUS_CLIENT_DMG) : override RESOURCES_LAYOUT := $( PRODUCTION_PARAMETERS )
2020-06-18 18:44:22 +02:00
$(STATUS_CLIENT_DMG) : nim_status_client $( DMG_TOOL )
2020-06-04 15:56:44 -05:00
rm -rf tmp/macos pkg/*.dmg
2020-09-22 10:12:48 -05:00
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/
2021-09-16 18:48:25 +03:00
cp -R spellchecking/dictionaries $( MACOS_OUTER_BUNDLE) /Contents/MacOS/dictionaries
2021-01-19 10:10:36 -06:00
cp status.icns $( MACOS_OUTER_BUNDLE) /Contents/Resources/
2021-07-19 18:00:05 +02:00
cp status-macos.svg $( MACOS_OUTER_BUNDLE) /Contents/
2020-09-22 10:12:48 -05:00
cp -R resources.rcc $( MACOS_OUTER_BUNDLE) /Contents/
2020-12-10 10:56:32 -06:00
cp -R $( FLEETS) $( MACOS_OUTER_BUNDLE) /Contents/
2020-09-22 10:12:48 -05:00
mkdir -p $( MACOS_OUTER_BUNDLE) /Contents/i18n
2022-07-14 18:58:20 +02:00
cp bin/i18n/* $( MACOS_OUTER_BUNDLE) /Contents/i18n
2020-06-04 15:56:44 -05:00
2020-07-08 11:48:13 -05:00
echo -e $( BUILD_MSG) "app"
2020-06-04 15:56:44 -05:00
macdeployqt \
2020-09-22 10:12:48 -05:00
$( MACOS_OUTER_BUNDLE) \
-executable= $( MACOS_OUTER_BUNDLE) /Contents/MacOS/nim_status_client \
2020-06-04 15:56:44 -05:00
-qmldir= ui
2020-09-22 10:12:48 -05:00
macdeployqt \
$( MACOS_INNER_BUNDLE) \
-executable= $( MACOS_INNER_BUNDLE) /Contents/MacOS/QtWebEngineProcess
2020-06-04 15:56:44 -05:00
2020-09-22 10:12:48 -05:00
# if MACOS_CODESIGN_IDENT is not set then the outer and inner .app
# bundles are not signed
2020-06-18 18:44:22 +02:00
ifdef MACOS_CODESIGN_IDENT
2020-09-22 10:12:48 -05:00
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
2020-06-18 18:44:22 +02:00
endif
2020-07-08 11:48:13 -05:00
echo -e $( BUILD_MSG ) "dmg"
2020-06-04 15:56:44 -05:00
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" \
2020-09-22 10:12:48 -05:00
$( MACOS_OUTER_BUNDLE) \
2020-06-04 15:56:44 -05:00
pkg || true
2020-06-18 18:44:22 +02:00
# 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)
2020-06-04 15:56:44 -05:00
2020-06-18 18:44:22 +02:00
ifdef MACOS_CODESIGN_IDENT
scripts/sign-macos-pkg.sh $( STATUS_CLIENT_DMG ) $( MACOS_CODESIGN_IDENT )
endif
2020-06-04 15:56:44 -05:00
2021-05-27 09:53:40 +02:00
notarize-macos : export CHECK_INTERVAL_SEC ?= 30
notarize-macos : export CHECK_RETRY_LIMIT ?= 20
notarize-macos : export MACOS_BUNDLE_ID ?= im .status .ethereum .desktop
notarize-macos :
scripts/notarize-macos-pkg.sh $( STATUS_CLIENT_DMG)
2020-07-15 17:45:56 -05:00
NIM_WINDOWS_PREBUILT_DLLS ?= tmp/windows/tools/pcre.dll
2020-07-08 11:48:13 -05:00
2020-07-15 17:45:56 -05:00
$(NIM_WINDOWS_PREBUILT_DLLS) :
2023-01-23 16:24:56 +03:00
echo -e "\033[92mFetching:\033[39m prebuilt DLLs from nim-lang.org"
2020-07-15 17:45:56 -05:00
rm -rf tmp/windows
mkdir -p tmp/windows/tools
cd tmp/windows/tools && \
2021-04-19 16:45:46 +02:00
wget -nv https://nim-lang.org/download/dlls.zip && \
2020-07-15 17:45:56 -05:00
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
2021-07-15 14:12:18 +03:00
STATUS_CLIENT_EXE ?= pkg/Status.exe
2021-09-15 11:31:45 +03:00
STATUS_CLIENT_7Z ?= pkg/Status.7z
2020-07-15 17:45:56 -05:00
2022-03-25 16:48:26 +01:00
$(STATUS_CLIENT_EXE) : override RESOURCES_LAYOUT := $( PRODUCTION_PARAMETERS )
2021-07-15 14:12:18 +03:00
$(STATUS_CLIENT_EXE) : OUTPUT := tmp /windows /dist /Status
$(STATUS_CLIENT_EXE) : INSTALLER_OUTPUT := pkg
$(STATUS_CLIENT_EXE) : nim_status_client nim_windows_launcher $( NIM_WINDOWS_PREBUILT_DLLS )
rm -rf pkg/*.exe tmp/windows/dist
2021-04-19 16:45:46 +02:00
mkdir -p $( OUTPUT) /bin $( OUTPUT) /resources $( OUTPUT) /vendor $( OUTPUT) /resources/i18n
cat windows-install.txt | unix2dos > $( OUTPUT) /INSTALL.txt
cp status.ico status.svg resources.rcc $( FLEETS) $( OUTPUT) /resources/
2022-07-14 18:58:20 +02:00
cp bin/i18n/* $( OUTPUT) /resources/i18n
2021-09-03 06:16:27 +03:00
cp cacert.pem $( OUTPUT) /bin/cacert.pem
2021-04-19 16:45:46 +02:00
cp bin/nim_status_client.exe $( OUTPUT) /bin/Status.exe
cp bin/nim_windows_launcher.exe $( OUTPUT) /Status.exe
rcedit $( OUTPUT) /bin/Status.exe --set-icon $( OUTPUT) /resources/status.ico
rcedit $( OUTPUT) /Status.exe --set-icon $( OUTPUT) /resources/status.ico
2022-07-21 13:29:18 +02:00
cp $( DOTHERSIDE) $( STATUSGO) $( STATUSKEYCARDGO) tmp/windows/tools/*.dll $( OUTPUT) /bin/
2021-04-19 16:45:46 +02:00
cp " $( shell which libgcc_s_seh-1.dll) " $( OUTPUT) /bin/
cp " $( shell which libwinpthread-1.dll) " $( OUTPUT) /bin/
2020-07-15 17:45:56 -05:00
echo -e $( BUILD_MSG) "deployable folder"
2021-04-19 16:45:46 +02:00
windeployqt --compiler-runtime --qmldir ui --release \
2020-07-15 17:45:56 -05:00
tmp/windows/dist/Status/bin/DOtherSide.dll
mv tmp/windows/dist/Status/bin/vc_redist.x64.exe tmp/windows/dist/Status/vendor/
2021-07-15 14:12:18 +03:00
cp status.iss $( OUTPUT) /status.iss
2021-04-19 16:45:46 +02:00
# if WINDOWS_CODESIGN_PFX_PATH is not set then DLLs, EXEs are not signed
2020-07-21 11:28:42 -05:00
ifdef WINDOWS_CODESIGN_PFX_PATH
2021-04-19 16:45:46 +02:00
scripts/sign-windows-bin.sh ./tmp/windows/dist/Status
2020-07-21 11:28:42 -05:00
endif
2021-07-15 14:12:18 +03:00
echo -e $( BUILD_MSG ) "exe"
mkdir -p $( INSTALLER_OUTPUT )
ISCC \
-O "$(INSTALLER_OUTPUT)" \
-D "BaseName=$(shell basename $(STATUS_CLIENT_EXE) .exe)" \
-D "Version=$(shell cat VERSION)" \
$( OUTPUT ) /status.iss
ifdef WINDOWS_CODESIGN_PFX_PATH
scripts/sign-windows-bin.sh $( INSTALLER_OUTPUT )
endif
2021-09-15 17:08:13 +03:00
$(STATUS_CLIENT_7Z) : OUTPUT := tmp /windows /dist /Status
$(STATUS_CLIENT_7Z) : $( STATUS_CLIENT_EXE )
2021-09-15 10:44:36 +03:00
echo -e $( BUILD_MSG) "7z"
2021-09-15 11:50:19 +03:00
7z a $( STATUS_CLIENT_7Z) ./$( OUTPUT)
2020-07-08 11:48:13 -05:00
2022-06-27 20:49:49 +02:00
# pkg target rebuilds status client
# this is to ensure production version of the app is deployed
pkg :
rm $( NIM_STATUS_CLIENT) | :
$( MAKE) $( PKG_TARGET)
2020-06-04 15:56:44 -05:00
2020-07-15 17:45:56 -05:00
pkg-linux : check -pkg -target -linux $( STATUS_CLIENT_APPIMAGE )
2020-06-04 15:56:44 -05:00
2021-06-04 14:44:39 -05:00
tgz-linux : $( STATUS_CLIENT_TARBALL )
2020-07-15 17:45:56 -05:00
pkg-macos : check -pkg -target -macos $( STATUS_CLIENT_DMG )
2020-06-04 15:56:44 -05:00
2021-07-15 14:12:18 +03:00
pkg-windows : check -pkg -target -windows $( STATUS_CLIENT_EXE )
2020-07-08 11:48:13 -05:00
2021-09-15 17:08:13 +03:00
zip-windows : check -pkg -target -windows $( STATUS_CLIENT_ 7Z )
2020-06-04 15:56:44 -05:00
clean : | clean -common
2022-07-21 13:29:18 +02:00
rm -rf bin/* node_modules bottles/* pkg/* tmp/* $( STATUSGO) $( STATUSKEYCARDGO)
2020-06-04 15:56:44 -05:00
+ $( MAKE) -C vendor/DOtherSide/build --no-print-directory clean
2022-11-03 10:36:47 +01:00
clean-git :
2022-11-22 13:40:45 +01:00
./scripts/clean-git.sh
2022-11-03 10:36:47 +01:00
2021-12-15 10:13:06 +01:00
force-rebuild-status-go :
bash ./scripts/force-rebuild-status-go.sh $( STATUSGO)
2021-09-21 11:28:25 -05:00
run : $( RUN_TARGET )
2020-07-08 11:48:13 -05:00
2021-01-19 10:10:36 -06:00
ICON_TOOL := node_modules/.bin/fileicon
2022-09-22 19:08:24 +02:00
# Will only work at password login. Keycard login doesn't forward the configuration
2021-04-19 07:20:07 -05:00
# STATUS_PORT ?= 30306
2022-09-28 12:03:30 +03:00
# WAKUV2_PORT ?= 30307
2020-07-03 14:22:15 -05:00
2021-09-21 11:28:25 -05:00
run-linux : nim_status_client
2023-01-23 16:24:56 +03:00
echo -e "\033[92mRunning:\033[39m bin/nim_status_client"
2022-07-21 13:29:18 +02:00
LD_LIBRARY_PATH = " $( QT5_LIBDIR) " :" $( STATUSGO_LIBDIR) " :" $( STATUSKEYCARDGO_LIBDIR) " \
2020-08-06 16:14:06 -05:00
./bin/nim_status_client
2022-09-14 11:44:15 -04:00
run-macos : nim_status_client
2021-04-30 13:58:55 -05:00
mkdir -p bin/StatusDev.app/Contents/{ MacOS,Resources}
cp Info.dev.plist bin/StatusDev.app/Contents/Info.plist
cp status-dev.icns bin/StatusDev.app/Contents/Resources/
cd bin/StatusDev.app/Contents/MacOS && \
ln -fs ../../../nim_status_client ./
2022-09-14 15:47:19 -04:00
./node_modules/.bin/fileicon set bin/nim_status_client status-dev.icns
2023-01-23 16:24:56 +03:00
echo -e "\033[92mRunning:\033[39m bin/StatusDev.app/Contents/MacOS/nim_status_client"
2021-04-30 13:58:55 -05:00
./bin/StatusDev.app/Contents/MacOS/nim_status_client
2020-05-19 11:32:48 -04:00
2021-09-21 11:28:25 -05:00
run-windows : nim_status_client $( NIM_WINDOWS_PREBUILT_DLLS )
2023-01-23 16:24:56 +03:00
echo -e "\033[92mRunning:\033[39m bin/nim_status_client.exe"
2022-07-21 13:29:18 +02:00
PATH = " $( shell pwd ) " /" $( shell dirname " $( DOTHERSIDE) " ) " :" $( STATUSGO_LIBDIR) " :" $( STATUSKEYCARDGO_LIBDIR) " :" $( shell pwd ) " /" $( shell dirname " $( NIM_WINDOWS_PREBUILT_DLLS) " ) " :" $( PATH) " \
2020-07-03 14:22:15 -05:00
./bin/nim_status_client.exe
2020-07-08 11:48:13 -05:00
2023-01-11 10:13:54 +01:00
tests-nim-linux : | $( DOTHERSIDE )
2022-12-19 19:55:40 +01:00
LD_LIBRARY_PATH = " $( QT5_LIBDIR) " \
$( ENV_SCRIPT) nim c $( NIM_PARAMS) $( NIM_EXTRA_PARAMS) -r test/nim/message_model_test.nim
2022-10-27 16:59:55 +02:00
statusq-sanity-checker :
cmake -Bui/StatusQ/build -Sui/StatusQ && cmake --build ui/StatusQ/build --target SanityChecker
run-statusq-sanity-checker : statusq -sanity -checker
ui/StatusQ/build/sanity_checker/SanityChecker
2020-05-14 10:58:08 -04:00
endif # "variables.mk" was not included