Skip to content

Commit

Permalink
[R] fix installation script
Browse files Browse the repository at this point in the history
this way it should work on systems where the shared library suffix
is not .so
  • Loading branch information
vigsterkr committed Feb 19, 2018
1 parent a65ae99 commit a8be9e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/r/CMakeLists.txt
Expand Up @@ -54,4 +54,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/DESCRIPTION ${CMAKE_CURRENT_SOURCE_DIR

install(CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}/${R_COMPONENT_LIB_PATH}/shogun/Meta)")

install(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/r-install.sh \$ENV{DESTDIR}/${R_COMPONENT_LIB_PATH} shogun so saveRDS WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
install(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/r-install.sh \$ENV{DESTDIR}/${R_COMPONENT_LIB_PATH} shogun ${CMAKE_SHARED_LIBRARY_SUFFIX} saveRDS WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
7 changes: 3 additions & 4 deletions src/interfaces/r/r-install.sh
Expand Up @@ -31,7 +31,6 @@ echo "Installing modular shogun interface for R"

cat >"$1/$2/R/$2" <<EOF
.packageName <- "$2"
#$2 <- function(...) .External("$2",...,PACKAGE="$2")
# Load the shogun dynamic library at startup.
#
Expand All @@ -40,14 +39,14 @@ cat >"$1/$2/R/$2" <<EOF
cat(paste("\nWelcome! This is SHOGUN version $VERSION\n"))
EOF

for f in *.so
for f in *$3
do
echo "library.dynam(\"`basename $f .so`\", pkg, lib)" >> "$1/$2/R/$2"
done

for f in *.RData
do
echo "load(paste(lib, \"/\", \"$2\", \"/R/\", \"`basename $f`\", sep=''), envir=.GlobalEnv)" >> "$1/$2/R/$2"
echo "load(paste(lib, \"$2\", \"R\", \"`basename $f`\", sep='/'), envir=.GlobalEnv)" >> "$1/$2/R/$2"
echo "cacheMetaData(1)" >> "$1/$2/R/$2"
done
cat >>"$1/$2/R/$2" <<EOF
Expand All @@ -58,7 +57,7 @@ cat >>"$1/$2/R/$2" <<EOF
{
EOF

for f in *.$3
for f in *$3
do
echo "library.dynam.unload(\"$f\", lib)" >> "$1/$2/R/$2"
done
Expand Down

0 comments on commit a8be9e2

Please sign in to comment.