Skip to content

Commit c7ad7b9

Browse files
committed
Change default dependency installation prefix to /usr/local
1 parent a7e4fe6 commit c7ad7b9

File tree

6 files changed

+75
-48
lines changed

6 files changed

+75
-48
lines changed

.github/template/fwe-build/action.yml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,49 @@ runs:
2525
uses: actions/cache@v4
2626
with:
2727
path: cache
28-
# prettier-ignore
2928
key: ${{ inputs.dist-name }}-${{ inputs.build-arch }}-${{ hashFiles('tools/install-deps-*.sh') }}
3029

31-
- name: install-deps
30+
- name: restore-cache-deps
31+
if: steps.cache-deps.outputs.cache-hit == 'true'
3232
shell: bash
3333
run: |
34+
echo "Cache found! Restoring cached dependencies..."
3435
IFS=":"
3536
CACHE_PATHS=${{ inputs.cache-paths }}
36-
if [ -d cache ]; then
37-
for P in ${CACHE_PATHS}; do
38-
sudo mkdir -p `dirname ${P}`
39-
sudo cp -r cache${P} ${P}
40-
done
41-
fi
42-
sudo ./tools/install-deps-${{ inputs.build-arch }}.sh ${{ inputs.extra-options }}
43-
if [ ! -d cache ]; then
44-
for P in ${CACHE_PATHS}; do
45-
mkdir -p cache`dirname ${P}`
46-
cp -r ${P} cache${P}
47-
done
37+
for P in ${CACHE_PATHS}; do
38+
sudo mkdir -p `dirname ${P}`
39+
sudo cp -r cache${P} ${P}
40+
done
41+
42+
- name: install-deps
43+
shell: bash
44+
run: |
45+
# Add --use-cache flag if cache hit
46+
EXTRA_OPTIONS="${{ inputs.extra-options }}"
47+
CACHE_HIT="${{ steps.cache-deps.outputs.cache-hit }}"
48+
49+
if [[ "${CACHE_HIT}" == 'true' ]]; then
50+
echo "Using cached dependencies, adding --use-cache flag"
51+
EXTRA_OPTIONS="${EXTRA_OPTIONS} --use-cache"
52+
else
53+
echo "No cache hit, installing dependencies from scratch"
4854
fi
55+
56+
# Run the installation script
57+
echo "Running installation with options: ${EXTRA_OPTIONS}"
58+
sudo ./tools/install-deps-${{ inputs.build-arch }}.sh ${EXTRA_OPTIONS}
59+
60+
- name: create-cache
61+
if: steps.cache-deps.outputs.cache-hit != 'true'
62+
shell: bash
63+
run: |
64+
echo "Creating cache for future runs..."
65+
IFS=":"
66+
CACHE_PATHS=${{ inputs.cache-paths }}
67+
for P in ${CACHE_PATHS}; do
68+
mkdir -p "$(dirname "cache${P}")"
69+
sudo cp -r "${P}" "cache${P}"
70+
done
4971
5072
- name: build
5173
shell: bash

.github/workflows/ci.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
extra-options:
4141
"--with-someip-support --with-lks-support --with-greengrassv2-support
4242
--with-custom-function-examples --with-store-and-forward-support --with-uds-dtc-example
43-
--with-micropython-support"
43+
--with-micropython-support --prefix /usr/local/x86_64-linux-gnu "
4444
dist-name: "aws-iot-fleetwise-edge"
4545
cache-paths: /usr/local/x86_64-linux-gnu
4646
dist-files: build/aws-iot-fleetwise-edge:.
@@ -56,7 +56,7 @@ jobs:
5656
extra-options:
5757
"--with-greengrassv2-support --with-someip-support --with-lks-support
5858
--with-custom-function-examples --with-store-and-forward-support --with-uds-dtc-example
59-
--with-micropython-support"
59+
--with-micropython-support --native-prefix /usr/local/x86_64-linux-gnu "
6060
dist-name: "aws-iot-fleetwise-edge"
6161
cache-paths: /usr/local/aarch64-linux-gnu:/usr/local/x86_64-linux-gnu
6262
dist-files: build/aws-iot-fleetwise-edge:.
@@ -72,7 +72,8 @@ jobs:
7272
extra-options:
7373
"--with-greengrassv2-support --with-someip-support --with-lks-support
7474
--with-iwave-gps-support --with-custom-function-examples
75-
--with-store-and-forward-support --with-uds-dtc-example --with-micropython-support"
75+
--with-store-and-forward-support --with-uds-dtc-example --with-micropython-support
76+
--native-prefix /usr/local/x86_64-linux-gnu "
7677
dist-name: "aws-iot-fleetwise-edge"
7778
cache-paths: /usr/local/arm-linux-gnueabihf:/usr/local/x86_64-linux-gnu
7879
dist-files: build/aws-iot-fleetwise-edge:.
@@ -88,7 +89,7 @@ jobs:
8889
extra-options:
8990
"--with-greengrassv2-support --with-ros2-support --with-someip-support
9091
--with-lks-support --with-custom-function-examples --with-store-and-forward-support
91-
--with-uds-dtc-example --with-micropython-support"
92+
--with-uds-dtc-example --with-micropython-support --prefix /usr/local/x86_64-linux-gnu "
9293
dist-name: "aws-iot-fleetwise-edge-ros2"
9394
cache-paths: /usr/local/x86_64-linux-gnu:/opt/ros
9495
dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:.
@@ -104,7 +105,8 @@ jobs:
104105
extra-options:
105106
"--with-greengrassv2-support --with-ros2-support --with-someip-support
106107
--with-lks-support --with-custom-function-examples --with-store-and-forward-support
107-
--with-uds-dtc-example --with-micropython-support"
108+
--with-uds-dtc-example --with-micropython-support --native-prefix
109+
/usr/local/x86_64-linux-gnu "
108110
dist-name: "aws-iot-fleetwise-edge-ros2"
109111
cache-paths: /usr/local/aarch64-linux-gnu:/usr/local/x86_64-linux-gnu:/opt/ros
110112
dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:.
@@ -120,7 +122,8 @@ jobs:
120122
extra-options:
121123
"--with-greengrassv2-support --with-ros2-support --with-someip-support
122124
--with-lks-support --with-custom-function-examples --with-store-and-forward-support
123-
--with-uds-dtc-example --with-micropython-support"
125+
--with-uds-dtc-example --with-micropython-support --native-prefix
126+
/usr/local/x86_64-linux-gnu "
124127
dist-name: "aws-iot-fleetwise-edge-ros2"
125128
cache-paths: /usr/local/arm-linux-gnueabihf:/usr/local/x86_64-linux-gnu:/opt/ros
126129
dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:.
@@ -133,7 +136,9 @@ jobs:
133136
with:
134137
build-arch: "cross-android"
135138
upload-arch: "android"
136-
extra-options: "--with-lks-support --with-custom-function-examples"
139+
extra-options:
140+
"--with-lks-support --with-custom-function-examples --native-prefix
141+
/usr/local/x86_64-linux-android "
137142
dist-name: "aws-iot-fleetwise-edge"
138143
cache-paths: /usr/local/x86_64-linux-android:/usr/local/aarch64-linux-android:/usr/local/armv7a-linux-androideabi:/usr/local/x86_64-linux-gnu
139144
dist-files:

tools/install-deps-cross-android.sh

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euo pipefail
77
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
88
source ${SCRIPT_DIR}/install-deps-versions.sh
99

10-
USE_CACHE="true"
10+
USE_CACHE="false"
1111
SDK_PREFIX="/usr/local/android_sdk"
1212
ARCHS="x86_64:x86_64-linux-android:android-x86_64 \
1313
armeabi-v7a:armv7a-linux-androideabi:android-arm \
@@ -26,9 +26,11 @@ parse_args() {
2626
;;
2727
--native-prefix)
2828
NATIVE_PREFIX="$2"
29-
USE_CACHE="false"
3029
shift
3130
;;
31+
--use-cache)
32+
USE_CACHE="true"
33+
;;
3234
--help)
3335
echo "Usage: $0 [OPTION]"
3436
echo " --archs <ARCHS> Space separated list of archs in the format <ARCH>:<HOST_PLATFORM>:<SSL_TARGET>"
@@ -70,7 +72,7 @@ if [ ! -d ${SDK_PREFIX} ]; then
7072
fi
7173
export PATH=${SDK_PREFIX}/cmake/${VERSION_CMAKE}/bin/:${PATH}
7274

73-
: ${NATIVE_PREFIX:="/usr/local/`gcc -dumpmachine`"}
75+
: ${NATIVE_PREFIX:="/usr/local"}
7476

7577
install_deps() {
7678
TARGET_ARCH="$1"
@@ -290,18 +292,10 @@ for ARCH in ${ARCHS}; do
290292
TARGET_ARCH=`echo $ARCH | cut -d ':' -f1`
291293
HOST_PLATFORM=`echo $ARCH | cut -d ':' -f2`
292294
SSL_TARGET=`echo $ARCH | cut -d ':' -f3`
293-
BUILD="false"
294-
if ! ${USE_CACHE}; then
295-
echo "--native-prefix defined, building..."
296-
BUILD="true"
297-
elif [ ! -d ${NATIVE_PREFIX} ]; then
298-
echo "${NATIVE_PREFIX} does not exist, building..."
299-
BUILD="true"
300-
elif [ ! -d /usr/local/${HOST_PLATFORM} ]; then
301-
echo "/usr/local/${HOST_PLATFORM} does not exist, building..."
302-
BUILD="true"
303-
else
304-
echo "/usr/local/${HOST_PLATFORM} exists, not building."
295+
BUILD="true"
296+
if ${USE_CACHE}; then
297+
echo "using cache, not building..."
298+
BUILD="false"
305299
fi
306300
if ${BUILD}; then
307301
install_deps ${TARGET_ARCH} ${HOST_PLATFORM} ${SSL_TARGET}

tools/install-deps-cross-arm64.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euo pipefail
77
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
88
source ${SCRIPT_DIR}/install-deps-versions.sh
99

10-
USE_CACHE="true"
10+
USE_CACHE="false"
1111
WITH_GREENGRASSV2_SUPPORT="false"
1212
SHARED_LIBS="OFF"
1313
WITH_VISION_SYSTEM_DATA="false"
@@ -41,12 +41,14 @@ parse_args() {
4141
;;
4242
--native-prefix)
4343
NATIVE_PREFIX="$2"
44-
USE_CACHE="false"
4544
shift
4645
;;
4746
--shared-libs)
4847
SHARED_LIBS="ON"
4948
;;
49+
--use-cache)
50+
USE_CACHE="true"
51+
;;
5052
--help)
5153
echo "Usage: $0 [OPTION]"
5254
echo " --with-greengrassv2-support Install dependencies for Greengrass V2"
@@ -134,9 +136,9 @@ if [ ! -f /usr/include/linux/can/isotp.h ]; then
134136
rm -rf can-isotp
135137
fi
136138

137-
: ${NATIVE_PREFIX:="/usr/local/`gcc -dumpmachine`"}
139+
: ${NATIVE_PREFIX:="/usr/local"}
138140

139-
if ! ${USE_CACHE} || [ ! -d /usr/local/aarch64-linux-gnu ] || [ ! -d ${NATIVE_PREFIX} ]; then
141+
if ! ${USE_CACHE}; then
140142
mkdir -p /usr/local/aarch64-linux-gnu/lib/cmake/
141143
mkdir -p ${NATIVE_PREFIX}
142144
cp ${SCRIPT_DIR}/arm64-toolchain.cmake /usr/local/aarch64-linux-gnu/lib/cmake/

tools/install-deps-cross-armhf.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euo pipefail
77
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
88
source ${SCRIPT_DIR}/install-deps-versions.sh
99

10-
USE_CACHE="true"
10+
USE_CACHE="false"
1111
WITH_GREENGRASSV2_SUPPORT="false"
1212
SHARED_LIBS="OFF"
1313
WITH_VISION_SYSTEM_DATA="false"
@@ -41,12 +41,14 @@ parse_args() {
4141
;;
4242
--native-prefix)
4343
NATIVE_PREFIX="$2"
44-
USE_CACHE="false"
4544
shift
4645
;;
4746
--shared-libs)
4847
SHARED_LIBS="ON"
4948
;;
49+
--use-cache)
50+
USE_CACHE="true"
51+
;;
5052
--help)
5153
echo "Usage: $0 [OPTION]"
5254
echo " --with-greengrassv2-support Install dependencies for Greengrass V2"
@@ -134,9 +136,9 @@ if [ ! -f /usr/include/linux/can/isotp.h ]; then
134136
rm -rf can-isotp
135137
fi
136138

137-
: ${NATIVE_PREFIX:="/usr/local/`gcc -dumpmachine`"}
139+
: ${NATIVE_PREFIX:="/usr/local"}
138140

139-
if ! ${USE_CACHE} || [ ! -d /usr/local/arm-linux-gnueabihf ] || [ ! -d ${NATIVE_PREFIX} ]; then
141+
if ! ${USE_CACHE}; then
140142
mkdir -p /usr/local/arm-linux-gnueabihf/lib/cmake/
141143
mkdir -p ${NATIVE_PREFIX}
142144
cp ${SCRIPT_DIR}/armhf-toolchain.cmake /usr/local/arm-linux-gnueabihf/lib/cmake/

tools/install-deps-native.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euo pipefail
77
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
88
source ${SCRIPT_DIR}/install-deps-versions.sh
99

10-
USE_CACHE="true"
10+
USE_CACHE="false"
1111
INSTALL_BUILD_TIME_DEPS="true"
1212
WITH_GREENGRASSV2_SUPPORT="false"
1313
SHARED_LIBS="OFF"
@@ -42,7 +42,6 @@ parse_args() {
4242
;;
4343
--prefix)
4444
PREFIX="$2"
45-
USE_CACHE="false"
4645
shift
4746
;;
4847
--runtime-only)
@@ -51,6 +50,9 @@ parse_args() {
5150
--shared-libs)
5251
SHARED_LIBS="ON"
5352
;;
53+
--use-cache)
54+
USE_CACHE="true"
55+
;;
5456
--help)
5557
echo "Usage: $0 [OPTION]"
5658
echo " --with-greengrassv2-support Install dependencies for Greengrass V2"
@@ -135,9 +137,9 @@ if ${INSTALL_BUILD_TIME_DEPS} && [ ! -f /usr/include/linux/can/isotp.h ]; then
135137
rm -rf can-isotp
136138
fi
137139

138-
: ${PREFIX:="/usr/local/`gcc -dumpmachine`"}
140+
: ${PREFIX:="/usr/local"}
139141

140-
if ${INSTALL_BUILD_TIME_DEPS} && ( ! ${USE_CACHE} || [ ! -d ${PREFIX} ] ); then
142+
if ${INSTALL_BUILD_TIME_DEPS} && ( ! ${USE_CACHE} ); then
141143
mkdir -p ${PREFIX}
142144
mkdir deps-native
143145
cd deps-native

0 commit comments

Comments
 (0)