diff --git a/Cargo.toml b/Cargo.toml index e755602..4350709 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "rlogg" version = "0.1.0" edition = "2024" -authors = ["Your Name "] +authors = ["Stanislav Pastushenko "] description = "A fast log file viewer with search, filtering, and highlighting capabilities" license = "MIT OR Apache-2.0" repository = "https://github.com/yourusername/rlogg" diff --git a/Cross.toml b/Cross.toml index cbb2035..a8a8d76 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,5 +1,10 @@ # Cross-compilation configuration for the 'cross' tool +# Build configuration - ensure build scripts run in container +[build] +# Run build scripts in the cross container to avoid GLIBC mismatches +default-target = "x86_64-pc-windows-gnu" + # Windows GNU target (MinGW) - fully supported [target.x86_64-pc-windows-gnu] # Use edge image with newer GLIBC to avoid build script issues @@ -10,6 +15,12 @@ pre-build = [ "dpkg --add-architecture i386", ] +# Build environment configuration +[build.env] +passthrough = [ + "CARGO_BUILD_TARGET", +] + # Note: MSVC target is not supported by cross from Linux # MSVC requires proprietary Microsoft tools that only run on Windows # Use the GNU target for Windows cross-compilation from Linux diff --git a/build-release.sh b/build-release.sh index 9e90abd..96e5316 100755 --- a/build-release.sh +++ b/build-release.sh @@ -13,6 +13,11 @@ GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color +# Extract version from Cargo.toml +VERSION=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/') +echo "Version: $VERSION" +echo "" + # Create dist directory DIST_DIR="dist" mkdir -p "$DIST_DIR" @@ -27,15 +32,15 @@ build_target() { if cargo build --release --target "$target"; then echo -e "${GREEN}✓ Build successful for $name${NC}" - # Copy binary to dist directory + # Copy binary to dist directory with version if [[ "$target" == *"windows"* ]]; then - cp "target/$target/release/rlogg.exe" "$DIST_DIR/rlogg-$name.exe" - echo -e "${GREEN}✓ Binary copied to $DIST_DIR/rlogg-$name.exe${NC}" + cp "target/$target/release/rlogg.exe" "$DIST_DIR/rlogg-$VERSION-$name.exe" + echo -e "${GREEN}✓ Binary copied to $DIST_DIR/rlogg-$VERSION-$name.exe${NC}" else - cp "target/$target/release/rlogg" "$DIST_DIR/rlogg-$name" + cp "target/$target/release/rlogg" "$DIST_DIR/rlogg-$VERSION-$name" # Strip binary on Unix-like systems - strip "$DIST_DIR/rlogg-$name" 2>/dev/null || true - echo -e "${GREEN}✓ Binary copied to $DIST_DIR/rlogg-$name${NC}" + strip "$DIST_DIR/rlogg-$VERSION-$name" 2>/dev/null || true + echo -e "${GREEN}✓ Binary copied to $DIST_DIR/rlogg-$VERSION-$name${NC}" fi echo "" return 0 diff --git a/cross-compile.sh b/cross-compile.sh index bebfe52..a06851f 100755 --- a/cross-compile.sh +++ b/cross-compile.sh @@ -14,6 +14,11 @@ YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color +# Extract version from Cargo.toml +VERSION=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/') +echo "Version: $VERSION" +echo "" + # Create dist directory DIST_DIR="dist" mkdir -p "$DIST_DIR" @@ -37,17 +42,21 @@ build_with_cross() { echo -e "${BLUE}=== Building for $name ===${NC}" echo -e "${YELLOW}Target: $target${NC}" + # Clean build artifacts to avoid GLIBC mismatch with build scripts + echo -e "${YELLOW}Cleaning build artifacts...${NC}" + cargo clean --release --target "$target" + if cross build --release --target "$target"; then echo -e "${GREEN}✓ Build successful for $name${NC}" - # Copy binary to dist directory + # Copy binary to dist directory with version if [[ "$target" == *"windows"* ]]; then - cp "target/$target/release/rlogg.exe" "$DIST_DIR/rlogg-$name.exe" - echo -e "${GREEN}✓ Binary: $DIST_DIR/rlogg-$name.exe${NC}" + cp "target/$target/release/rlogg.exe" "$DIST_DIR/rlogg-$VERSION-$name.exe" + echo -e "${GREEN}✓ Binary: $DIST_DIR/rlogg-$VERSION-$name.exe${NC}" else - cp "target/$target/release/rlogg" "$DIST_DIR/rlogg-$name" - strip "$DIST_DIR/rlogg-$name" 2>/dev/null || true - echo -e "${GREEN}✓ Binary: $DIST_DIR/rlogg-$name${NC}" + cp "target/$target/release/rlogg" "$DIST_DIR/rlogg-$VERSION-$name" + strip "$DIST_DIR/rlogg-$VERSION-$name" 2>/dev/null || true + echo -e "${GREEN}✓ Binary: $DIST_DIR/rlogg-$VERSION-$name${NC}" fi return 0 else @@ -63,9 +72,9 @@ build_native() { if cargo build --release; then echo -e "${GREEN}✓ Build successful for Linux${NC}" - cp "target/release/rlogg" "$DIST_DIR/rlogg-linux-x86_64" - strip "$DIST_DIR/rlogg-linux-x86_64" 2>/dev/null || true - echo -e "${GREEN}✓ Binary: $DIST_DIR/rlogg-linux-x86_64${NC}" + cp "target/release/rlogg" "$DIST_DIR/rlogg-$VERSION-linux-x86_64" + strip "$DIST_DIR/rlogg-$VERSION-linux-x86_64" 2>/dev/null || true + echo -e "${GREEN}✓ Binary: $DIST_DIR/rlogg-$VERSION-linux-x86_64${NC}" return 0 else echo -e "${RED}✗ Build failed for Linux${NC}"