-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
12,207 additions
and
0 deletions.
There are no files selected for viewing
257 changes: 257 additions & 0 deletions
257
ros/humble.v3.17/ros-humble-behaviortree-cpp-v3/APKBUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,257 @@ | ||
pkgname=ros-humble-behaviortree-cpp-v3 | ||
_pkgname=behaviortree_cpp_v3 | ||
pkgver=3.8.6 | ||
pkgrel=0 | ||
pkgdesc="$_pkgname package for ROS humble" | ||
url="https://index.ros.org/p/$_pkgname" | ||
arch="all" | ||
license="MIT" | ||
|
||
depends="boost-dev ncurses-dev ros-humble-ament-index-cpp ros-humble-rclcpp ros-humble-ros-workspace zeromq-dev boost-dev ncurses-dev ros-humble-ament-index-cpp ros-humble-rclcpp zeromq-dev" | ||
makedepends="py3-setuptools py3-rosdep py3-rosinstall py3-rosinstall-generator py3-vcstool chrpath boost-dev ncurses-dev ros-humble-ament-cmake ros-humble-ament-cmake-gtest ros-humble-ament-index-cpp ros-humble-rclcpp ros-humble-ros-environment zeromq-dev" | ||
|
||
subpackages="$pkgname-dbg $pkgname-doc" | ||
|
||
source="" | ||
builddir="$startdir/abuild" | ||
srcdir="/tmp/dummy-src-dir" | ||
buildlog="$builddir/ros-abuild-build.log" | ||
checklog="$builddir/ros-abuild-check.log" | ||
statuslog="$builddir/ros-abuild-status.log" | ||
if [ x${GENERATE_BUILD_LOGS} != "xyes" ]; then | ||
buildlog="/dev/null" | ||
checklog="/dev/null" | ||
statuslog="/dev/null" | ||
fi | ||
|
||
export ROS_PYTHON_VERSION=3 | ||
export PYTHON_VERSION=$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))') | ||
if [ ! -f /usr/ros/humble/setup.sh ]; then | ||
export PYTHONPATH=/usr/ros/humble/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH | ||
export AMENT_PREFIX_PATH=/usr/ros/humble | ||
fi | ||
rosinstall="- git: | ||
local-name: behaviortree_cpp_v3 | ||
uri: https://github.com/BehaviorTree/behaviortree_cpp_v3-release.git | ||
version: release/humble/behaviortree_cpp_v3/3.8.6-1 | ||
" | ||
|
||
prepare() { | ||
set -o pipefail | ||
mkdir -p $builddir | ||
echo "preparing" > $statuslog | ||
cd "$builddir" | ||
rm -rf src || true | ||
mkdir -p src | ||
echo "$rosinstall" > pkg.rosinstall | ||
vcs import --shallow --input pkg.rosinstall src | ||
find $startdir -maxdepth 1 -name "*.patch" | while read patchfile; do | ||
echo "Applying $patchfile" | ||
(cd src/* && patch -p1 -i $patchfile) | ||
done | ||
} | ||
|
||
build() { | ||
set -o pipefail | ||
echo "building" > $statuslog | ||
cd "$builddir" | ||
if [ -f /usr/ros/humble/setup.sh ]; then | ||
source /usr/ros/humble/setup.sh | ||
fi | ||
mkdir build | ||
cd build | ||
cmake ../src/$_pkgname \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/ros/humble \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
-DCMAKE_INSTALL_LIBDIR=lib 2>&1 | tee $buildlog | ||
make 2>&1 | tee -a $buildlog | ||
} | ||
|
||
check() { | ||
if [ -f $startdir/NOCHECK ]; then | ||
echo "Check skipped" | tee $checklog | ||
return 0 | ||
fi | ||
set -o pipefail | ||
echo "checking" >> $statuslog | ||
cd "$builddir" | ||
if [ -f /usr/ros/humble/setup.sh ]; then | ||
source /usr/ros/humble/setup.sh | ||
fi | ||
export PYTHONPATH="$builddir"/tmp/pkg/usr/ros/humble/lib/python${PYTHON_VERSION}/site-packages:${PYTHONPATH} | ||
export AMENT_PREFIX_PATH="$builddir"/tmp/pkg/usr/ros/humble:${AMENT_PREFIX_PATH} | ||
export PATH="$builddir"/tmp/pkg/usr/ros/humble/bin:${PATH} | ||
export LD_LIBRARY_PATH="$builddir"/tmp/pkg/usr/ros/humble/lib:${LD_LIBRARY_PATH} | ||
mkdir -p "$builddir"/tmp/pkg | ||
cd build | ||
make install DESTDIR="$builddir"/tmp/pkg | ||
if [ $(make -q test > /dev/null 2> /dev/null; echo $?) -eq 1 ]; then | ||
make test 2>&1 | tee $checklog | ||
fi | ||
} | ||
|
||
dbg() { | ||
mkdir -p "$subpkgdir" | ||
default_dbg | ||
} | ||
|
||
package() { | ||
echo "packaging" >> $statuslog | ||
mkdir -p "$pkgdir" | ||
cd "$builddir" | ||
export DESTDIR="$pkgdir" | ||
|
||
if [ -f /usr/ros/humble/setup.sh ]; then | ||
source /usr/ros/humble/setup.sh | ||
fi | ||
cd build | ||
make install | ||
|
||
# Tweak invalid RPATH | ||
find $pkgdir -name "*.so" | while read so; do | ||
chrpath_out=$(chrpath ${so} || true) | ||
if echo ${chrpath_out} | grep -q "RPATH="; then | ||
rpath=$(echo -n "${chrpath_out}" | sed -e "s/^.*RPATH=//") | ||
if echo "${rpath}" | grep -q -e "\(home\|aports\)"; then | ||
echo "RPATH contains home/aports!: ${rpath}" | ||
rpathfix=$(echo -n "${rpath}" | tr ":" "\n" \ | ||
| grep -v -e home | grep -v -e aports \ | ||
| tr "\n" ":" | sed -e "s/:$//; s/::/:/;") | ||
echo "Fixing to ${rpathfix}" | ||
chrpath -r ${rpathfix} ${so} || (echo chrpath failed; false) | ||
fi | ||
fi | ||
done | ||
|
||
# Tweak hardcoded library versions | ||
find $pkgdir -name "*.cmake" | while read cm; do | ||
libs=$(sed -n '/^set(libraries/{s/^.*"\(.*\)")$/\1/;s/;/ /g;p}' $cm) | ||
for lib in $libs; do | ||
rep= | ||
# lib.so.0.1.2 -> lib.so.0.1 | ||
if echo $lib | grep -q -e '\.so\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$'; then | ||
rep=$(echo $lib | sed -e 's/\(\.so\.[0-9]\{1,\}\.[0-9]\{1,\}\)\.[0-9]\{1,\}$/\1/') | ||
fi | ||
# lib-0.1.so.2 -> lib-0.1.so | ||
if echo $lib | grep -q -e '-[0-9]\{1,\}\.[0-9]\{1,\}\.so\.[0-9]\{1,\}$'; then | ||
rep=$(echo $lib | sed -e 's/\(-[0-9]\{1,\}\.[0-9]\{1,\}\.so\)\.[0-9]\{1,\}$/\1/') | ||
fi | ||
|
||
if [ ! -z "$rep" ]; then | ||
if [ -f $rep ]; then | ||
echo "$cm: $lib -> $rep" | ||
sed -e "s|\([\";]\)$lib\([\";]\)|\1$rep\2|g" -i $cm | ||
else | ||
echo "$cm: $lib is specified, but $rep doesn't exist" | ||
fi | ||
fi | ||
done | ||
done | ||
|
||
# Install license files | ||
licensedir="$pkgdir"/usr/share/licenses/$pkgname/ | ||
cd $builddir/src/$_pkgname | ||
find . \ | ||
-iname "license*" -or \ | ||
-iname "copyright*" -or \ | ||
-iname "copying*" -or \ | ||
-iname "gnu-*gpl*" \ | ||
| while read file; do | ||
# Copy license files under the source | ||
if echo $file | grep -e '^\./\.'; then | ||
# Omit files under hidden directory | ||
continue | ||
fi | ||
if echo $file | grep -e '^\./build/'; then | ||
# Omit files under build directory | ||
continue | ||
fi | ||
echo "Copying license files from source tree: $file" | ||
install -Dm644 $file "$licensedir"/$file | ||
done | ||
if [ -f $startdir/LICENSE ]; then | ||
# If LICENSE file is in aports directory, copy it | ||
echo "Copying license file from aports" | ||
install -Dm644 $startdir/LICENSE "$licensedir"/LICENSE | ||
fi | ||
if [ -f $startdir/LICENSE_URLS ]; then | ||
# If LICENSE_URLS file is in aports directory, download it | ||
echo "Downloading license file from URLs" | ||
cat $startdir/LICENSE_URLS | while read url; do | ||
echo "- $url" | ||
mkdir -p "$licensedir" | ||
wget -O "$licensedir"/$(basename $url) $url | ||
done | ||
fi | ||
if [ -z "$(find "$licensedir" -type f)" ]; then | ||
# If no explicit license file found, extract from source files | ||
mkdir -p "$licensedir" | ||
echo "Copying license from source file headers" | ||
find . -name "*.h" -or -name "*.c" -or -name "*.cpp" -or -name "*.py" | while read file; do | ||
echo "Checking license header in $file" | ||
tmplicense=$(mktemp) | ||
# Extract heading comment | ||
sed -n '1{/^#!/d}; | ||
/\/\*/{/\*\//d; :l0; p; n; /\*\//!b l0; p; q}; | ||
/^\s*#/{:l1; /^#!/!p; n; /^\s*#/b l1; q}; | ||
/^\s*\/\//{:l2; p; n; /^\s*\/\//b l2; q};' $file > $tmplicense | ||
# Remove comment syntax | ||
sed 's/\/\*//; s/\*\///; s/^s*\/\/\s\{0,1\}//; | ||
s/^ \* \{0,1\}//; s/^\s*# \{0,1\}//; s/\s\+$//;' -i $tmplicense | ||
# Trim empty lines | ||
sed ':l0; /^$/d; n; /^$/!b l0; :l1; n; b l1;' -i $tmplicense | ||
sed '${/^$/d}' -i $tmplicense | ||
|
||
if ! grep -i -e "\(license\|copyright\|copyleft\)" $tmplicense > /dev/null; then | ||
# Looks not like a license statement | ||
echo "No license statement" | ||
rm -f $tmplicense | ||
continue | ||
fi | ||
|
||
echo "Checking duplication" | ||
licenses=$(mktemp) | ||
find "$licensedir" -type f > $licenses | ||
savethis=true | ||
while read existing; do | ||
if diff -bBiw $tmplicense $existing > /dev/null; then | ||
# Same license statement found | ||
savethis=false | ||
break | ||
fi | ||
done < $licenses | ||
|
||
if $savethis; then | ||
# Save license statement | ||
local num=0 | ||
while true; do | ||
newfile="$licensedir"/LICENSE.$num | ||
if [ ! -f "$newfile" ]; then | ||
echo "Saving license statement as $newfile" | ||
mv $tmplicense $newfile | ||
break | ||
fi | ||
num=$(expr $num + 1) | ||
done | ||
fi | ||
|
||
rm -f $licenses $tmplicense | ||
done | ||
fi | ||
# List license files | ||
echo "License files:" | ||
find "$licensedir" -type f | xargs -n1 echo "-" | ||
|
||
echo "finished" >> $statuslog | ||
} | ||
|
||
doc() { | ||
mkdir -p $subpkgdir | ||
|
||
default_doc | ||
} | ||
|
||
if [ -f ./apkbuild_hook.sh ]; then | ||
. ./apkbuild_hook.sh | ||
apkbuild_hook | ||
fi |
Oops, something went wrong.