Skip to content

Commit 3223de6

Browse files
committed
feat: add build script
1 parent e0aed12 commit 3223de6

File tree

2 files changed

+1546
-0
lines changed

2 files changed

+1546
-0
lines changed

build.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -e # Stop on the first error
3+
4+
PROJECT_DIR=$(pwd)
5+
6+
cleanup() {
7+
printf "\nINFO: Cleaning up tmp directory\n"
8+
cd $PROJECT_DIR
9+
rm -rf tmp
10+
}
11+
12+
trap 'cleanup' ERR
13+
14+
printf "INFO: Activating IDF virtual environment\n"
15+
. ${1:-$HOME/esp/esp-idf/export.sh}
16+
17+
printf "INFO: Creating and entering tmp directory\n"
18+
mkdir tmp
19+
cd tmp
20+
21+
printf "\nINFO: Cloning and entering esp-homekit-sdk repo\n"
22+
git clone --recursive https://github.com/espressif/esp-homekit-sdk.git
23+
cd esp-homekit-sdk
24+
25+
COMMIT="040b0f301223ebc6995597328e5a5cc9f9739a02"
26+
printf "\nINFO: Checking out to commit $COMMIT\n"
27+
git checkout $COMMIT
28+
29+
printf "\nINFO: Copying sdkconfig to esp-homekit-sdk fan example\n"
30+
cp $PROJECT_DIR/sdkconfig examples/fan/
31+
32+
printf "\nBuilding fan example\n"
33+
cd examples/fan/
34+
idf.py build
35+
36+
printf "\nINFO: Copying compiled libraries to project's lib directory\n"
37+
cd build/esp-idf
38+
cp esp_hap_*/*.a $PROJECT_DIR/lib/
39+
cp hkdf-sha/*.a $PROJECT_DIR/lib/
40+
cp json_generator/*.a $PROJECT_DIR/lib/
41+
cp json_parser/*.a $PROJECT_DIR/lib/
42+
cp mu_srp/*.a $PROJECT_DIR/lib/
43+
44+
printf "\nINFO: Copying header files for main libraries to project's include directory\n"
45+
cd $PROJECT_DIR/tmp/esp-homekit-sdk/components/homekit
46+
cp esp_hap_core/include/hap.h $PROJECT_DIR/include
47+
cp esp_hap_apple_profiles/include/*.h $PROJECT_DIR/include
48+
49+
cleanup
50+
51+
printf "\nINFO: esp-homekit-sdk library built successfully!\n"
52+
53+
exit 0

0 commit comments

Comments
 (0)