forked from rwinlib/gcc-4.9.3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
88 lines (68 loc) · 2.45 KB
/
build.bat
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
::set R_VERSION=R-3.2.2
::set R_VERSION=R-devel
set R_VERSION=%1
::set WIN=32
::set WIN=64
set WIN=%2
::set BUILDDIR=%CD%
set SOURCEDIR=%~f0/../
set BUILDDIR=c:\\Rbuild
mkdir %BUILDDIR%
COPY %R_VERSION%.tar.gz %BUILDDIR%\%R_VERSION%.tar.gz
cd %BUILDDIR%
:: Set name of target
set R_NAME=%R_VERSION%-win%WIN%
set R_HOME=%BUILDDIR%/%R_NAME%
set TMPDIR=%TEMP%
:: For the multi-arch installer
set HOME32=%BUILDDIR%/%R_VERSION%-win32
:: Add rtools executables in path
set PATH=C:/rtools/bin;%PATH%
:: Clean up
rm -f %R_HOME%/*.log
rm -Rf %R_HOME%
:: Copy sources
tar -xf %R_VERSION%.tar.gz
mv %R_VERSION% %R_NAME%
set XBUILDDIR=%BUILDDIR:\\=/%
set XR_HOME=%R_HOME:\\=/%
set XHOME32=%HOME32:\\=/%
sed -e "s|@win@|%WIN%|" -e "s|@home@|%XR_HOME%|" -e "s|@home32@|%XHOME32%|" -e "s|@build@|%XBUILDDIR%|" %SOURCEDIR%\MkRules.local.in > %R_HOME%/src/gnuwin32/MkRules.local
:: Copy libraries
cp -R %SOURCEDIR%\libcurl-7.43.0 %R_HOME%/libcurl-7.43.0
cp -R %SOURCEDIR%\Tcl%WIN% %R_HOME%/Tcl
cp -R %SOURCEDIR%\extsoft %R_HOME%/extsoft
cp -R %SOURCEDIR%\cairo %R_HOME%/cairo
cp %SOURCEDIR%\curl-ca-bundle.crt %R_HOME%/etc/curl-ca-bundle.crt
:: Temporary patch for mingw-w64 bugs
:: sed -i "s/__GNUC__ <= 4/__GNUC__ <= 5/g" %R_HOME%/src/main/eval.c
:: sed -i "s/ISNAN(x) ? x : sqrt(x)/__isnan(x) ? x : sqrt(x)/g" %R_HOME%/src/main/eval.c
:: Enable C++11
:: sed -i "s/CXX1XSTD = -std=c++0x/CXX1XSTD = -std=c++11/g" %R_HOME%/src/gnuwin32/fixed/etc/Makeconf
:: Temporary downgrade Tcl
sed -i "s/TCL_VERSION = 86/TCL_VERSION = 85/" %R_HOME%/src/gnuwin32/fixed/etc/Makeconf
:: Mark output as experimental
sed -i "s/Under development (unstable)/EXPERIMENTAL/" %R_HOME%/VERSION
echo built with gcc 4.9.3 > %R_HOME%/VERSION-NICK
echo cat('R-experimental') > %R_HOME%/src/gnuwin32/fixed/rwver.R
:: Switch dir
cd %R_HOME%/src/gnuwin32
:: Download 'extsoft' directory
:: make rsync-extsoft
:: Build R
make all recommended vignettes > %R_HOME%/build.log 2>&1
make cairodevices
:: Run some checks
make check > %R_HOME%/check.log 2>&1
make check-recommended > %R_HOME%/check-recommended.log 2>&1
:: Requires pdflatex (e.g. miktex)
make manuals > %R_HOME%/manuals.log 2>&1
:: Add compiler to the PATH
cat %BUILDDIR%/profile.txt >> %R_HOME%/etc/Rprofile.site
:: Build the installer
IF "%WIN%"=="64" (
make distribution > %R_HOME%/distribution.log 2>&1
cp %R_HOME%/src/gnuwin32/installer/*.exe %BUILDDIR%/
)
:: Done
cd %BUILDDIR%