Skip to content

Commit ebe40b4

Browse files
committed
added binary for release for both mac archs
1 parent 9d62c1c commit ebe40b4

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ jobs:
5555
include:
5656
- os: ubuntu-latest
5757
artifact_name: onion-linux-x86_64
58-
- os: macos-13
59-
artifact_name: onion-darwin-x86_64
6058
- os: macos-14
61-
artifact_name: onion-darwin-arm64
59+
artifact_name: onion-darwin-universal
6260

6361
steps:
6462
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ jobs:
1717
include:
1818
- os: ubuntu-latest
1919
artifact_name: onion-linux-x86_64
20-
- os: macos-13
21-
artifact_name: onion-darwin-x86_64
2220
- os: macos-14
23-
artifact_name: onion-darwin-arm64
21+
artifact_name: onion-darwin-universal
2422

2523
steps:
2624
- uses: actions/checkout@v4
@@ -67,16 +65,10 @@ jobs:
6765
name: onion-linux-x86_64
6866
path: dalla_data_processing/deduplication/bin/
6967

70-
- name: Download macOS Intel binary
68+
- name: Download macOS universal binary
7169
uses: actions/download-artifact@v4
7270
with:
73-
name: onion-darwin-x86_64
74-
path: dalla_data_processing/deduplication/bin/
75-
76-
- name: Download macOS ARM binary
77-
uses: actions/download-artifact@v4
78-
with:
79-
name: onion-darwin-arm64
71+
name: onion-darwin-universal
8072
path: dalla_data_processing/deduplication/bin/
8173

8274
- name: Set binary permissions

scripts/build_onion.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ make clean 2>/dev/null || true
5959

6060
# Set up compiler flags for macOS
6161
EXTRA_CFLAGS=""
62+
EXTRA_LDFLAGS=""
6263
if [[ "$OSTYPE" == "darwin"* ]]; then
6364
# On macOS, add Homebrew paths for sparsehash
6465
if command -v brew &> /dev/null; then
@@ -68,11 +69,16 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
6869
echo -e "${YELLOW}Using Homebrew prefix: ${BREW_PREFIX}${NC}"
6970
echo -e "${YELLOW}Using sparsehash include: ${SPARSEHASH_PREFIX}/include${NC}"
7071
fi
72+
73+
# Build universal binary for macOS (x86_64 + arm64)
74+
EXTRA_CFLAGS="${EXTRA_CFLAGS} -arch x86_64 -arch arm64"
75+
EXTRA_LDFLAGS="-arch x86_64 -arch arm64"
76+
echo -e "${YELLOW}Building universal binary (x86_64 + arm64)${NC}"
7177
fi
7278

7379
# Build onion
7480
echo -e "${YELLOW}Compiling Onion...${NC}"
75-
if make CFLAGS="-Wall -O3 -std=c++11 ${EXTRA_CFLAGS}"; then
81+
if make CFLAGS="-Wall -O3 -std=c++11 ${EXTRA_CFLAGS}" LDFLAGS="${EXTRA_LDFLAGS}"; then
7682
echo -e "${GREEN}✓ Compilation successful${NC}"
7783
else
7884
echo -e "${RED}✗ Compilation failed${NC}"
@@ -88,6 +94,12 @@ fi
8894
# Get platform info
8995
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
9096
ARCH=$(uname -m)
97+
98+
# On macOS, use "universal" as arch since we build a fat binary
99+
if [[ "$OSTYPE" == "darwin"* ]]; then
100+
ARCH="universal"
101+
fi
102+
91103
echo -e "${YELLOW}Platform: $PLATFORM-$ARCH${NC}"
92104

93105
# Create output directory
@@ -104,6 +116,12 @@ ln -sf "onion-$PLATFORM-$ARCH" "$OUTPUT_DIR/onion"
104116
echo -e "${GREEN}=== Build Complete ===${NC}"
105117
echo -e "${GREEN}Binary location: $OUTPUT_DIR/onion-$PLATFORM-$ARCH${NC}"
106118

119+
# On macOS, verify it's a universal binary
120+
if [[ "$OSTYPE" == "darwin"* ]]; then
121+
echo -e "${YELLOW}Verifying universal binary architectures:${NC}"
122+
lipo -info "$OUTPUT_DIR/onion-$PLATFORM-$ARCH"
123+
fi
124+
107125
# Verify binary works
108126
if "$OUTPUT_DIR/onion-$PLATFORM-$ARCH" -h &> /dev/null; then
109127
echo -e "${GREEN}✓ Binary is executable and working${NC}"

0 commit comments

Comments
 (0)