Skip to content

Commit

Permalink
env-hooks: install env-hook to etc/orocos/profile.d
Browse files Browse the repository at this point in the history
Check orocos-toolchain/orocos_toolchain#13.
Also set [DY]LD_LIBRARY_PATH here instead of in the typelib env-hook.

Signed-off-by: Johannes Meyer <[email protected]>
  • Loading branch information
meyerj committed Dec 29, 2016
1 parent 13c1b2b commit 8ac984f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ string(REGEX REPLACE ".*(lib|share)(32|64)?/?" "\\1/" RUBY_LIBRARY_INSTALL_DIR $
install(DIRECTORY lib/ DESTINATION ${RUBY_LIBRARY_INSTALL_DIR} )
install(FILES package.xml DESTINATION share/utilrb)

# Install an env-hook in etc/orocos/${OROCOS_TARGET}/profile.d
configure_file(env-hooks/00.utilrb.sh.in ${CMAKE_CURRENT_BINARY_DIR}/env-hooks/00.utilrb.sh @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/env-hooks/00.utilrb.sh
DESTINATION etc/orocos/profile.d
)

message(STATUS "RUBY_RUBY_LIB_DIR: ${RUBY_RUBY_LIB_DIR}")
message(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}")

# Install an env-hook if catkin is found
find_package(catkin QUIET)
if(catkin_FOUND)
Expand Down
30 changes: 26 additions & 4 deletions env-hooks/00.utilrb.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,31 @@

export RUBYOPT=-rubygems

export RUBYLIB=@CMAKE_INSTALL_PREFIX@/@RUBY_EXTENSIONS_INSTALL_DIR@:@CMAKE_INSTALL_PREFIX@/@RUBY_LIBRARY_INSTALL_DIR@
for path in "@CMAKE_INSTALL_PREFIX@/@RUBY_LIBRARY_INSTALL_DIR@" "@CMAKE_INSTALL_PREFIX@/@RUBY_EXTENSIONS_INSTALL_DIR@"; do
if [ ! -d "$path" ]; then
continue
fi

if [ `uname -s` = Darwin ]; then
export RUBYLIB=$RUBYLIB:@RUBY_ARCH_DIR@:@RUBY_RUBY_LIB_DIR@
fi
if [ -z "$RUBYLIB" ]; then
RUBYLIB="$path"
elif ! echo "$RUBYLIB" | grep -q "$path"; then
RUBYLIB="$path:$RUBYLIB"
fi
export RUBYLIB

if [ `uname -s` != Darwin ]; then
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="$path"
elif ! echo "$LD_LIBRARY_PATH" | grep -q "$path"; then
LD_LIBRARY_PATH="$path:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
else
if [ -z "$DYLD_LIBRARY_PATH" ]; then
DYLD_LIBRARY_PATH="$path"
elif ! echo "$DYLD_LIBRARY_PATH" | grep -q "$path"; then
DYLD_LIBRARY_PATH="$path:$DYLD_LIBRARY_PATH"
fi
export DYLD_LIBRARY_PATH
fi
done

0 comments on commit 8ac984f

Please sign in to comment.