Skip to content

Commit

Permalink
Fixes #28 Build and test on Linux (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
rwmcintosh authored Mar 1, 2024
2 parents 68376d3 + c9dfae8 commit 1a41143
Show file tree
Hide file tree
Showing 37 changed files with 2,979 additions and 3,117 deletions.
Binary file removed .RData
Binary file not shown.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ src/\.vs/
\.vs/
\.vscode/
src/libfiles
src/out
src/obj

inst/libs/*.*
inst/libs/i386/*.*
.Rproj.user
.Rhistory
.RData
src/Makevars
src/Makefile.win
src/rSharp.so
src/.idea
4 changes: 2 additions & 2 deletions R/rSharp-exported.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ clrLoadAssembly <- function(name) {

#' Gets the inner name used for the package
#'
#' Gets the inner name used for the package (rSharpMono or rSharpMs). This is not intented for use by most users.
#' Gets the inner name used for the package (rSharpUX or rSharpMs). This is not intented for use by most users.
#'
#' @return the short name of the library currently loaded, depending on the runtime used (Mono or Microsoft .NET)
#' @export
Expand Down Expand Up @@ -522,7 +522,7 @@ clrTypename <- function(clrobj) {
#'
#' Gets the name of the native library currently loaded. Used only for unit tests.
#'
#' @return the name of the native library currently loaded: rSharpMs or rSharpMono
#' @return the name of the native library currently loaded: rSharpMs or rSharpUX
#' @export
clrGetNativeLibName <- function() {
nativePkgName
Expand Down
4 changes: 2 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ startupMsg <- ''
rSharp_env=Sys.getenv('RSHARP')
monoexepath <- Sys.which('mono')
ext <- .Platform$dynlib.ext
nativeLibsNames <- paste(c('rSharpMono', 'RsharpMs'), ext, sep='')
nativeLibsNames <- paste(c('rSharpUX', 'RsharpMs'), ext, sep='')
monoDll <- nativeLibsNames[1]
msDll <- nativeLibsNames[2]
getFnameNoExt <- function(x) {strsplit(x, '\\.')[[1]][1]}
Expand Down Expand Up @@ -62,7 +62,7 @@ startupMsg <- ''
}
} else { # not on Windows.
appendStartupMsg('Loading the dynamic library for Mono runtime...')
chname <- "rSharp"
chname <- "rSharpUX"
loadAndInit(chname, pkgname, libname, srcPkgLibPath)
}
}
Expand Down
74 changes: 37 additions & 37 deletions cleanup
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
#!/bin/sh

# TODO: can cleanup.win just call clean (avoid duplications)
if ["$RSHARP_SRC_DIR" = ""]
then
RSHARP_SRC_DIR=./src
if [ ! -e ${RSHARP_SRC_DIR} ]
then
echo "error: no suitable package src dir found - last tried ${RSHARP_SRC_DIR}"
CURDIR=`pwd`
echo "Current directory (pwd) is $CURDIR"
exit 1
fi
fi

MAKEVARS_FILE=$RSHARP_SRC_DIR/Makevars

if [ -e $MAKEVARS_FILE ]
then
echo "note: removing existing $MAKEVARS_FILE"
rm $MAKEVARS_FILE
fi

rm -f $RSHARP_SRC_DIR/*.o
rm -f $RSHARP_SRC_DIR/*.rds
rm -f $RSHARP_SRC_DIR/rSharp.dll
rm -rf $RSHARP_SRC_DIR/x64
rm -rf $RSHARP_SRC_DIR/Debug
rm -rf $RSHARP_SRC_DIR/MonoInstall
rm -rf $RSHARP_SRC_DIR/MonoInstallDebug
rm -rf $RSHARP_SRC_DIR/Release
rm -rf $RSHARP_SRC_DIR/RDotNetDataConverter/obj
rm -rf $RSHARP_SRC_DIR/ClrFacade/obj
rm -rf $RSHARP_SRC_DIR/rdotnet/RDotNet.NativeLibrary/bin
rm -rf $RSHARP_SRC_DIR/rdotnet/RDotNet.NativeLibrary/obj
rm -rf $RSHARP_SRC_DIR/rdotnet/R.NET/bin
rm -rf $RSHARP_SRC_DIR/rdotnet/R.NET/obj
#!/bin/sh

# TODO: can cleanup.win just call clean (avoid duplications)
if ["$RSHARP_SRC_DIR" = ""]
then
RSHARP_SRC_DIR=./src
if [ ! -e ${RSHARP_SRC_DIR} ]
then
echo "error: no suitable package src dir found - last tried ${RSHARP_SRC_DIR}"
CURDIR=`pwd`
echo "Current directory (pwd) is $CURDIR"
exit 1
fi
fi

MAKEVARS_FILE=$RSHARP_SRC_DIR/Makevars

if [ -e $MAKEVARS_FILE ]
then
echo "note: removing existing $MAKEVARS_FILE"
rm $MAKEVARS_FILE
fi

rm -f $RSHARP_SRC_DIR/*.o
rm -f $RSHARP_SRC_DIR/*.rds
rm -f $RSHARP_SRC_DIR/rSharp.dll
rm -rf $RSHARP_SRC_DIR/x64
rm -rf $RSHARP_SRC_DIR/Debug
rm -rf $RSHARP_SRC_DIR/MonoInstall
rm -rf $RSHARP_SRC_DIR/MonoInstallDebug
rm -rf $RSHARP_SRC_DIR/Release
rm -rf $RSHARP_SRC_DIR/RDotNetDataConverter/obj
rm -rf $RSHARP_SRC_DIR/ClrFacade/obj
rm -rf $RSHARP_SRC_DIR/rdotnet/RDotNet.NativeLibrary/bin
rm -rf $RSHARP_SRC_DIR/rdotnet/RDotNet.NativeLibrary/obj
rm -rf $RSHARP_SRC_DIR/rdotnet/R.NET/bin
rm -rf $RSHARP_SRC_DIR/rdotnet/R.NET/obj
128 changes: 64 additions & 64 deletions configure
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
#!/bin/sh

RSHARP_SRC_DIR=./src
if [ ! -e ${RSHARP_SRC_DIR} ]
then
echo "error: no suitable package src dir found - last tried ${RSHARP_SRC_DIR}"
CURDIR=`pwd`
echo "Current directory (pwd) is $CURDIR"
exit 1
fi

# if this variable is defined, no Makefile.win will be generated,
# and the visual studio compilers are ignored even if installed.
# IGNORE_VISUALSTUDIO=1

./cleanup
MAKEVARS_FILE=$RSHARP_SRC_DIR/Makevars
MAKEVARS_INFILE=$MAKEVARS_FILE.in

# In order to write dos-style paths to the generated Makefile.win and co, needs multiple backslashes...
# R_HOME will be something like f:/path/to/R
# bash has the option of R_HOME_BSLASH=${R_HOME//\//\\\\} and it works as expected
# in ash behavior seems to differ from bash, hence the 8 backslashes needed for the substitution to work
slash_to_eight_bslash() {
RESULT=`echo $1 | sed -e 's/\//\\\\\\\\/g'`
}
# slash_to_eight_bslash c:/tmp/blah
# echo $RESULT
# blah=$RESULT
# echo $blah

# A substitute for cygpath, not present in RTools
# does not work as function (??): sed: -e expression #1, char 8: unterminated `s' command
# dos_to_cyg() {
# RESULT=`echo $1 | sed -e 's/\\/\//g'`
# }

double_backslash() {
RESULT=`echo $1 | sed -e 's/\\/\\\\/g'`
}

MONO_CFLAGS=`pkg-config --cflags mono-2`
GLIB_CFLAGS=`pkg-config --cflags glib-2.0`
echo "MONO_CFLAGS=$MONO_CFLAGS"
echo "GLIB_CFLAGS=$GLIB_CFLAGS"

if [ ${#MONO_CFLAGS} -eq 0 ]
then
echo "error: mono-2 not found"
exit 1
fi

if [ ${#GLIB_CFLAGS} -eq 0 ]
then
echo "error: glib-2.0 not found"
exit 1
fi

subst_1="s|@MONO_INSTALL_PATH@|$MONO_INSTALL_PATH|g"
subst_2="s|@MONO_INSTALL_PATH64@|$MONO_INSTALL_PATH64|g"
sed -e "$subst_1" -e "$subst_2" $MAKEVARS_INFILE > $MAKEVARS_FILE
echo "Created $MAKEVARS_FILE"
exit 0

#!/bin/sh

RSHARP_SRC_DIR=./src
if [ ! -e ${RSHARP_SRC_DIR} ]
then
echo "error: no suitable package src dir found - last tried ${RSHARP_SRC_DIR}"
CURDIR=`pwd`
echo "Current directory (pwd) is $CURDIR"
exit 1
fi

# if this variable is defined, no Makefile.win will be generated,
# and the visual studio compilers are ignored even if installed.
# IGNORE_VISUALSTUDIO=1

./cleanup
MAKEVARS_FILE=$RSHARP_SRC_DIR/Makevars
MAKEVARS_INFILE=$MAKEVARS_FILE.in

# In order to write dos-style paths to the generated Makefile.win and co, needs multiple backslashes...
# R_HOME will be something like f:/path/to/R
# bash has the option of R_HOME_BSLASH=${R_HOME//\//\\\\} and it works as expected
# in ash behavior seems to differ from bash, hence the 8 backslashes needed for the substitution to work
slash_to_eight_bslash() {
RESULT=`echo $1 | sed -e 's/\//\\\\\\\\/g'`
}
# slash_to_eight_bslash c:/tmp/blah
# echo $RESULT
# blah=$RESULT
# echo $blah

# A substitute for cygpath, not present in RTools
# does not work as function (??): sed: -e expression #1, char 8: unterminated `s' command
# dos_to_cyg() {
# RESULT=`echo $1 | sed -e 's/\\/\//g'`
# }

double_backslash() {
RESULT=`echo $1 | sed -e 's/\\/\\\\/g'`
}

DOTNET_FLAGS=`dotnet --list-sdks`
GLIB_CFLAGS=`pkg-config --cflags glib-2.0`
echo "DOTNET_FLAGS=$DOTNET_FLAGS"
echo "GLIB_CFLAGS=$GLIB_CFLAGS"

if [ ${#DOTNET_FLAGS} -eq 0 ]
then
echo "error: mono-2 not found"
exit 1
fi

if [ ${#GLIB_CFLAGS} -eq 0 ]
then
echo "error: glib-2.0 not found"
exit 1
fi

subst_1="s|@MONO_INSTALL_PATH@|$MONO_INSTALL_PATH|g"
subst_2="s|@MONO_INSTALL_PATH64@|$MONO_INSTALL_PATH64|g"
sed -e "$subst_1" -e "$subst_2" $MAKEVARS_INFILE > $MAKEVARS_FILE
echo "Created $MAKEVARS_FILE"
exit 0

4 changes: 2 additions & 2 deletions man/clrGetInnerPkgName.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/clrGetNativeLibName.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 22 additions & 22 deletions rSharp.Rproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageBuildArgs: --no-multiarch
PackageBuildBinaryArgs: --no-multiarch
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageBuildArgs: --no-multiarch
PackageBuildBinaryArgs: --no-multiarch
Loading

0 comments on commit 1a41143

Please sign in to comment.