Add Intel Mac support with separate build strategy#18
Conversation
- 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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>
There was a problem hiding this comment.
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.
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.
Summary
Adds support for Intel Mac (x86_64) builds while maintaining smaller file sizes through architecture-specific releases.
Changes
OTHER_LDFLAGS[arch=...])/usr/local/opt) for cross-compilationbuild-release.sh) for separate ARM64/x86_64 releasesBUILD.md).gitignorefor build artifactsBuild Size Comparison
Benefits
Usage
See
BUILD.mdfor complete instructions.