fixed makefile

This commit is contained in:
Your Name
2025-08-16 14:55:23 -04:00
parent 6be88f7d64
commit 908a8f4b1f
5 changed files with 182215 additions and 10 deletions

View File

@@ -1,11 +1,11 @@
# Event Miner Makefile
# Static build with nostr_core_lib dependency
# Build with nostr_core_lib dependency (uses system libraries)
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -O2 -static
CFLAGS = -Wall -Wextra -std=c99 -O2
INCLUDES = -Inostr_core_lib/nostr_core
LIBS = -lm -lpthread
NOSTR_LIB = nostr_core_lib/libnostr_core.a
LIBS = -lz -ldl -lpthread -lm -L/usr/local/lib -lsecp256k1 -lssl -lcrypto -L/usr/local/lib -lcurl
NOSTR_LIB = nostr_core_lib/libnostr_core_x64.a
# Default target
all: event_miner
@@ -19,14 +19,14 @@ event_miner: event_miner.c $(NOSTR_LIB)
# Build nostr_core_lib dependency
$(NOSTR_LIB):
@echo "Building nostr_core_lib dependency..."
cd nostr_core_lib && make
cd nostr_core_lib && ./build.sh x64
@echo "✓ nostr_core_lib built successfully"
# Clean target
clean:
@echo "Cleaning build artifacts..."
rm -f event_miner
cd nostr_core_lib && make clean
cd nostr_core_lib && rm -f *.o libnostr_core_*.a
# Clean only event_miner (keep nostr_core_lib)
clean-miner:
@@ -75,6 +75,6 @@ help:
@echo " make clean && make # Clean rebuild"
@echo " make test # Build and test"
@echo ""
@echo "The binary will be statically linked with no external dependencies."
@echo "The binary will be linked with system libraries (OpenSSL, curl, secp256k1)."
.PHONY: all clean clean-miner test install uninstall rebuild help

182199
debug.log

File diff suppressed because it is too large Load Diff

BIN
event_miner Executable file

Binary file not shown.

View File

@@ -16,7 +16,10 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include "nostr_core_lib/nostr_core/nostr_core.h"
#include "nostr_core_lib/nostr_core/nostr_common.h" // Common definitions and init/cleanup
#include "nostr_core_lib/nostr_core/nip001.h" // Basic protocol functions
#include "nostr_core_lib/nostr_core/nip013.h" // Proof-of-work functions
#include "nostr_core_lib/nostr_core/nip019.h" // Bech32 decoding for nsec
#include "nostr_core_lib/cjson/cJSON.h"
// Constants
@@ -346,7 +349,10 @@ static void* miner_thread(void* arg) {
void (*progress_cb)(int, uint64_t, void*) = ctx->verbose_enabled ? verbose_pow_callback : NULL;
int result = nostr_add_proof_of_work(local_event, ctx->private_key,
ctx->target_difficulty, progress_cb, ctx);
ctx->target_difficulty, 1000000, // max_attempts
1000, // progress_report_interval
30, // timestamp_update_interval (seconds)
progress_cb, ctx);
attempts++;