Files
create/package/rattler-build/build.sh
forbes 784d172a61
Some checks failed
Build and Test / build (pull_request) Has been cancelled
fix(ci): clone submodule content in rattler-build package
rattler-build's source.path copy does not include submodule contents —
directories like mods/silo/, mods/solver/, mods/gears/, and mods/datums/
end up empty in the work directory, causing cmake --install to fail
when it tries to install files from those paths.

Add a clone_if_empty helper to build.sh that detects empty submodule
directories and shallow-clones them from their remotes before CMake
runs. Add git to build requirements in recipe.yaml.

This fixes the release build (AppImage) failure where cmake --install
failed at the silo addon install step after successfully installing
the silo tree-node icons from src/Mod/Create/resources/.
2026-03-03 08:28:17 -06:00

84 lines
3.4 KiB
Bash

# Configure ccache to use a shared cache directory that persists across CI runs.
# The workflow caches /tmp/ccache-kindred-create between builds.
export CCACHE_DIR="${CCACHE_DIR:-/tmp/ccache-kindred-create}"
export CCACHE_BASEDIR="${SRC_DIR:-$(pwd)}"
export CCACHE_COMPRESS="${CCACHE_COMPRESS:-true}"
export CCACHE_COMPRESSLEVEL="${CCACHE_COMPRESSLEVEL:-6}"
export CCACHE_MAXSIZE="${CCACHE_MAXSIZE:-4G}"
export CCACHE_SLOPPINESS="${CCACHE_SLOPPINESS:-include_file_ctime,include_file_mtime,pch_defines,time_macros}"
export CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK:-content}"
mkdir -p "$CCACHE_DIR"
echo "ccache config: CCACHE_DIR=$CCACHE_DIR CCACHE_BASEDIR=$CCACHE_BASEDIR"
ccache -z || true
# rattler-build's source.path does not copy submodule contents — clone them
# if the directories are missing or empty.
clone_if_empty() {
local dir="$1" url="$2" ref="$3"
local count
count=$(find "${dir}" -mindepth 1 -not -name '.git' 2>/dev/null | head -1 | wc -l)
if [ "$count" -eq 0 ]; then
echo "Submodule ${dir} missing content — cloning from ${url} (${ref})"
rm -rf "${dir}"
git clone --depth 1 --branch "${ref}" --recurse-submodules "${url}" "${dir}"
fi
}
clone_if_empty mods/silo https://git.kindred-systems.com/kindred/silo-mod.git main
clone_if_empty mods/solver https://git.kindred-systems.com/kindred/solver.git main
clone_if_empty mods/gears https://git.kindred-systems.com/kindred/gears.git main
clone_if_empty mods/datums https://git.kindred-systems.com/kindred/datums.git main
if [[ ${HOST} =~ .*linux.* ]]; then
CMAKE_PRESET=conda-linux-release
fi
if [[ ${HOST} =~ .*darwin.* ]]; then
CMAKE_PRESET=conda-macos-release
# add hacks for osx here!
echo "adding hacks for osx"
# install space-mouse
/usr/bin/curl -o /tmp/3dFW.dmg -L 'https://download.3dconnexion.com/drivers/mac/10-7-0_B564CC6A-6E81-42b0-82EC-418EA823B81A/3DxWareMac_v10-7-0_r3411.dmg'
hdiutil attach -readonly /tmp/3dFW.dmg
sudo installer -package /Volumes/3Dconnexion\ Software/Install\ 3Dconnexion\ software.pkg -target /
diskutil eject /Volumes/3Dconnexion\ Software
CMAKE_PLATFORM_FLAGS+=(-DFREECAD_USE_3DCONNEXION:BOOL=ON)
CMAKE_PLATFORM_FLAGS+=(-D3DCONNEXIONCLIENT_FRAMEWORK:FILEPATH="/Library/Frameworks/3DconnexionClient.framework")
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
fi
unset CMAKE_GENERATOR
unset CMAKE_GENERATOR_PLATFORM
cmake \
${CMAKE_ARGS} \
--preset ${CMAKE_PRESET} \
-D CMAKE_IGNORE_PREFIX_PATH="/opt/homebrew;/usr/local/homebrew" \
-D CMAKE_INCLUDE_PATH:FILEPATH="$PREFIX/include" \
-D CMAKE_INSTALL_LIBDIR:FILEPATH="$PREFIX/lib" \
-D CMAKE_INSTALL_PREFIX:FILEPATH="$PREFIX" \
-D CMAKE_LIBRARY_PATH:FILEPATH="$PREFIX/lib" \
-D CMAKE_PREFIX_PATH:FILEPATH="$PREFIX" \
-D FREECAD_USE_EXTERNAL_FMT:BOOL=OFF \
-D INSTALL_TO_SITEPACKAGES:BOOL=ON \
-D OCC_INCLUDE_DIR:FILEPATH="$PREFIX/include/opencascade" \
-D OCC_LIBRARY_DIR:FILEPATH="$PREFIX/lib" \
-D Python_EXECUTABLE:FILEPATH="$PYTHON" \
-D Python3_EXECUTABLE:FILEPATH="$PYTHON" \
-D BUILD_DYNAMIC_LINK_PYTHON:BOOL=OFF \
-D PACKAGE_VERSION_SUFFIX:STRING="" \
-B build \
-S .
cmake --build build -j${CPU_COUNT:-16}
cmake --install build
mv ${PREFIX}/bin/FreeCAD ${PREFIX}/bin/freecad || true
mv ${PREFIX}/bin/FreeCADCmd ${PREFIX}/bin/freecadcmd || true
echo "=== ccache statistics ==="
ccache -s || true