1 Building Reduce from source 2 3 4 5(1) Very basic software expectations. 6 7Just to fetch reduce you need to have a copy of "subversion" installed and 8the ability to run from a unix-like console. I strongly recommend that you 9run under the "bash" shell or something fairly compatible with that. 10On Linux you MAY need to open a terminal and go "sudo apr-get subversion". 11On Windows you should install cygwin from www.cygwin.com (please fetch and 12use the 64-bit variant) and when you run their setup utility you should 13use their search-box to find "subversion" and select it for installation. 14On a Macintosh visit www.macports.org and follow the instructions there to 15install that - you can then go "sudo port install subversion". You will need 16to fetch Xcode from Apple, install it and activate the command-line 17utilities along the way, and while you are about it you might as well fetch 18and install the XQuartz version of the X windows system (www.xquartz.org). 19 20The main Reduce supporters do not make provision for building Reduce using 21the Microsoft compilers and VIsual Studio on Windows, or using software 22and libraries on the Macintosh other than Xcode+Macports on the Macintosh, so 23use of eg homebrew is something we have not investigated at all. It may not 24be impossible to use alternatives to the setup described here, but you will 25be basically on your own! 26Other Unix-style platforms should be easy to adapt for, but we do not have 27scripts to help you install all the necessary support software. 28 29(2) Fetching Reduce. 30 31The first time you want to fetch REDUCE you can then issue the command 32 33svn co svn://svn.code.sf.net/p/reduce-algebra/code/trunk reduce-algebra 34 35which will check-out Reduce and put a copy in the directory reduce-algebra. 36You can select whatever name of location you like for the copy that you 37check-out. I often have several, with the second one called testing-reduce. 38 39Then there are perhaps two key recipes for use of subversion that you may 40like to be aletred to. In each case go "cd reduce-algebra" first: 41 svn update 42updates your local files to bring them into step with the ones on the server. 43If you have made local changes these changes are NOT overwritten. 44If you have made local changes that clash with updates at the repository 45the attempt to use "svn update" may generate messages or options that you 46find hard to understand at the start. If in doubt use ^C to abandon the 47fetch and then use 48 svn -R revert . 49which should undo any local changes you made and bring your local copy back 50in step with the version you last fetched. Then "svn update" will have a 51better change of working without complaint. 52One further circumstance can still cause confusion to those who have not used 53subversion significantly. If a new file or directory is published in the 54sourceforge server but somehow you have something with the same name in your 55local tree the clash will lead to alerts. If you delete the part of your local 56tree including the unexpected material then subversion is liable to be able 57to re-fetch anything that is missing and restore your tree. 58 59The fundamantal basis for the above advice is that you will not be making 60private changes or additions to Reduce within the main tree, and so you would 61be happy if everything within that directory was snapped back to be a mere 62copy of what is at sourceforge. When you move beyond that state take a while 63to read the subversion documentation rather than blindly following the 64simplistic guidance here! 65 66(3) Support software and libraries. 67Building Reduce uses a collection of utilities and libraries. For the main 68supported platforms there are scripts that attempt to simplfy the process 69of ensuring that all that is needed has been installed. Because the platforms 70re-package software, update versions and generally develop over time the 71recipes given here can not be guaranteed perfect for ever, but at the very 72least they can get you started. 73 74For Windows consider scripts/cygwin-sanity-check.sh which tries to to 75check if everything that Reduce does or might need is installed. At the end 76if more packages need to be installed it will display a command of the 77form 78 ./setup-x86_64.exe --no-desktop --no-shortcuts \ 79 --no-startmenu --quiet-mode -P ... ... ... 80with a list of packages following. I use copy and paste so that I can 81launch that command from within the directoryt where I have already got 82the Cygwin version of setup-x86_64.exe. This installs some software beyond 83the bare minimum for simple building of Reduce - it is used to ensure that 84everything needed when building a binary release is present. 85 86For Linux I have scripts/ubuntu-sanity-check.sh, fedora-sanity-check.sh and 87scientific-linux-sanity-check.sh. The first of these may suffice on other 88Debian and Debian derived systems and is the one checked most often. The 89Fedora one is a prototype for RPM worlds and both it and the Scientific Linux 90support were set up at some stage in the past so should be viewed as 91starting points rather than up to date validated scripts. If you try them and 92find updates are necessary please report so we can fix them. 93 94On the Macintosh scripts/macports-setup.sh is where to start. Because macports 95installs many of its packages by fetching source and compiling locally this 96can take quite some while to complete, but the initial set up is a once-off 97cost. 98 99If you are on some other platform and are willing to develop and contribute 100a script in the above spirit for configuring software on an initially 101pristine copy of some other operation system then please do that and send 102in a copt to be put in the reduce-algebra/scripts directory. For instance 103Reduce can be build in various BSD-family platforms. It is not some years 104since a version was tested on Solaris but with some care that was possible. 105 106(4) Initial testing 107You can either launch straight into an attempt to build Reduce or you can run 108scripts/csl-sanity-check.sh. If the latter succeeds it should display a 109window containing the text "Arthur". It is far from a rigorous check of all 110pre-requisites, but if it does behave that can build confidence! 111 112(5) Building and testing REDUCE 113The key commands are 114 ./configure --with-psl 115or ./configure --with-csl 116[and it is valid to issue first one and the the second so that both variants 117of Reduce will get built]. 118 make 119The initial build of Reduce has to go through a bootstrapping process and 120takes longer than subsequent rebuilds. It is also much slower under Windows 121than on the other platforms where it only needs a moderate number of minutes. 122If you are uncertain I would suggest going 123 script buildreduce.log 124 make 125 exit 126which makes a transcript of the lengthy and untidy output. If things fail 127it can be hard to decode why - in part because the build scripts can run 128some parts of the build process in parallel so that fragments of output from 129independent sub-tasks end up interleaved. 130 131When building has completed sucessfully you can try 132 bin/redcsl Open CSL-reduce in a window 133 bin/redcsl -w Run CSL-reduce in console mode 134 bin/redpsl Run PSL-reduce 135where the reduce-algebra/bin directory contains the recipes for running things. 136You may wish to put that on your PATH. Of course you only get the CSL or PSL 137version available if you had used the proper ./configure option! If you 138seleced just one (say PSL) initially and later want to try the other then 139re-run ./configure in the reduce-algebra directory with "--with-XXX" for the 140second variant then re-run "make". Then you should have both to try and to 141compare. 142Plausible inoutail inpout to see that Reduce is working might be: 143 2+2; % Trivial arithmetic 144 int(1/(x^6-1), x); % Indefinite integration 145 df(ws, x); % Differentiate the integral 146 solve(a*x^2 + b*x + x, x); % Quadratic formula 147 quit; % Done! 148After that it can be good to try a more exhausitive set of tests by going 149 scripts/testall.sh 150which runs test and demonstration examples for almost all parts of Reduce 151and also a collection of regression tests written as issues have been 152identified and addressed. If you only installed either the PSL or CSL 153version you will need to follow "testall.sh" with either "--csl" or "--psl" 154as relevant - by default it runs both and compares their output both against 155stored reference logs and against each other. 156At sny moment there will be a small number of the test cases that report 157inconsistencies. Whiel some may reflect bugs or limitations others may be 158where the core system has been improved but the reference logs have not 159caught up. 160 161This now quite long enough for a getting-started guide. Note that there 162is a full Reduce manual in doc/manual/manual.pdf, and those who may wish to 163understand Reduce internals in greater detail can also look in the 164doc/primers directory. 165 166 167Arthur Norman. December 2019 168 169