Files
cthulhu/build-local.sh
Storm Dragon 05a4f90af2 Add local development infrastructure and documentation
Add essential development tools and documentation for Cthulhu development:

Development Scripts:
- build-local.sh: Local build and install to ~/.local
- clean-local.sh: Clean build artifacts and local installation
- test-local.sh: Test local installation

Documentation:
- README-REMOTE-CONTROLLER.md: D-Bus service API documentation
- README-DEVELOPMENT.md: Development workflow documentation
- .gitignore: Updated with local build artifact patterns

These tools enable efficient local development without system-wide installation
and provide proper documentation for the D-Bus remote control capabilities.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 14:03:48 -04:00

81 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Local build script for Cthulhu development
# Builds and installs Cthulhu to ~/.local without touching system installation
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}=== Cthulhu Local Build Script ===${NC}"
# Check if we're in the right directory
if [[ ! -f "configure.ac" ]]; then
echo -e "${RED}Error: Not in Cthulhu source directory (configure.ac not found)${NC}"
exit 1
fi
# Check dependencies
echo -e "${YELLOW}Checking dependencies...${NC}"
if ! command -v autoreconf &> /dev/null; then
echo -e "${RED}Error: autoreconf not found. Install autotools.${NC}"
exit 1
fi
if ! python3 -c "import dasbus" 2>/dev/null; then
echo -e "${YELLOW}Warning: dasbus not available. D-Bus service will be disabled.${NC}"
fi
# Clean previous build artifacts (optional)
if [[ "$1" == "--clean" ]]; then
echo -e "${YELLOW}Cleaning previous build...${NC}"
make distclean 2>/dev/null || true
rm -rf autom4te.cache configure config.status Makefile
fi
# Set local installation prefix
LOCAL_PREFIX="$HOME/.local"
echo -e "${YELLOW}Installing to: ${LOCAL_PREFIX}${NC}"
# Regenerate autotools files
echo -e "${YELLOW}Regenerating autotools files...${NC}"
autoreconf -fiv
# Configure for local installation
echo -e "${YELLOW}Configuring...${NC}"
./configure --prefix="$LOCAL_PREFIX" \
--sysconfdir="$LOCAL_PREFIX/etc" \
--localstatedir="$LOCAL_PREFIX/var" \
--disable-help
# Build
echo -e "${YELLOW}Building...${NC}"
make -j$(nproc)
# Install locally
echo -e "${YELLOW}Installing to local prefix...${NC}"
make install || {
echo -e "${YELLOW}Warning: make install had errors, but checking if binary was created...${NC}"
if [[ -f "$LOCAL_PREFIX/bin/cthulhu" ]]; then
echo -e "${GREEN}Binary successfully installed despite makefile warnings.${NC}"
else
echo -e "${RED}Installation failed.${NC}"
exit 1
fi
}
echo -e "${GREEN}=== Build Complete ===${NC}"
echo -e "${GREEN}Cthulhu installed to: ${LOCAL_PREFIX}${NC}"
echo -e "${GREEN}Binary location: ${LOCAL_PREFIX}/bin/cthulhu${NC}"
echo ""
echo -e "${YELLOW}To run local Cthulhu:${NC}"
echo -e " ${LOCAL_PREFIX}/bin/cthulhu"
echo ""
echo -e "${YELLOW}To add to PATH (add to ~/.bashrc):${NC}"
echo -e " export PATH=\"${LOCAL_PREFIX}/bin:\$PATH\""
echo ""
echo -e "${YELLOW}To uninstall local build:${NC}"
echo -e " ./clean-local.sh"