Initial template structure from nostr_core_lib

- Complete C library template with OpenSSL-based crypto
- Comprehensive build system (Makefile, build.sh)
- Example code and test suite
- Documentation and usage guides
- Cross-platform compatibility (x64/ARM64)
- Production-ready structure for C library projects
This commit is contained in:
2025-08-14 15:10:59 -04:00
parent 0ace93e303
commit c109c93382
1920 changed files with 227925 additions and 3398 deletions

View File

@@ -1,71 +0,0 @@
# NOSTR WebSocket Library Makefile
# Production-ready WebSocket implementation for NOSTR protocol
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -O2
INCLUDES = -I. -I.. -I../openssl-install/include
LIBS = -lm -L../openssl-install/lib64 -lssl -lcrypto
# Source files
WEBSOCKET_SOURCES = nostr_websocket_openssl.c ../cjson/cJSON.c
WEBSOCKET_HEADERS = nostr_websocket_tls.h ../cjson/cJSON.h
# Test programs
TEST_SOURCES = test_5_events_clean.c
TEST_PROGRAMS = test_5_events_clean
# Object files
WEBSOCKET_OBJECTS = $(WEBSOCKET_SOURCES:.c=.o)
.PHONY: all clean test
all: $(TEST_PROGRAMS)
# Test programs (if test file exists)
test_5_events_clean: test_5_events_clean.o $(WEBSOCKET_OBJECTS)
$(CC) -o $@ $^ $(LIBS)
# Object file compilation
%.o: %.c $(WEBSOCKET_HEADERS)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
# Test target (if test exists, otherwise use wss_test from tests/)
test:
@if [ -f test_5_events_clean ]; then \
echo "🧪 Running local WebSocket test..."; \
echo "Press Ctrl-C to stop the test"; \
./test_5_events_clean; \
else \
echo "🧪 Running WebSocket test from tests/ directory..."; \
cd ../tests && make wss_test && ./wss_test; \
fi
# Clean build artifacts
clean:
rm -f *.o $(TEST_PROGRAMS)
rm -f ../cjson/*.o
# Display library info
info:
@echo "📚 NOSTR WebSocket Library"
@echo "=========================="
@echo "Core files:"
@echo " - nostr_websocket_tls.h (header)"
@echo " - nostr_websocket_openssl.c (OpenSSL implementation)"
@echo " - ../cjson/cJSON.h/c (JSON support)"
@echo ""
@echo "Dependencies:"
@echo " - OpenSSL (SSL/TLS support)"
@echo " - Standard C libraries"
@echo ""
@echo "Usage:"
@echo " make - Build test programs (if available)"
@echo " make test - Run WebSocket test"
@echo " make clean - Clean build artifacts"
@echo " make info - Show this information"
@echo ""
@echo "Note: This library is integrated into the main libnostr_core.a"
@echo "Use the tests in ../tests/ for comprehensive testing."
# Help target
help: info