From 5ce650382352c1503f40abf08129ada69402af55 Mon Sep 17 00:00:00 2001 From: bitflash-coin Date: Tue, 4 Aug 2026 06:34:32 -0700 Subject: public commit --- src/makefile.mingw | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/makefile.mingw (limited to 'src/makefile.mingw') diff --git a/src/makefile.mingw b/src/makefile.mingw new file mode 100644 index 0000000..e076c49 --- /dev/null +++ b/src/makefile.mingw @@ -0,0 +1,118 @@ +# Bitflash Windows build — ImGui + GLFW + OpenGL3 +# Run from MSYS2 UCRT64: make -f makefile.mingw + +CXX = g++ + +DEPS = ../deps +RANDOMX = ../RandomX +IMGUI_DIR = imgui + +# See the long note in Makefile: -w hid the format bug that segfaulted the node +# on glibc (issue #5), and -w cannot be narrowed, so format diagnostics are now +# fatal and only the categories this tree actually produces are silenced. +WARNFLAGS = -Wformat -Werror=format \ + -Wno-deprecated-declarations -Wno-write-strings \ + -Wno-narrowing -Wno-unused-result + +# FD_SETSIZE has to be defined before winsock2.h and it has to be the same +# number in every translation unit -- fd_set carries an array of that length, +# so disagreeing about it means disagreeing about sizeof(fd_set). That is why +# it lives here as a -D and not as a #define in a header. Windows defaults to +# 64, which capped this node at 63 watchable peers no matter how many it had. +CXXFLAGS = -std=gnu++14 -O2 $(WARNFLAGS) -fpermissive -pthread \ + -DWIN32 -DNOPCH -DFD_SETSIZE=1024 \ + -DSECP256K1_STATIC \ + -I$(DEPS)/include -I$(RANDOMX)/src \ + -I$(DEPS)/include/nlohmann \ + -IC:/msys64/ucrt64/include \ + -I$(IMGUI_DIR) + +LIBS = -L$(DEPS)/lib -lsecp256k1 \ + -L$(RANDOMX)/build -lrandomx \ + -lsodium -lssl -lcrypto -ldb_cxx -lpthread \ + -LC:/msys64/ucrt64/lib \ + -lglfw3 -lopengl32 -lgdi32 \ + -lkernel32 -luser32 -lcomdlg32 -lwinspool -lwinmm \ + -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid \ + -lrpcrt4 -ladvapi32 -lws2_32 -lmswsock -lcrypt32 + +IMGUI_OBJS = obj/imgui.o obj/imgui_draw.o obj/imgui_tables.o \ + obj/imgui_widgets.o obj/imgui_impl_glfw.o obj/imgui_impl_opengl3.o + +NODE_OBJS = obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \ + obj/market.o obj/sha.o obj/nostr.o obj/randomx_pow.o \ + obj/btfaddr.o obj/btfchan.o obj/btfrv.o obj/btftunnel.o obj/rpc.o \ + obj/selftest.o obj/bip32.o obj/walletcmd.o + +GUI_OBJS = obj/gui.o obj/main_gui.o obj/bitflash_res.o + +# Every header a .cpp here includes has to be listed, not just the interesting +# ones. sockcount.h was missing, and it declares a struct that lives in a +# function-local static shared across translation units: editing it rebuilt +# some objects and not others, and the linker said so in a warning easy to walk +# past -- "duplicate section ... has different size". That is one object +# indexing a struct by the old layout and another by the new one, in the same +# binary. Nothing crashed here, and nothing would say so if it had. +HEADERS = headers_core.h headers.h util.h main.h serialize.h uint256.h \ + key.h bignum.h script.h db.h base58.h net.h nostr.h \ + randomx_pow.h btfaddr.h btfchan.h btfrv.h btftunnel.h market.h \ + selftest.h walletcmd.h sockcount.h compat.h font_roboto.h + +all: bitflash.exe + +obj/bitflash_res.o: bitflash.rc rc/bitcoin.ico + mkdir -p obj + windres -o $@ -i bitflash.rc + +obj/%.o: %.cpp $(HEADERS) + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +obj/sha.o: sha.cpp sha.h + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -O3 -o $@ $< + +obj/imgui.o: $(IMGUI_DIR)/imgui.cpp + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +obj/imgui_draw.o: $(IMGUI_DIR)/imgui_draw.cpp + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +obj/imgui_tables.o: $(IMGUI_DIR)/imgui_tables.cpp + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +obj/imgui_widgets.o: $(IMGUI_DIR)/imgui_widgets.cpp + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +obj/imgui_impl_glfw.o: $(IMGUI_DIR)/imgui_impl_glfw.cpp + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +obj/imgui_impl_opengl3.o: $(IMGUI_DIR)/imgui_impl_opengl3.cpp + mkdir -p obj + $(CXX) -c $(CXXFLAGS) -o $@ $< + +bitflash.exe: $(IMGUI_OBJS) $(NODE_OBJS) $(GUI_OBJS) + $(CXX) $(CXXFLAGS) -mwindows -o $@ $^ $(LIBS) + @echo "Built: bitflash.exe" + +clean: + rm -rf obj bitflash.exe test_bip32.exe + +test_bip32.exe: test_bip32.cpp bip32.cpp bip32.h bip39_english.h + $(CXX) $(CXXFLAGS) -o $@ test_bip32.cpp bip32.cpp -lssl -lcrypto -lcrypt32 + @echo "Built: test_bip32.exe" + +tests: test_bip32.exe bitflash.exe + ./test_bip32.exe + ./bitflash.exe -selftest=wallet-keypool + ./bitflash.exe -selftest=wallet-hd + ./bitflash.exe -selftest=wallet-format + ./bitflash.exe -selftest=wallet-crypto + ./bitflash.exe -selftest=wallet-encrypt + ./bitflash.exe -selftest=net-message + ./bitflash.exe -selftest=consensus-limits -- cgit v1.2.3