forked from rdotnet/rClr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·73 lines (61 loc) · 2.04 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
RCLR_SRC_DIR=./src
RCLR_NUGET_EXE=${RCLR_SRC_DIR}/.nuget/NuGet.exe
if [ ! -e ${RCLR_SRC_DIR} ]
then
echo "error: no suitable package src dir found - last tried ${RCLR_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=$RCLR_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
# I do not think the following is needed. The solution file would trigger a Target RestorePackages:
#if [ -e ${RCLR_NUGET_EXE} ]
#then
# echo "Found ${RCLR_NUGET_EXE}"
# echo "Trying nuget package restore..."
# mono ${RCLR_NUGET_EXE} restore -NonInteractive ${RCLR_SRC_DIR}/rClr_monodev.sln
#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