upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorbitflash-coin <bookofshamers@outlook.com>2026-08-04 06:34:32 -0700
committerbitflash-coin <bookofshamers@outlook.com>2026-08-04 06:34:32 -0700
commit5ce650382352c1503f40abf08129ada69402af55 (patch)
tree6a18198901f1e2c4933f1ac53c9365eec512bf63 /Makefile
parentf34113291da7e5e3dc7d2468d4f9c212c05c584b (diff)
public commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile176
1 files changed, 176 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ea720f1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,176 @@
1# Bitflash — top-level build
2#
3# make linux build Bitflash-*-x86_64.AppImage
4# make windows build Bitflash-*-windows.zip (from MSYS2 UCRT64)
5# make tests build and run standalone unit tests
6# make checksums create SHA256SUMS for release assets
7# make verify-release TAG=v1.2.13
8# make clean remove build artifacts
9
10ROOT := $(shell pwd)
11NPROC := $(shell nproc 2>/dev/null || echo 2)
12SUDO := $(shell [ "$$(id -u)" = "0" ] && echo "" || echo "sudo")
13VERSION := 1.2.15
14
15# ---- Linux ----------------------------------------------------------------
16
17linux: deps-linux
18 $(MAKE) -C src -f Makefile -j$(NPROC)
19 strip src/bitflash
20 $(MAKE) -f Makefile appimage
21 $(MAKE) -f Makefile linux-node
22
23# Headless node, no ImGui/GLFW/OpenGL. The GUI build needs libGL present at load
24# time even when started with -nogui -- the dynamic loader resolves everything
25# before main() runs, so the flag comes far too late. On a clean server, which is
26# where a node most naturally lives, that is a hard failure. This binary has no
27# such dependency and needs no FUSE either, so it drops onto a VPS and runs.
28linux-node: deps-linux
29 $(MAKE) -C src -f Makefile bitflash-node -j$(NPROC)
30 strip src/bitflash-node
31 cp src/bitflash-node bitflash-node-$(VERSION)-x86_64
32 @echo "Built: bitflash-node-$(VERSION)-x86_64"
33
34deps-linux: deps-apt deps-secp256k1 deps-randomx
35
36deps-apt:
37 @if command -v apt-get >/dev/null 2>&1; then \
38 $(SUDO) apt-get install -y build-essential cmake git pkg-config autoconf \
39 libtool libssl-dev libdb5.3++-dev libsodium-dev nlohmann-json3-dev \
40 libboost-system-dev libglfw3-dev libgl-dev python3-pil; \
41 else \
42 echo "Not an apt system — install: g++ cmake git autoconf libtool"; \
43 echo " libssl libdb++ libsodium nlohmann-json boost glfw3 opengl python3-pil"; \
44 fi
45
46deps-secp256k1:
47 @if [ ! -f /usr/local/lib/libsecp256k1.a ]; then \
48 echo "==> building libsecp256k1"; \
49 rm -rf $(ROOT)/secp256k1-build; \
50 git clone --depth 1 https://github.com/bitcoin-core/secp256k1 $(ROOT)/secp256k1-build; \
51 cd $(ROOT)/secp256k1-build && ./autogen.sh && \
52 ./configure --enable-module-schnorrsig --enable-module-extrakeys \
53 --disable-shared --with-pic --disable-benchmark --disable-tests && \
54 make -j$(NPROC) && $(SUDO) make install && $(SUDO) ldconfig; \
55 echo "==> libsecp256k1 done"; \
56 else \
57 echo "==> libsecp256k1 already installed"; \
58 fi
59
60deps-randomx:
61 @if [ ! -f $(HOME)/RandomX/build/librandomx.a ]; then \
62 echo "==> building RandomX"; \
63 rm -rf $(HOME)/RandomX; \
64 git clone --depth 1 https://github.com/tevador/RandomX $(HOME)/RandomX; \
65 mkdir -p $(HOME)/RandomX/build; \
66 cd $(HOME)/RandomX/build && cmake .. -DCMAKE_BUILD_TYPE=Release && \
67 make -j$(NPROC) randomx; \
68 echo "==> RandomX done"; \
69 else \
70 echo "==> RandomX already built"; \
71 fi
72
73appimage: src/bitflash
74 @echo "==> building AppImage"
75 @if [ ! -x /tmp/appimagetool ]; then \
76 wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" \
77 -O /tmp/appimagetool && chmod +x /tmp/appimagetool; \
78 fi
79 @rm -rf /tmp/bitflash.AppDir
80 @mkdir -p /tmp/bitflash.AppDir/usr/bin \
81 /tmp/bitflash.AppDir/usr/lib \
82 /tmp/bitflash.AppDir/usr/share/applications \
83 /tmp/bitflash.AppDir/usr/share/icons/hicolor/256x256/apps
84 @cp src/bitflash /tmp/bitflash.AppDir/usr/bin/bitflash
85 @printf '#!/bin/sh\nHERE="$$(dirname "$$(readlink -f "$$0")")"\nexport LD_LIBRARY_PATH="$$HERE/usr/lib:$$LD_LIBRARY_PATH"\nexec "$$HERE/usr/bin/bitflash" "$$@"\n' \
86 > /tmp/bitflash.AppDir/AppRun && chmod +x /tmp/bitflash.AppDir/AppRun
87 @printf '[Desktop Entry]\nName=Bitflash\nExec=bitflash\nIcon=bitflash\nType=Application\nCategories=Finance;\n' \
88 > /tmp/bitflash.AppDir/bitflash.desktop
89 @cp /tmp/bitflash.AppDir/bitflash.desktop \
90 /tmp/bitflash.AppDir/usr/share/applications/
91 @python3 -c "\
92from PIL import Image; \
93ico = Image.open('src/rc/bitcoin.ico'); \
94img = ico.convert('RGBA'); \
95img.save('/tmp/bitflash.AppDir/bitflash.png'); \
96import shutil; shutil.copy('/tmp/bitflash.AppDir/bitflash.png', \
97'/tmp/bitflash.AppDir/usr/share/icons/hicolor/256x256/apps/bitflash.png')"
98 @for lib in libsodium.so.23 libdb_cxx-5.3.so libglfw.so.3; do \
99 path=$$(ldconfig -p | grep " $$lib " | awk '{print $$NF}' | head -1); \
100 [ -z "$$path" ] && path=$$(find /usr/lib /lib -name "$$lib" 2>/dev/null | head -1); \
101 [ -n "$$path" ] && cp -L "$$path" /tmp/bitflash.AppDir/usr/lib/ && echo " bundled $$lib" || echo " missing $$lib"; \
102 done
103 @ARCH=x86_64 /tmp/appimagetool --no-appstream /tmp/bitflash.AppDir \
104 $(ROOT)/Bitflash-$(VERSION)-x86_64.AppImage 2>&1 | grep -E "^Built|^Error" || true
105 @echo "Built: Bitflash-$(VERSION)-x86_64.AppImage"
106
107# ---- Windows (MSYS2 UCRT64) -----------------------------------------------
108
109deps-windows:
110 pacman -S --noconfirm --needed \
111 mingw-w64-ucrt-x86_64-gcc \
112 mingw-w64-ucrt-x86_64-make \
113 mingw-w64-ucrt-x86_64-glfw \
114 mingw-w64-ucrt-x86_64-openssl \
115 mingw-w64-ucrt-x86_64-db \
116 mingw-w64-ucrt-x86_64-libsodium \
117 mingw-w64-ucrt-x86_64-nlohmann-json \
118 mingw-w64-ucrt-x86_64-boost \
119 mingw-w64-ucrt-x86_64-cmake \
120 autoconf automake libtool
121 @if [ ! -f deps/lib/libsecp256k1.a ]; then \
122 rm -rf secp256k1-build; \
123 git clone --depth 1 https://github.com/bitcoin-core/secp256k1 secp256k1-build; \
124 cd secp256k1-build && ./autogen.sh && \
125 ./configure --prefix=$(ROOT)/deps \
126 --enable-module-schnorrsig --enable-module-extrakeys \
127 --disable-shared --with-pic --disable-benchmark --disable-tests && \
128 make install; \
129 echo "==> secp256k1 done"; \
130 else \
131 echo "==> secp256k1 already built"; \
132 fi
133 @if [ ! -f RandomX/build/librandomx.a ]; then \
134 rm -rf RandomX; \
135 git clone --depth 1 https://github.com/tevador/RandomX; \
136 mkdir -p RandomX/build; \
137 cd RandomX/build && cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && \
138 make randomx; \
139 echo "==> RandomX done"; \
140 else \
141 echo "==> RandomX already built"; \
142 fi
143
144windows: deps-windows
145 cd src && make -f makefile.mingw
146 @rm -rf Bitflash-$(VERSION)-windows
147 @mkdir -p Bitflash-$(VERSION)-windows
148 @cp src/bitflash.exe Bitflash-$(VERSION)-windows/Bitflash.exe
149 @ldd src/bitflash.exe | grep ucrt64 | awk '{print $$3}' | \
150 xargs -I{} cp {} Bitflash-$(VERSION)-windows/ 2>/dev/null || true
151 @zip -r Bitflash-$(VERSION)-windows.zip Bitflash-$(VERSION)-windows/
152 @echo "Built: Bitflash-$(VERSION)-windows.zip"
153
154# ---- Clean ----------------------------------------------------------------
155
156clean:
157 $(MAKE) -C src -f Makefile clean 2>/dev/null || true
158 cd src && make -f makefile.mingw clean 2>/dev/null || true
159 rm -f Bitflash-*.AppImage Bitflash-*.zip
160 rm -rf Bitflash-*-windows
161
162tests:
163 $(MAKE) -C src -f Makefile tests
164
165checksums:
166 ./scripts/make-release-checksums.sh
167
168sign-checksums:
169 ./scripts/make-release-checksums.sh --sign $(if $(KEY),--local-user $(KEY),)
170
171verify-release:
172 ./scripts/verify-release.sh $(if $(TAG),$(TAG),latest)
173
174.PHONY: linux windows clean appimage \
175 tests checksums sign-checksums verify-release \
176 deps-linux deps-windows deps-apt deps-secp256k1 deps-randomx