Macintosh porting of R ====================== In this directory you can find all the files needed to compile a version of R for MacOS. The original code for MacOS was written by Ross Ihaka, Julian Harris and Wing Kwong (Tiki) Wan. More recently Stefano M. Iacus has written new code, modified or simply updated most of the older files to work with current versions of R sources and the Waste Text Engine. From version 1.2.3 R is a Carbon application that will run natively under MacOS X System. BUILDING R WITH APPLE'S MPW ENVIRONMENT: ---------------------------------------- This note explains how to: * build R binary via MPW * build packages and modules via MPW * build help files * build R binary via CodeWarrior Before you continue please assure that your installation fits the following requirements: REQUIREMENTS: ------------- 0) MPW release August 2001 + updates. Go to http://developer.apple.com/tools/mpw-tools and follow the instructions. 1) a copy of MacPerl (www.macperl.org) and install it for MPW. Just run the "Install.MPW_Perl" that you find the MacPerl distribution root folder. This is needed to build help/latex/etc files Please read the instructions on how to increase memory to the MPW shell. 2) a copy of the "f2cLib" runtime library. You can find it at http://www.ci.tuwien.ac.at/~iacus/R or from the standard R distribution This is needed to build and run R and to build modules and packages that contain fortran code. 3) you should have a copy of the "f2c" MPW tool in the Tools directory of your MPW installation. You can have a copy of it at: http://www.ci.tuwien.ac.at/~iacus/R This is needed to convert source code from fortran to C 4) you also need the "sed" MPW tool. You should have a copy of it at http://www.ci.tuwien.ac.at/~iacus/R 5) A copy ofthe package "MoreFiles 1.5.2" or later. This is usually distributed along with the Carbon SDK kit (developer.apple.com) 6) A copy of the Waste 2.x distribution. Please refer to the official Waste site: http://www.merzwaren.com/waste 7) a copy of the "zlibLib" runtime library. You can find it at http://www.ci.tuwien.ac.at/~iacus/R or from the standard R distribution This is needed to build and run R. Starting from version 1.3.1 we are switching to Apple's MPW compiler to build R and its packages and modules. You will still find Metrowerks CodeWarrior project files but these will be shortly discontinued. General advice: It can happen that some scripts don't work. This should be to some line-endings problems. If you encounter any of this problems, please convert script-files to have MacOS line-endings. This could be generated by stuffit expander when you uncompress the R source archive. Definition: "R_HOME" the main root of R sources, say ::: from the folder where the files you are reading is. Step by step instructions ------------------------- 0) Fit all the requirements ! 1) Open MPW shell and change the directory to the folder where this file is. execute MPWBuild from the MPW shell. MPWBuild is a script file that is charged of creating of a makefile for the MPW shell called "MakeR" that is based on you configuration. MPW_Build make copies of "f2cLib", "zlibLib" and "WasteLib" to the R_HOME folder. 2) To build R you simply write on the MPW shell the following two lines: Make -f MakeR R > MyMake MyMake MyMake is charged to do many things: + Generates the files: Rconfig.h, Rversion.h, FFDecl.h, FFTab.h and res:RVerDefs.h + Moves config_mac.h to ::include:config.h + Duplicates your copy of "f2cLib" to R_HOME + Duplicates your copy of "zlibLib" to R_HOME + Duplicates your copy of "WasteLib" to R_HOME + Builds R binary 3) When you are done you can execute Makefile.mac. a) type "Make -f Makefile.mac" and execute it in the MPW Shell. b) select the output and run it. This will take some time because of building of help files. 4) You can now build packages and libraries. Change MPW Shell directory to R_HOME:src:library Execute "BuildAll.mac" If all went right you can build modules. Change MPW Shell directory to R_HOME:src:modules Execute "BuildAll.mac" 5) To build help files just type the following commands Make -f Makefile.mac > build build The tools Folder: ----------------- Some MPW scripts that are useful to build packages and to generate some of the files R needs to be built (independently from the compiler you use). In particular: GETVERSION : MPW script that generates "Rversion.h" and "res:RVerDefs.h" FF_CREATE : MPW script that generates "FFTab.h" and "FFDecl.h" GETDESC : fixes DESCRIPTION.in files GETCONFIG : MPW script that generates "Rconfig.h" both need the "sed" MPW tool installed. SUMMARY OF MPW BUILD COMMANDS: ------------------------------ move first to src/macintosh dir, then you can just copy the following lines in the MPW Worksheet: MPWBuild # prepares the main makefile Make -f MakeR R >MyMake # generates commands MyMake # builds R binary Make -f Makefile.mac > build # prepares commands for help build # builds help files Directory ::library BuildAll.mac # builds all library binaries Directory ::modules BuildAll.mac # builds all modules Directory ::macintosh :::R # launches R Where to find things: --------------------- as for now, you can find most of the things you probably miss at this URL http://www.ci.tuwien.ac.at/~iacus/R (contains "sed", "f2cLib", "zlibLib", ...) One other good place to look for Unix-like tools for MPW is also ftp://sunsite.cnlab-switch.ch/software/platform/macos/src/mpw_c BUILD R WITH CODEWARRIOR: ------------------------- Even if we are going to discontinue CodeWarrior support, you can still build the R binary using the CWPro 7 Project file in the folder src/macintosh/cwpro. Anyway, take care that this project file conflicts with the following files src/library/base/R/windows/dialogs.R library/R-ex/Script.r you should either rename or remove these files. If all went fine, CodeWarrior will create the binary R.cw in the root folder of R source tree. Libraries, modules and help files have to be built using MPW. In order take make this work you have to rename "R.cw" as "R". /----------------------- eof -----------------------------/ For comments and feedback, please contact either the R Core Development Team (and Stefano M. Iacus) at R-core@R-project.org or just Stefano M. Iacus December 4th, 2001 Stefano M. Iacus (stefano.iacus@unimi.it)