Skip to content

Commit 3a9f51c

Browse files
committed
standardise to ARCH-OS-ABI
1 parent 45837f9 commit 3a9f51c

File tree

6 files changed

+73
-63
lines changed

6 files changed

+73
-63
lines changed

.github/workflows/edgetpu_runtime.yml

+43-43
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,35 @@ jobs:
2222
run: DOCKER_TARGETS=libedgetpu make docker-build
2323
- name: Release
2424
run: |
25-
mkdir -p edgetpu_runtime
26-
mv out edgetpu_runtime/libedgetpu
27-
cp ./tflite/public/edgetpu.h edgetpu_runtime/libedgetpu/
28-
cp ./tflite/public/edgetpu_c.h edgetpu_runtime/libedgetpu/
29-
cp ./debian/edgetpu-accelerator.rules edgetpu_runtime/libedgetpu/
30-
cp ./LICENSE edgetpu_runtime/libedgetpu/
31-
cp ./scripts/*.sh edgetpu_runtime/
32-
export ZIP_FILENAME="edgetpu_runtime_$(date '+%Y%m%d')_linux"
33-
zip -r -9 -y "${ZIP_FILENAME}" edgetpu_runtime
25+
export PACK_DIR=edgetpu_runtime
26+
27+
export LIBEDGETPU_NAME=k8
28+
export TRIPLET=x86_64-linux-gnu
29+
bash scripts/pack.sh out "${LIBEDGETPU_NAME}" "${TRIPLET}" "${PACK_DIR}"
30+
export ZIP_FILENAME="edgetpu_runtime_${TRIPLET}_$(date '+%Y%m%d')"
31+
zip -r -9 -y "${ZIP_FILENAME}.zip" "${PACK_DIR}"
32+
rm -rf "${PACK_DIR}"
33+
34+
export LIBEDGETPU_NAME=armv7a
35+
export TRIPLET=armv7l-linux-gnueabihf
36+
bash scripts/pack.sh out "${LIBEDGETPU_NAME}" "${TRIPLET}" "${PACK_DIR}"
37+
export ZIP_FILENAME="edgetpu_runtime_${TRIPLET}_$(date '+%Y%m%d')"
38+
zip -r -9 -y "${ZIP_FILENAME}.zip" "${PACK_DIR}"
39+
rm -rf "${PACK_DIR}"
40+
41+
export LIBEDGETPU_NAME=aarch64
42+
export TRIPLET=aarch64-linux-gnu
43+
bash scripts/pack.sh out "${LIBEDGETPU_NAME}" "${TRIPLET}" "${PACK_DIR}"
44+
export ZIP_FILENAME="edgetpu_runtime_${TRIPLET}_$(date '+%Y%m%d')"
45+
zip -r -9 -y "${ZIP_FILENAME}.zip" "${PACK_DIR}"
46+
rm -rf "${PACK_DIR}"
47+
48+
export LIBEDGETPU_NAME=riscv64
49+
export TRIPLET=riscv64-linux-gnu
50+
bash scripts/pack.sh out "${LIBEDGETPU_NAME}" "${TRIPLET}" "${PACK_DIR}"
51+
export ZIP_FILENAME="edgetpu_runtime_${TRIPLET}_$(date '+%Y%m%d')"
52+
zip -r -9 -y "${ZIP_FILENAME}.zip" "${PACK_DIR}"
53+
rm -rf "${PACK_DIR}"
3454
- uses: softprops/action-gh-release@v1
3555
with:
3656
tag_name: grouper
@@ -74,41 +94,21 @@ jobs:
7494
fi
7595
- name: Release
7696
run: |
77-
mkdir -p edgetpu_runtime
78-
mv out edgetpu_runtime/libedgetpu
79-
cp ./tflite/public/edgetpu.h edgetpu_runtime/libedgetpu/
80-
cp ./tflite/public/edgetpu_c.h edgetpu_runtime/libedgetpu/
81-
cp ./LICENSE edgetpu_runtime/libedgetpu/
82-
cp ./scripts/*.sh edgetpu_runtime/
83-
export ZIP_FILENAME="edgetpu_runtime_$(date '+%Y%m%d')_macos"
84-
zip -r -9 -y "${ZIP_FILENAME}" edgetpu_runtime
85-
- uses: softprops/action-gh-release@v1
86-
with:
87-
tag_name: grouper
88-
files: "edgetpu_runtime_*.zip"
97+
export PACK_DIR=edgetpu_runtime
8998
90-
build_windows:
91-
runs-on: ubuntu-20.04
92-
steps:
93-
- name: Download official builds
94-
run: |
95-
# too much pain to acutally build this on windows
96-
# I gave up... Just download official builds...
97-
wget https://github.com/google-coral/libedgetpu/releases/download/release-grouper/edgetpu_runtime_20220308.zip
98-
unzip edgetpu_runtime_20220308.zip
99-
rm -f edgetpu_runtime_20220308.zip
100-
mv edgetpu_runtime edgetpu_runtime_20220308
101-
mkdir -p edgetpu_runtime/libedgetpu
102-
cp -a ./edgetpu_runtime_20220308/*.bat edgetpu_runtime
103-
cp -a ./edgetpu_runtime_20220308/third_party edgetpu_runtime/third_party
104-
cp ./edgetpu_runtime_20220308/libedgetpu/edgetpu.h edgetpu_runtime/libedgetpu/
105-
cp ./edgetpu_runtime_20220308/libedgetpu/edgetpu_c.h edgetpu_runtime/libedgetpu/
106-
mkdir -p edgetpu_runtime/libedgetpu/throttled
107-
cp -a ./edgetpu_runtime_20220308/libedgetpu/throttled/x64_windows edgetpu_runtime/libedgetpu/throttled/
108-
mkdir -p edgetpu_runtime/libedgetpu/direct
109-
cp -a ./edgetpu_runtime_20220308/libedgetpu/direct/x64_windows edgetpu_runtime/libedgetpu/direct/
110-
export ZIP_FILENAME="edgetpu_runtime_$(date '+%Y%m%d')_windows"
111-
zip -r -9 -y "${ZIP_FILENAME}" edgetpu_runtime
99+
export LIBEDGETPU_NAME=darwin_arm64
100+
export TRIPLET=arm64-apple-darwin
101+
bash scripts/pack.sh out "${LIBEDGETPU_NAME}" "${TRIPLET}" "${PACK_DIR}"
102+
export ZIP_FILENAME="edgetpu_runtime_${TRIPLET}_$(date '+%Y%m%d')"
103+
zip -r -9 -y "${ZIP_FILENAME}.zip" "${PACK_DIR}"
104+
rm -rf "${PACK_DIR}"
105+
106+
export LIBEDGETPU_NAME=darwin_x86_64
107+
export TRIPLET=x86_64-apple-darwin
108+
bash scripts/pack.sh out "${LIBEDGETPU_NAME}" "${TRIPLET}" "${PACK_DIR}"
109+
export ZIP_FILENAME="edgetpu_runtime_${TRIPLET}_$(date '+%Y%m%d')"
110+
zip -r -9 -y "${ZIP_FILENAME}.zip" "${PACK_DIR}"
111+
rm -rf "${PACK_DIR}"
112112
- uses: softprops/action-gh-release@v1
113113
with:
114114
tag_name: grouper

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ else
3333
$(error $(OS) is not supported)
3434
endif
3535

36-
ifeq ($(filter $(CPU),k8 armv7a aarch64 riscv64 s390x ppc64el darwin_arm64 darwin_x86_64),)
37-
$(error CPU must be k8, armv7a, aarch64, riscv64, s390x, ppc64el, darwin_arm64, or darwin_x86_64)
36+
ifeq ($(filter $(CPU),k8 armv7a aarch64 riscv64 darwin_arm64 darwin_x86_64),)
37+
$(error CPU must be k8, armv7a, aarch64, riscv64, darwin_arm64, or darwin_x86_64)
3838
endif
3939

4040
COMPILATION_MODE ?= opt
@@ -153,7 +153,7 @@ clean:
153153
DOCKER_CONTEXT_DIR := $(MAKEFILE_DIR)/docker
154154
DOCKER_WORKSPACE := $(MAKEFILE_DIR)
155155
DOCKER_CONTAINER_WORKSPACE := /workspace
156-
DOCKER_CPUS ?= k8 armv7a aarch64 riscv64 s390x ppc64el
156+
DOCKER_CPUS ?= k8 armv7a aarch64 riscv64
157157
DOCKER_TARGETS ?=
158158
DOCKER_IMAGE ?= ubuntu:20.04
159159
DOCKER_TAG_BASE ?= libedgetpu-cross

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ There are three ways to build libedgetpu:
1717
Build Linux binaries inside Docker container (works on Linux and macOS):
1818
```
1919
$ DOCKER_CPUS="k8" DOCKER_IMAGE="ubuntu:18.04" DOCKER_TARGETS=libedgetpu make docker-build
20-
$ DOCKER_CPUS="armv7a aarch64 riscv64 s390x ppc64el" DOCKER_IMAGE="ubuntu:20.04" DOCKER_TARGETS=libedgetpu make docker-build
20+
$ DOCKER_CPUS="armv7a aarch64 riscv64" DOCKER_IMAGE="ubuntu:20.04" DOCKER_TARGETS=libedgetpu make docker-build
2121
```
2222

2323
All built binaries go to the `out` directory. Note that the bazel-* are not copied to the host from the Docker container.
@@ -36,13 +36,11 @@ Build native binaries on Windows:
3636
$ build.bat
3737
```
3838

39-
Cross-compile for ARMv7-A (32 bit), ARMv8-A (64 bit), RISC-V (64 bit), s390x, ppc64el (PowerPC 64 bit little-endian) on Linux:
39+
Cross-compile for ARMv7-A (32 bit), ARMv8-A (64 bit), and RISC-V (64 bit) on Linux:
4040
```
4141
$ CPU=armv7a make
4242
$ CPU=aarch64 make
4343
$ CPU=riscv64 make
44-
$ CPU=s390x make
45-
$ CPU=ppc64el make
4644
```
4745

4846
### Makefile

docker/Dockerfile

-10
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,27 @@ RUN /update_sources.sh
2020
RUN dpkg --add-architecture armhf
2121
RUN dpkg --add-architecture arm64
2222
RUN dpkg --add-architecture riscv64
23-
RUN dpkg --add-architecture s390x
24-
RUN dpkg --add-architecture ppc64el
2523

2624
RUN apt-get update \
2725
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
2826
libc6-dev:arm64 \
2927
libc6-dev:armhf \
3028
libc6-dev:riscv64 \
31-
libc6-dev:s390x \
32-
libc6-dev:ppc64el \
3329
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
3430
python3-all \
3531
python3-numpy \
3632
build-essential \
3733
crossbuild-essential-armhf \
3834
crossbuild-essential-arm64 \
3935
crossbuild-essential-riscv64 \
40-
crossbuild-essential-s390x \
41-
crossbuild-essential-ppc64el \
4236
libusb-1.0-0-dev \
4337
libusb-1.0-0-dev:arm64 \
4438
libusb-1.0-0-dev:armhf \
4539
libusb-1.0-0-dev:riscv64 \
46-
libusb-1.0-0-dev:s390x \
47-
libusb-1.0-0-dev:ppc64el \
4840
zlib1g-dev \
4941
zlib1g-dev:armhf \
5042
zlib1g-dev:arm64 \
5143
zlib1g-dev:riscv64 \
52-
zlib1g-dev:s390x \
53-
zlib1g-dev:ppc64el \
5444
sudo \
5545
debhelper \
5646
pkg-config \

docker/update_sources.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
sed -i "s/deb\ /deb \[arch=amd64\]\ /g" /etc/apt/sources.list
2020

2121
cat <<EOT >> /etc/apt/sources.list
22-
deb [arch=arm64,armhf,riscv64,s390x,ppc64el] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME} main universe
23-
deb [arch=arm64,armhf,riscv64,s390x,ppc64el] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-updates main universe
24-
deb [arch=arm64,armhf,riscv64,s390x,ppc64el] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-security main universe
22+
deb [arch=arm64,armhf,riscv64] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME} main universe
23+
deb [arch=arm64,armhf,riscv64] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-updates main universe
24+
deb [arch=arm64,armhf,riscv64] http://ports.ubuntu.com/ubuntu-ports ${UBUNTU_CODENAME}-security main universe
2525
EOT

scripts/pack.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
OUT_DIR="$1"
4+
LIBEDGETPU_NAME="$2"
5+
TRIPLET="$3"
6+
PACK_DIR="$4"
7+
8+
OUT_DIRECT_DIR="${OUT_DIR}/direct/${LIBEDGETPU_NAME}"
9+
OUT_THROTTLED_DIR="${OUT_DIR}/throttled/${LIBEDGETPU_NAME}"
10+
PACK_LIBEDGETPU_DIR="${PACK_DIR}/libedgetpu"
11+
PACK_LIBEDGETPU_DIRECT_DIR="${PACK_LIBEDGETPU_DIR}/direct/${TRIPLET}"
12+
PACK_LIBEDGETPU_THROTTLED_DIR="${PACK_LIBEDGETPU_DIR}/throttled/${TRIPLET}"
13+
mkdir -p "${PACK_LIBEDGETPU_DIR}/direct"
14+
mkdir -p "${PACK_LIBEDGETPU_DIR}/throttled"
15+
mv "${OUT_DIRECT_DIR}" "${PACK_LIBEDGETPU_DIRECT_DIR}"
16+
mv "${OUT_THROTTLED_DIR}" "${PACK_LIBEDGETPU_THROTTLED_DIR}"
17+
cp ./tflite/public/edgetpu.h "${PACK_LIBEDGETPU_DIR}"
18+
cp ./tflite/public/edgetpu_c.h "${PACK_LIBEDGETPU_DIR}"
19+
cp ./debian/edgetpu-accelerator.rules "${PACK_LIBEDGETPU_DIR}"
20+
cp ./LICENSE "${PACK_LIBEDGETPU_DIR}"
21+
cp ./scripts/install.sh "${PACK_DIR}"
22+
cp ./scripts/uninstall.sh "${PACK_DIR}"

0 commit comments

Comments
 (0)