Skip to content

Add Intel Mac support with separate build strategy#18

Merged
datlechin merged 11 commits intomainfrom
feat/intel-mac-support
Jan 8, 2026
Merged

Add Intel Mac support with separate build strategy#18
datlechin merged 11 commits intomainfrom
feat/intel-mac-support

Conversation

@datlechin
Copy link
Collaborator

Summary

Adds support for Intel Mac (x86_64) builds while maintaining smaller file sizes through architecture-specific releases.

Changes

  • ✅ Architecture-specific linker flags (OTHER_LDFLAGS[arch=...])
  • ✅ Intel Homebrew paths (/usr/local/opt) for cross-compilation
  • ✅ Build script (build-release.sh) for separate ARM64/x86_64 releases
  • ✅ Complete build documentation (BUILD.md)
  • ✅ Updated .gitignore for build artifacts

Build Size Comparison

Build Type Size Target
ARM64-only 9.4MB Apple Silicon Macs
x86_64-only 9.5MB Intel Macs
Universal 19MB Both architectures

Benefits

  • 50% smaller downloads when distributing separate builds
  • Users only download what they need
  • Standard practice (Discord, Slack, VSCode all use separate builds)
  • Maintains development simplicity (defaults to ARM64-only)

Usage

# Build separate releases (recommended for distribution)
./build-release.sh both

# Or build specific architecture
./build-release.sh arm64
./build-release.sh x86_64

See BUILD.md for complete instructions.

- Add architecture-specific linker flags for ARM64 and x86_64
- Add Intel Homebrew paths (/usr/local/opt) for cross-compilation
- Add build-release.sh script to create separate architecture builds
- Add BUILD.md with build instructions and distribution recommendations
- Update .gitignore to exclude build artifacts
- Restore ARM64-only libmariadb.a as default (9.4MB vs 19MB universal)

Separate builds reduce download size by ~50% (9.5MB each vs 19MB universal).
Users can now build for specific architectures or create universal binaries.
Copilot AI review requested due to automatic review settings January 7, 2026 10:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Intel Mac (x86_64) architecture support to TablePro while maintaining smaller file sizes by implementing separate architecture-specific builds rather than a universal binary. The approach reduces download sizes by approximately 50% (9.4-9.5MB per architecture vs 19MB universal).

Key Changes:

  • Architecture-specific build configuration with separate linker flags and library paths for ARM64 and x86_64
  • New build script (build-release.sh) that automates creation of architecture-specific releases
  • Comprehensive build documentation explaining architecture options and distribution strategies

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 5 comments.

File Description
build-release.sh New build automation script that creates separate ARM64/x86_64 releases by managing architecture-specific libmariadb libraries and xcodebuild invocations
TablePro.xcodeproj/project.pbxproj Adds architecture-specific linker flags and library search paths for both ARM64 (Homebrew at /opt/homebrew) and x86_64 (Homebrew at /usr/local); removes hard-coded ARM64 restriction
BUILD.md New comprehensive documentation covering separate vs universal build options, dependencies for each architecture, size comparisons, and distribution recommendations
.gitignore Adds patterns to exclude build artifacts including the build directory, xcarchive files, and architecture-specific mariadb library variants

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
Phase 1: Build Size Optimization
- Enable DEPLOYMENT_POSTPROCESSING in Release configuration
- Enable COPY_PHASE_STRIP to strip symbols during copy
- Enable DEAD_CODE_STRIPPING to remove unused code
- Results: Binary size reduced from 9.4MB to 3.7MB (~60% reduction)
- Total app size reduced from 12MB to 6MB (~51% reduction)

Phase 2: GitHub Actions Workflow
- Add comprehensive CI/CD pipeline with 5 jobs:
  * lint: SwiftLint strict validation
  * prepare-libs: Create universal libmariadb library
  * build-arm64: Build Apple Silicon binary (parallel)
  * build-x86_64: Build Intel binary (parallel)
  * release: Create GitHub Releases for version tags
- Implement Homebrew caching for faster builds
- Configure artifact retention (7 days for main, 90 days for tags)
- Add path ignores to skip builds on documentation changes
- Support both push to main and version tag triggers

Documentation:
- Update BUILD.md with accurate size references (6MB per architecture)
- Add build optimization section explaining settings
- Update distribution recommendations with correct sizes

Closes optimization work for Intel Mac support.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

datlechin and others added 5 commits January 8, 2026 13:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

datlechin and others added 3 commits January 8, 2026 14:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
This commit addresses all 13 critical/high priority issues identified in
the code review, implementing robust error handling throughout the build
system and CI/CD pipeline.

## Build Script Improvements (build-release.sh)

### CRITICAL-1: Fixed subshell error propagation in prepare_mariadb()
- Removed subshell pattern that hid failures
- Added explicit exit on cd failure
- Added validation for lipo command success
- Added verification that output file was created
- Return to previous directory with error handling

### CRITICAL-2: Fixed DERIVED_DATA pipeline failure detection
- Added validation that DERIVED_DATA is not empty
- Provide detailed error messages with debugging steps
- Capture stderr from xcodebuild

### Build Verification Enhancements
- Added xcodebuild output logging to build-${arch}.log
- Check xcodebuild exit code explicitly
- Verify app bundle exists after build
- Verify binary exists and is not empty
- Verify binary is executable
- Comprehensive error messages for each failure case

### File Operation Validation
- Verify mkdir success
- Verify cp success with detailed error messages
- Safe size extraction with fallback

## GitHub Actions Workflow Improvements (.github/workflows/build.yml)

### CRITICAL-3: Fixed lipo command validation in prepare-libs
- Verify input library files exist before lipo
- Display input architectures for debugging
- Validate lipo command success
- Verify output file was created
- Verify universal library contains both architectures

### CRITICAL-4: Added artifact download verification
- Verify libmariadb_universal.a exists after download
- Show directory contents on failure
- Added to all 3 jobs that download artifacts

### HIGH-1 & HIGH-2: Fixed Rosetta 2 and Homebrew installation
- Verify Rosetta 2 installation success
- Verify Rosetta 2 is functional after install
- Verify Homebrew installation success
- Verify Homebrew binary is functional
- Check Homebrew --version works

### HIGH-3: Added brew install verification
- Verify each package installed successfully
- Verify library files exist at expected paths
- Applied to all brew install steps

### HIGH-4: Implemented real build verification
- Check binary file exists
- Check binary is not empty
- Verify correct architecture (arm64 or x86_64 only)
- Verify no wrong architecture included
- Check executable bit is set
- Applied to both arm64 and x86_64 builds

### HIGH-5: Added ZIP archive validation
- Check app bundle exists before zipping
- Verify zip command success
- Verify ZIP file was created
- Test ZIP integrity with unzip -t
- Applied to both arm64 and x86_64 builds

### HIGH-6: Fixed artifact renaming validation
- Verify VERSION extracted from git ref
- Check source artifacts exist before rename
- Verify mv commands succeed
- Verify renamed files exist

### HIGH-7: Fixed release notes generation edge cases
- Handle case when no previous tag exists
- Graceful fallback to recent commits
- Fallback to "Initial release" if no commits
- Proper error handling in git commands

## Documentation Fixes (BUILD.md)

### MEDIUM Priority: Fixed size inconsistencies
- Updated inline comments from 9.4MB/9.5MB to ~6MB
- Now consistent with size comparison table
- Reflects actual sizes after optimization

## Testing Performed

All changes maintain backward compatibility and improve error visibility:
- Build script tested with missing libmariadb_universal.a
- Verified error messages are clear and actionable
- All validation steps fail fast with helpful diagnostics

## Impact

These fixes transform cryptic failures into clear, actionable error messages:
- Before: "library not found" hours into debugging
- After: "❌ ERROR: ARM64 library not found at: /path - ARM64 Homebrew installation may have failed"

All critical and high priority issues from code review are now resolved.
@datlechin datlechin merged commit 1a2dbc8 into main Jan 8, 2026
2 checks passed
@datlechin datlechin deleted the feat/intel-mac-support branch January 8, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants