Adding nimbus-build-system

This commit is contained in:
Richard Ramos 2020-05-14 10:58:08 -04:00 committed by Iuri Matias
parent 491718a0bd
commit c1d1b60f46
17 changed files with 172 additions and 40 deletions

18
.gitmodules vendored Normal file
View File

@ -0,0 +1,18 @@
[submodule "vendor/DOtherSide"]
path = vendor/DOtherSide
url = https://github.com/filcuc/DOtherSide
[submodule "vendor/nim-stint"]
path = vendor/nim-stint
url = https://github.com/status-im/nim-stint
[submodule "vendor/nimqml"]
path = vendor/nimqml
url = https://github.com/filcuc/nimqml/
[submodule "vendor/nimbus-build-system"]
path = vendor/nimbus-build-system
url = https://github.com/status-im/nimbus-build-system
[submodule "vendor/nim-nat-traversal"]
path = vendor/nim-nat-traversal
url = https://github.com/status-im/nim-nat-traversal/
[submodule "vendor/nim-stew"]
path = vendor/nim-stew
url = https://github.com/status-im/nim-stew/

View File

@ -1,7 +1,83 @@
SHELL := bash
# 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.
build:
nim c -L:lib/libstatus.a -d:ssl -L:-lm --outdir:./bin src/nim_status_client.nim
SHELL := bash # the shell used internally by Make
build-osx:
nim c -L:lib/libstatus.dylib -d:ssl -L:-lm -L:"-framework Foundation -framework Security -framework IOKit -framework CoreServices" --outdir:./bin src/nim_status_client.nim
# 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 \
appimage \
clean \
deps \
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.
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
detected_OS := Windows
else
detected_OS := $(strip $(shell uname))
endif
DEFAULT_TARGET := None
ifeq ($(detected_OS), Darwin)
DEFAULT_TARGET := build-macos
else
DEFAULT_TARGET := build-linux
endif
all: $(DEFAULT_TARGET)
# must be included after the default target
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
deps: | deps-common
update: | update-common
DOTHERSIDE := vendor/DOtherSide/build/lib/libDOtherSideStatic.a
$(DOTHERSIDE): | deps
echo -e $(BUILD_MSG) "DOtherSide"
+ cd vendor/DOtherSide && \
mkdir -p build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. $(HANDLE_OUTPUT) && \
$(MAKE) # IF WE WANT TO USE LIBDOTHERSIDE AS STATIC LIBRARY, USE `$(MAKE) DOtherSideStatic` INSTEAD
build-linux: $(DOTHERSIDE) src/nim_status_client.nim | deps
echo -e $(BUILD_MSG) "$@" && \
$(ENV_SCRIPT) nim c -L:lib/libstatus.a -d:ssl -L:-lm -L:-Lvendor/DOtherSide/build/lib/ $(NIM_PARAMS) --outdir:./bin src/nim_status_client.nim
build-macos: $(DOTHERSIDE) src/nim_status_client.nim | deps
echo -e $(BUILD_MSG) "$@" && \
$(ENV_SCRIPT) nim c -L:lib/libstatus.a -d:ssl -L:-lm -L:"-framework Foundation -framework Security -framework IOKit -framework CoreServices" -L:-Lvendor/DOtherSide/build/lib/ $(NIM_PARAMS) --outdir:./bin src/nim_status_client.nim
clean: | clean-common
rm -rf vendor/DOtherSide/build tmp/dist
endif # "variables.mk" was not included

View File

@ -22,59 +22,34 @@ export PATH=$PATH:/path/to/Qt/5.14.2/gcc_64/bin
export PATH=$PATH:/path/to/Qt/5.14.2/clang_64/bin
```
### 3. Clone and build DOtherside
For Linux:
### 3. Clone the repo
```
sudo apt-get install build-essential libgl1-mesa-dev
sudo apt-get install doxygen
git clone https://github.com/status-im/nim-status-client/ --recurse-submodules
```
```
git clone https://github.com/filcuc/DOtherSide
cd DOtherSide
mkdir build && cd build
cmake ..
make
```
### 4. Setup Library Path
```
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/dotherside/build/lib
```
### 5. Copy libstatus to repo
### 4. Copy libstatus to repo
Copy `libstatus.a` to the `./lib` folder. Can be obtained from `status-react/result` by executing `make status-go-desktop`.
**macos:** rename `libstatus.a` to `libstatus.dylib` _before_ copying over. Alternatively, modify `desktop/default.nix` to output `libstatus.dylib` before copying over.
### 6. Install nim dependencies
Use `-d` to only install dependencies and not build afterwards.
### 5. Build `nim-status-client`
```
nimble install -d
make
```
### 7. Build `nim-status-client`
### 6. Setup Library Path
```
# linux
make build
# macos
make build-osx
export LD_LIBRARY_PATH=vendor/DOtherSide/build/lib/
```
### 8. Run the app
### 7. Run the app
```
./bin/nim_status_client
```
### 9. "Cold" reload using VSCode
### 8. "Cold" reload using VSCode
We can setup a "cold" reload, whereby the app will be rebuilt and restarted when changes in the source are saved. This will not save state, as the app will be restarted, but it will save us some time from manually restarting the app. We can handily force an app rebuild/relaunch with the shortcut `Cmd+Shift+b` (execute the default build task, which we'll setup below).

8
env.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# We use ${BASH_SOURCE[0]} instead of $0 to allow sourcing this file
# and we fall back to a Zsh-specific special var to also support Zsh.
REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})"
ABS_PATH="$(cd ${REL_PATH}; pwd)"
source ${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh

8
nim-status.desktop Normal file
View File

@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=Nim Status Client
Exec=nim %F
Icon=status
Comment=Hello World
Terminal=true
Categories=Network;

View File

@ -1,2 +1,9 @@
--threads:on
--tlsEmulation:off
@if release:
nimcache = "nimcache/release/$projectName"
@else:
nimcache = "nimcache/debug/$projectName"
@end

26
status.svg Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X7 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="7.5in" height="7.5in" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 7500 7500"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.fil0 {fill:none}
.fil1 {fill:#5B6DEE}
.fil2 {fill:white}
]]>
</style>
</defs>
<g id="Layer_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<rect class="fil0" width="7500" height="7500"/>
<g id="_2080958732912">
<circle class="fil1" cx="3750" cy="3750" r="3100"/>
<g>
<path class="fil2" d="M3227 3560c-3,0 -7,0 -10,0 -105,0 -210,10 -313,28 88,-810 763,-1423 1567,-1423 492,0 829,241 829,739 0,499 -405,740 -995,740 -436,0 -642,-84 -1078,-84l0 0zm-32 296c-590,0 -995,241 -995,739 0,499 337,740 829,740 804,0 1479,-613 1566,-1423 -102,19 -207,28 -312,28 -3,0 -7,0 -10,0 -436,0 -642,-84 -1078,-84z"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,2 @@
/home/richard/status/nim-status-client/vendor/nim-nat-traversal
/home/richard/status/nim-status-client/vendor/nim-nat-traversal

View File

@ -0,0 +1,2 @@
/home/richard/status/nim-status-client/vendor/nim-stew
/home/richard/status/nim-status-client/vendor/nim-stew

View File

@ -0,0 +1,2 @@
/home/richard/status/nim-status-client/vendor/nim-stint
/home/richard/status/nim-status-client/vendor/nim-stint

View File

@ -0,0 +1,2 @@
/home/richard/status/nim-status-client/vendor/nimqml/src
/home/richard/status/nim-status-client/vendor/nimqml/src

1
vendor/DOtherSide vendored Submodule

@ -0,0 +1 @@
Subproject commit 4d0d6a353c33ff2227b83562a127b3514a7e2169

1
vendor/nim-nat-traversal vendored Submodule

@ -0,0 +1 @@
Subproject commit 2403c33929c74f2d150f50dc8bc3a598af70661a

1
vendor/nim-stew vendored Submodule

@ -0,0 +1 @@
Subproject commit d0f5be4971ad34d115b9749d9fb69bdd2aecf525

1
vendor/nim-stint vendored Submodule

@ -0,0 +1 @@
Subproject commit 9e49b00148884a01d61478ae5d2c69b543b93ceb

1
vendor/nimbus-build-system vendored Submodule

@ -0,0 +1 @@
Subproject commit 89709a091361bb42df9d16f4e79fe764c265f2c4

1
vendor/nimqml vendored Submodule

@ -0,0 +1 @@
Subproject commit 5c42890e5b14b7d84a2345b060d1b54bfb7aed1b