mod makefile and install script for linux x86 - update 2
This commit is contained in:
99
Makefile
99
Makefile
@@ -45,7 +45,9 @@ help:
|
||||
@echo "📦 Vendoring (for offline/air-gapped use):"
|
||||
@echo " make vendor-macos - Build macOS ARM64 wheels (requires macOS native)"
|
||||
@echo " make vendor-linux - Build Linux x86_64 wheels (Docker - any OS)"
|
||||
@echo " make vendor-all - Build wheels for both platforms (macOS native + Docker)"
|
||||
@echo " make vendor-linux-dev - Build Linux x86_64 dev wheels (includes pytest)"
|
||||
@echo " make vendor-all - Build runtime wheels for both platforms"
|
||||
@echo " make vendor-all-dev - Build runtime + dev wheels for all platforms"
|
||||
@echo " make verify-vendor - Test offline installation from vendor/"
|
||||
@echo ""
|
||||
@echo "🔨 Binary Distribution:"
|
||||
@@ -61,16 +63,18 @@ help:
|
||||
@echo " make clean-release - Remove all release artifacts"
|
||||
@echo ""
|
||||
@echo "🛠️ Development workflow (works on macOS + Linux):"
|
||||
@echo " make install - Create venv and install runtime dependencies"
|
||||
@echo " make install-offline - Install runtime deps from vendor/ (offline)"
|
||||
@echo " make install-dev-offline - Install runtime + dev deps from vendor/ (offline)"
|
||||
@echo " make test - Run test suite"
|
||||
@echo " make build-image - Build Docker image (Python 3.12)"
|
||||
@echo " make wheels - Build wheels into ./$(WHEELHOUSE)"
|
||||
@echo " make install - Create venv and install dependencies"
|
||||
@echo " make test - Run test suite"
|
||||
@echo " make up - Start warm dev container"
|
||||
@echo " make shell - Open shell in warm container"
|
||||
@echo " make down - Stop and remove dev container"
|
||||
@echo ""
|
||||
@echo "🧹 Cleanup:"
|
||||
@echo " make clean - Remove venv, wheelhouse, vendor/"
|
||||
@echo " make clean - Remove venv, wheelhouse (keeps vendor/)"
|
||||
@echo " make clean-vendor - Remove vendor/ only"
|
||||
@echo " make clean-release - Remove releases/ only"
|
||||
@echo ""
|
||||
@@ -80,14 +84,9 @@ help:
|
||||
@echo "Platform notes:"
|
||||
@echo " • vendor-macos requires native macOS (uses .venv312 with ARM64 Python)"
|
||||
@echo " • vendor-linux works on any platform with Docker"
|
||||
@echo " • vendor-linux-dev includes pytest for offline development"
|
||||
@echo " • binary-linux works on any platform with Docker"
|
||||
@echo " • All other targets work on macOS and Linux"
|
||||
@echo "🛠️ Development workflow (works on macOS + Linux):"
|
||||
@echo " make install-dev - Create venv and install dev dependencies (includes pytest)"
|
||||
@echo " make install - Create venv and install production dependencies only"
|
||||
@echo " make test - Run test suite (requires install-dev)"
|
||||
@echo " make test-all - Install dev deps + run all tests"
|
||||
|
||||
|
||||
# ---------- Build reusable image ----------
|
||||
.PHONY: build-image
|
||||
@@ -108,6 +107,26 @@ vendor-macos: requirements.txt
|
||||
cd $(VENDOR_MACOS) && shasum -a 256 *.whl > SHA256SUMS
|
||||
@echo "✓ macOS ARM64 wheels: $(VENDOR_MACOS)/"
|
||||
|
||||
.PHONY: vendor-linux
|
||||
vendor-linux: requirements.txt
|
||||
@echo "Building Linux x86_64 wheels (Docker)..."
|
||||
mkdir -p $(VENDOR_LINUX)
|
||||
docker run --rm \
|
||||
--platform linux/amd64 \
|
||||
-v "$$PWD":$(WORKDIR) \
|
||||
-w $(WORKDIR) \
|
||||
python:3.12-slim \
|
||||
bash -c " \
|
||||
set -e && \
|
||||
apt-get update -qq && apt-get install -y -qq gcc g++ make libffi-dev && \
|
||||
pip install --upgrade pip && \
|
||||
pip download --dest $(VENDOR_LINUX) -r requirements.txt && \
|
||||
pip wheel --wheel-dir $(VENDOR_LINUX) --no-deps $(VENDOR_LINUX)/*.tar.gz 2>/dev/null || true && \
|
||||
rm -f $(VENDOR_LINUX)/*.tar.gz && \
|
||||
cd $(VENDOR_LINUX) && sha256sum *.whl > SHA256SUMS \
|
||||
"
|
||||
@echo "✓ Linux x86_64 wheels: $(VENDOR_LINUX)/"
|
||||
|
||||
.PHONY: vendor-linux-dev
|
||||
vendor-linux-dev: requirements-dev.txt
|
||||
@echo "Building Linux x86_64 dev wheels (Docker)..."
|
||||
@@ -128,24 +147,26 @@ vendor-linux-dev: requirements-dev.txt
|
||||
"
|
||||
@echo "✓ Linux x86_64 dev wheels: $(VENDOR_LINUX)-dev/"
|
||||
|
||||
.PHONY: vendor-all-dev
|
||||
vendor-all-dev: vendor-linux vendor-linux-dev
|
||||
@echo ""
|
||||
@echo "✓ All platform wheels (runtime + dev):"
|
||||
@echo " Linux x86_64 (runtime): $(VENDOR_LINUX)/"
|
||||
@echo " Linux x86_64 (dev): $(VENDOR_LINUX)-dev/"
|
||||
|
||||
|
||||
|
||||
.PHONY: vendor-all
|
||||
vendor-all: vendor-macos vendor-linux
|
||||
@echo ""
|
||||
@echo "✓ All platforms vendored:"
|
||||
@echo "✓ All platforms vendored (runtime only):"
|
||||
@echo " macOS ARM64: $(VENDOR_MACOS)/ ($$(ls $(VENDOR_MACOS)/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||
@echo " Linux x86_64: $(VENDOR_LINUX)/ ($$(ls $(VENDOR_LINUX)/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||
@echo ""
|
||||
@echo "Commit with: git add vendor/ && git commit -m 'vendor: update wheels'"
|
||||
|
||||
.PHONY: vendor-all-dev
|
||||
vendor-all-dev: vendor-linux vendor-linux-dev
|
||||
@echo ""
|
||||
@echo "✓ All platform wheels (runtime + dev):"
|
||||
@echo " Linux x86_64 (runtime): $(VENDOR_LINUX)/ ($$(ls $(VENDOR_LINUX)/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||
@echo " Linux x86_64 (dev): $(VENDOR_LINUX)-dev/ ($$(ls $(VENDOR_LINUX)-dev/*.whl 2>/dev/null | wc -l | xargs) wheels)"
|
||||
@echo ""
|
||||
@echo "For macOS dev wheels, run on native macOS:"
|
||||
@echo " python3.12 -m venv .venv312 && source .venv312/bin/activate"
|
||||
@echo " pip download --dest vendor/macos-arm64-dev -r requirements-dev.txt"
|
||||
|
||||
.PHONY: verify-vendor
|
||||
verify-vendor:
|
||||
@echo "Testing offline installation from vendor/..."
|
||||
@@ -159,7 +180,6 @@ verify-vendor:
|
||||
python3.12 -m venv .venv-verify && \
|
||||
source .venv-verify/bin/activate && \
|
||||
pip install --no-index --find-links=vendor/$$PLATFORM -r requirements.txt && \
|
||||
pytest -v tests/test_vectors.py && \
|
||||
python src/pyhdwallet.py test && \
|
||||
echo "" && \
|
||||
echo "✅ Vendor installation verified!" && \
|
||||
@@ -167,6 +187,17 @@ verify-vendor:
|
||||
rm -rf .venv-verify \
|
||||
'
|
||||
|
||||
# ---------- Offline Installation ----------
|
||||
.PHONY: install-offline
|
||||
install-offline:
|
||||
@echo "Installing from vendor/ (runtime only)..."
|
||||
@./install_offline.sh
|
||||
|
||||
.PHONY: install-dev-offline
|
||||
install-dev-offline:
|
||||
@echo "Installing from vendor/ (dev mode with pytest)..."
|
||||
@./install_offline.sh --dev
|
||||
|
||||
# ---------- Binary Building ----------
|
||||
.PHONY: binary
|
||||
binary:
|
||||
@@ -233,27 +264,6 @@ test:
|
||||
pytest -v tests/test_vectors.py && \
|
||||
python src/pyhdwallet.py test
|
||||
|
||||
.PHONY: install-dev
|
||||
install-dev: requirements-dev.txt
|
||||
@if [ ! -d "$(VENV_HOST)" ]; then \
|
||||
echo "Creating venv: $(VENV_HOST)"; \
|
||||
python3.12 -m venv $(VENV_HOST); \
|
||||
fi
|
||||
. $(VENV_HOST)/bin/activate && \
|
||||
pip install --upgrade pip && \
|
||||
pip install -r requirements-dev.txt && \
|
||||
echo "✓ Development environment ready: $(VENV_HOST)" && \
|
||||
echo " Installed: production deps + pytest"
|
||||
|
||||
.PHONY: test-all
|
||||
test-all: install-dev
|
||||
@. $(VENV_HOST)/bin/activate && \
|
||||
pytest -v tests/test_vectors.py && \
|
||||
python src/pyhdwallet.py test && \
|
||||
echo "" && \
|
||||
echo "✅ All tests passed!"
|
||||
|
||||
|
||||
# ---------- Warm container lifecycle ----------
|
||||
.PHONY: up
|
||||
up: build-image
|
||||
@@ -285,7 +295,6 @@ clean: down
|
||||
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
|
||||
# NOTE: vendor/ is kept (use 'make clean-vendor' to remove)
|
||||
|
||||
|
||||
# ---------- Platform-Aware Operations ----------
|
||||
.PHONY: info
|
||||
info:
|
||||
@@ -297,7 +306,7 @@ info:
|
||||
@echo " Docker: $(shell docker --version 2>/dev/null || echo 'not found')"
|
||||
|
||||
# ---------- Release Management ----------
|
||||
VERSION := $(shell grep 'VERSION = ' src/pyhdwallet.py | head -1 | sed 's/.*"\(.*\)".*/\1/' || echo "v1.1.0")
|
||||
VERSION := v1.1.0
|
||||
RELEASE_DIR := releases/$(VERSION)
|
||||
|
||||
.PHONY: release-prep
|
||||
@@ -350,8 +359,6 @@ release: release-checksums
|
||||
@echo " 2. Tag: git tag -a $(VERSION) -m 'Release $(VERSION)'"
|
||||
@echo " 3. Push: git push origin $(VERSION)"
|
||||
|
||||
|
||||
|
||||
.PHONY: release-test
|
||||
release-test:
|
||||
@echo "🧪 Testing release binaries..."
|
||||
|
||||
Reference in New Issue
Block a user