Open tpetazzoni opened 2 years ago
Using the SDK features a module can use a previously built one.
The example below show how it can be done. An atom.mk with the required modules is needed that point to the staging dir. The include files need to be copied (alchemy does not do it as part of building unfortunately)
Checkout + setup of the deps/atom.mk
`
set -e
git clone https://github.com/Parrot-Developers/alchemy.git
mkdir packages cd packages git clone https://github.com/Parrot-Developers/ulog.git git clone https://github.com/Parrot-Developers/libfutils.git git clone https://github.com/Parrot-Developers/libshdata.git git clone https://github.com/Parrot-Developers/telemetry.git cd ..
mkdir deps cat << EOF > deps/atom.mk
LOCAL_PATH := \$(call my-dir)
include \$(CLEAR_VARS) LOCAL_MODULE := libulog LOCAL_SDK := \$(LOCAL_PATH)/../out/staging LOCAL_DESTDIR := usr/lib LOCAL_MODULE_FILENAME := libulog.so include \$(BUILD_LIBRARY)
include \$(CLEAR_VARS) LOCAL_MODULE := libfutils LOCAL_SDK := \$(LOCAL_PATH)/../out/staging LOCAL_DESTDIR := usr/lib LOCAL_MODULE_FILENAME := libfutils.so include \$(BUILD_LIBRARY)
include \$(CLEAR_VARS) LOCAL_MODULE := libshdata LOCAL_SDK := \$(LOCAL_PATH)/../out/staging LOCAL_DESTDIR := usr/lib LOCAL_MODULE_FILENAME := libshdata.so include \$(BUILD_LIBRARY)
include \$(CLEAR_VARS) LOCAL_MODULE := libtelemetry LOCAL_SDK := \$(LOCAL_PATH)/../out/staging LOCAL_DESTDIR := usr/lib LOCAL_MODULE_FILENAME := libtelemetry.so include \$(BUILD_LIBRARY)
EOF
`
Build libs sequentially
`
export ALCHEMY_HOME=$(pwd)/alchemy export ALCHEMY_TARGET_OUT=$(pwd)/out export ALCHEMY_TARGET_SDK_DIRS=$(pwd)/deps
ALCHEMY_WORKSPACE_DIR=$(pwd)/packages/ulog ${ALCHEMY_HOME}/scripts/alchemake libulog cp -Raf $(pwd)/packages/ulog/libulog/include/* ${ALCHEMY_TARGET_OUT}/staging/usr/include/
ALCHEMY_WORKSPACE_DIR=$(pwd)/packages/libfutils ${ALCHEMY_HOME}/scripts/alchemake libfutils cp -Raf $(pwd)/packages/libfutils/include/* ${ALCHEMY_TARGET_OUT}/staging/usr/include/
ALCHEMY_WORKSPACE_DIR=$(pwd)/packages/libshdata ${ALCHEMY_HOME}/scripts/alchemake libshdata cp -Raf $(pwd)/packages/libshdata/include/* ${ALCHEMY_TARGET_OUT}/staging/usr/include/
ALCHEMY_WORKSPACE_DIR=$(pwd)/packages/telemetry ${ALCHEMY_HOME}/scripts/alchemake libtelemetry cp -Raf $(pwd)/packages/telemetry/libtelemetry/include/* ${ALCHEMY_TARGET_OUT}/staging/usr/include/
`
Note: the SDK is usually used to first build some libraries at once, then with the 'sdk' target, libs and include files are copied in a 'sdk' directory' that later can be used as is as
For example: this will build libulog libfutils libshdata first, then create a sdk from it and last build libtelemetry from them.
`
export ALCHEMY_HOME=$(pwd)/alchemy export ALCHEMY_TARGET_OUT=$(pwd)/out
ALCHEMY_WORKSPACE_DIR=$(pwd)/packages ${ALCHEMY_HOME}/scripts/alchemake libulog libfutils libshdata ALCHEMY_WORKSPACE_DIR=$(pwd)/packages ${ALCHEMY_HOME}/scripts/alchemake sdk
ALCHEMY_WORKSPACE_DIR=$(pwd)/packages/telemetry ALCHEMY_TARGET_SDK_DIRS=${ALCHEMY_TARGET_OUT}/sdk ALCHEMY_TARGET_OUT=$(pwd)/out2 ${ALCHEMY_HOME}/scripts/alchemake libtelemetry
`
Thanks for the feedback, we will try this out and report back!
We are trying to package in Buildroot several Parrot libraries (namely libshdata, libfutils and ulog), which have dependencies on each other. In Buildroot, each package is supposed to build just its own code, not the ones of its dependencies.
Unfortunately, when we ask Alchemy to build libshdata, it requires the source code of its dependencies to be present, and it also builds the dependencies of libshsdata (libfutils and ulog).
Would it be possible to build each package separately, i.e build "ulog", install it somewhere. Then build "libfutils" (and only libfutils) using the already compiled/installed "ulog". And then continue in building "libshdata" (and only libshdata), using the already compiled/installed ulog and libfutils libraries.
We've played a bit with environment variables of Alchemy, but haven't been able to figure out a way of achieving this.
Thanks in advance for your support.