Skip to content

Commit 4bacb67

Browse files
authored
Merge pull request #29 from gorazdko/build_on_windows
Build on windows
2 parents 4e8f0f6 + c7a531d commit 4bacb67

File tree

10 files changed

+88
-8
lines changed

10 files changed

+88
-8
lines changed

Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
UNAME := $(shell uname)
1111
ifeq ($(UNAME), Linux)
1212
SHELL := /bin/bash
13+
else ifeq ($(findstring MINGW64, $(UNAME)), MINGW64)
14+
# on windows building with msys2/mingw64
15+
SHELL := /bin/bash
1316
endif
1417

1518
# Package-specific substitution variables

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ $ export CC="clang-10" && export CXX="clang++-10" && ./build.sh
164164
$ sudo make install
165165
```
166166

167+
### Windows
168+
169+
See [instructions here](Windows.md).
170+
167171
## Alternative Installation
168172

169173
This sequence does *not* install the dependencies from submodules; instead they must be installed in the usual places on the build system, otherwise the `./configure` step below will fail.

Windows.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## Seedtool on Windows
2+
3+
### Abstract
4+
5+
This document describes building `seedtool` with `MSYS2` and its usage on `Windows 10` 64-bit.
6+
7+
### Installing MSYS2 and Packages
8+
9+
* First, install `MSYS2` by downloading the installer and following the installation guide in [www.msys2.org](www.msys2.org).
10+
11+
* Run `MSYS2` and make sure the package database is updated:
12+
13+
```bash
14+
# pacman -Syu
15+
# pacman -Su
16+
```
17+
18+
* Next, install the compiler and the required packages:
19+
20+
```bash
21+
# pacman -S mingw-w64-x86_64-clang
22+
# pacman -S patch
23+
# pacman -S git
24+
# pacman -S make
25+
# pacman -S mingw-w64-x86_64-libc++
26+
# pacman -S autoconf
27+
# pacman -S automake1.8
28+
```
29+
30+
### Compiling
31+
32+
First, clone `bc-seedtool-cli`, e.g. into `C:\msys64\home`, open `MSYS2 MinGW 64-bit` application and `cd` into `C:\msys64\home\bc-seedtool-cli`
33+
34+
* Now, run the build script with:
35+
36+
```bash
37+
# export CC="clang" && export CXX="clang++" && ./build.sh
38+
```
39+
40+
* and install:
41+
42+
```bash
43+
# make install
44+
```
45+
46+
You can now freely use `seedtool` inside `MSYS2 MinGW 64-bit` console.
47+
48+
49+
### Running Seedtool as a Native Windows App
50+
51+
To be able to use `seedtool` as a native app on Windows outside `msys2/mingw64`, you have to expose 3 files to the system: `seedtool.exe`, `libc++.dll` and `libunwind.dll` which all reside in `C:\msys64\mingw64\bin`. So go ahead and add that folder to the `Windows PATH` by the following command in `Windows Cmd`:
52+
53+
```bash
54+
set PATH=%PATH%;C:\msys64\mingw64\bin
55+
```
56+
57+
That's it. Now you can use `seedtool` as a native Windows app in the Windows command line tool.
58+
59+
60+
*Note:* If you want to pipe seedtool ouput into a QR code generator, you could use:
61+
62+
```bash
63+
seedtool --ur | python -c "import sys; print(sys.stdin.readlines()[0].upper())" | qr > seedqrcode.png
64+
```
65+
66+
For this you'll need `Python` and the following package:
67+
68+
```bash
69+
pip install qrcode[pil]
70+
```
71+

deps/bc-bip39

deps/bc-shamir

deps/bc-slip39

deps/bc-ur

src/Makefile.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ OBJS = \
5959
randombytes.o \
6060
hkdf.o
6161

62-
LDFLAGS += -lstdc++
6362
LDLIBS += -lbc-slip39 -lbc-shamir -lbc-crypto-base -lbc-bip39 -lbc-ur -largp
6463

6564
UNAME := $(shell uname)
6665
ifeq ($(UNAME), Linux)
6766
LDLIBS += -lm -lc++ -lc++abi -lgcc_s -lgcc
67+
else ifeq ($(findstring MINGW64, $(UNAME)), MINGW64)
68+
# on windows building with msys2/mingw64
69+
LDLIBS += -lm -lc++ -lws2_32
6870
endif
6971

7072
$(toolname): $(OBJS)
@@ -91,7 +93,7 @@ format-bytewords.o: format-bytewords.hpp format.hpp params.hpp random.hpp
9193
format-bytewords-uri.o: format-bytewords-uri.hpp format.hpp params.hpp random.hpp
9294
format-bytewords-minimal.o: format-bytewords-minimal.hpp format.hpp params.hpp random.hpp
9395

94-
bindir = $(DESTDIR)/$(prefix)/bin
96+
bindir = $(DESTDIR)$(prefix)/bin
9597

9698
.PHONY: install
9799
install: $(toolname)

0 commit comments

Comments
 (0)