Skip to content

Commit 21cff41

Browse files
committed
add support for darwin_arm64:
compile with the right cross-toolchain and intall libusb inside the container the `make install` places `libusb.a` in `/usr/local/include/libusb-1.0` while the `.h` file in `/usr/local/lib/`
1 parent 17f5134 commit 21cff41

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

DistTasks.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,20 @@ tasks:
229229
docker run -v `pwd`/..:/home/build -w /home/build \
230230
-e CGO_ENABLED=1 \
231231
{{.CONTAINER}}:{{.CONTAINER_TAG}} \
232-
--build-cmd "{{.BUILD_COMMAND}}" \
232+
--build-cmd "{{.BUILD_LIBUSB}}{{.BUILD_COMMAND}}" \
233233
-p "{{.BUILD_PLATFORM}}"
234234
235235
tar cz {{.PLATFORM_DIR}} -f {{.PACKAGE_NAME}}
236236
237237
vars:
238238
PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_arm64"
239+
BUILD_LIBUSB: >
240+
curl -L https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 | tar xj &&
241+
cd libusb-1.0.26/ &&
242+
./configure --with-pic --disable-udev --enable-static --disable-shared --host=aarch64-apple-darwin20.4 &&
243+
make -j"$(nproc)" &&
244+
make install &&
245+
cd .. &&
239246
BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}"
240247
BUILD_PLATFORM: "darwin/arm64"
241248
CONTAINER_TAG: "{{.GO_VERSION}}-darwin-arm64-debian10"

0 commit comments

Comments
 (0)