Skip to content

Commit 4eac96e

Browse files
committed
feat: update script to use esp-idf3-homekit-sdk
1 parent 6abd036 commit 4eac96e

File tree

2 files changed

+491
-1078
lines changed

2 files changed

+491
-1078
lines changed

build.sh

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,58 @@ set -e # Stop on the first error
44
PROJECT_DIR=$(pwd)
55

66
cleanup() {
7-
printf "\nINFO: Cleaning up tmp directory\n"
8-
cd $PROJECT_DIR
9-
rm -rf tmp
7+
if [ "$1" == "cleanup" ]; then
8+
printf "\nINFO: Cleaning up tmp directory\n"
9+
cd $PROJECT_DIR
10+
rm -rf tmp
11+
fi
1012
}
1113

12-
trap 'cleanup' ERR
13-
14-
printf "INFO: Activating IDF virtual environment\n"
15-
. ${1:-$HOME/esp/esp-idf/export.sh}
14+
trap "cleanup $1" ERR
15+
trap "cleanup $1" SIGINT
1616

1717
printf "INFO: Creating and entering tmp directory\n"
18-
mkdir tmp
18+
mkdir -p tmp
1919
cd tmp
2020

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
21+
if [ ! -d "$PROJECT_DIR/tmp/esp-idf3-homekit-sdk" ]
22+
then
23+
printf "\nINFO: Cloning and entering esp-idf3-homekit-sdk repo\n"
24+
git clone --recursive https://github.com/Brawrdon/esp-idf3-homekit-sdk.git
25+
else
26+
printf "\nINFO: Entering esp-idf3-homekit-sdk repo\n"
27+
fi
28+
cd esp-idf3-homekit-sdk
29+
2430

25-
COMMIT="040b0f301223ebc6995597328e5a5cc9f9739a02"
26-
printf "\nINFO: Checking out to commit $COMMIT\n"
27-
git checkout $COMMIT
31+
BRANCH="esp-idf-3.3.4"
32+
printf "\nINFO: Checking out to branch: $BRANCH\n"
33+
git checkout $BRANCH
2834

29-
printf "\nINFO: Copying sdkconfig to esp-homekit-sdk fan example\n"
35+
printf "\nINFO: Copying sdkconfig to esp-idf3-homekit-sdk fan example\n"
3036
cp $PROJECT_DIR/sdkconfig examples/fan/
3137

3238
printf "\nBuilding fan example\n"
3339
cd examples/fan/
34-
idf.py build
40+
make
3541

3642
printf "\nINFO: Copying compiled libraries to project's lib directory\n"
37-
cd build/esp-idf
43+
cd build/
3844
cp esp_hap_*/*.a $PROJECT_DIR/lib/
3945
cp hkdf-sha/*.a $PROJECT_DIR/lib/
4046
cp json_generator/*.a $PROJECT_DIR/lib/
4147
cp json_parser/*.a $PROJECT_DIR/lib/
4248
cp mu_srp/*.a $PROJECT_DIR/lib/
4349

4450
printf "\nINFO: Copying header files for main libraries to project's include directory\n"
45-
cd $PROJECT_DIR/tmp/esp-homekit-sdk/components/homekit
51+
cd $PROJECT_DIR/tmp/esp-idf3-homekit-sdk/components/homekit
4652
cp esp_hap_core/include/hap.h $PROJECT_DIR/include
53+
cp esp_hap_core/src/priv_includes/esp_hap_ip_services.h $PROJECT_DIR/include
4754
cp esp_hap_apple_profiles/include/*.h $PROJECT_DIR/include
4855

49-
cleanup
56+
cleanup $1
57+
58+
printf "\nINFO: esp-idf3-homekit-sdk library built successfully!\n"
5059

51-
printf "\nINFO: esp-homekit-sdk library built successfully!\n"
60+
exit 0
5261

53-
exit 0

0 commit comments

Comments
 (0)