-
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
3 changed files
with
530 additions
and
0 deletions.
There are no files selected for viewing
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-laser-proc | ||
_pkgname=laser_proc | ||
pkgver=1.0.2 | ||
pkgrel=0 | ||
pkgdesc="$_pkgname package for ROS humble" | ||
url="http://ros.org/wiki/laser_proc" | ||
arch="all" | ||
license="BSD" | ||
|
||
depends="ros-humble-class-loader ros-humble-rclcpp ros-humble-rclcpp-components ros-humble-ros-workspace ros-humble-sensor-msgs" | ||
makedepends="py3-setuptools py3-rosdep py3-rosinstall py3-rosinstall-generator py3-vcstool chrpath ros-humble-ament-cmake ros-humble-ament-lint-auto ros-humble-ament-lint-common ros-humble-class-loader ros-humble-rclcpp ros-humble-rclcpp-components ros-humble-sensor-msgs" | ||
|
||
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: laser_proc | ||
uri: https://github.com/ros2-gbp/laser_proc-release.git | ||
version: release/humble/laser_proc/1.0.2-5 | ||
" | ||
|
||
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 |
14 changes: 14 additions & 0 deletions
14
ros/humble.v3.17/ros-humble-laser-proc/disable-uncrustify-test.patch
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,14 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 3039d52..b8a724d 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -56,6 +56,9 @@ install(DIRECTORY include/ | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
+ list(APPEND AMENT_LINT_AUTO_EXCLUDE | ||
+ ament_cmake_uncrustify | ||
+ ) | ||
set(ament_cmake_copyright_FOUND TRUE) | ||
ament_lint_auto_find_test_dependencies() | ||
endif() |
Oops, something went wrong.