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 recommended or further packages with MPW * build R binary via CodeWarrior (no longer supported) 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. You actually need version 5.6 of MacPerl, see http://dev.macperl.org/ 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.1x 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 have switched to Apple's MPW compiler to build R and its packages and modules. You will still find the Metrowerks CodeWarrior project file for building the R binary but it is not working. General advice: There should be the necessity to fix the line-endings of the most important file: MPWBuild. I'm sorry about that. All the other line-endings problem are then fixed by MPWBuild itself. There are several ways to that but you can use directly MPW with a sequence of commands like Duplicate -y MPWBuild MPWBuild.ux translate ¶0x0a ¶0x0d MPWBuild delete -y MPWBuild.ux 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 >build" and execute it in the MPW Shell. b) the run "build" from the MPW Shell. This will take some time because of building of help files, packages and modules dll code. 4) after that you can run R but you still need to launch the Apple Script called install_pack that you will find inside R_HOME:script. Double click on it and run it if it won't run by itself. 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" PKGVERSION : MPW script that generates "pkgver.h" all 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 build library # and modules build # builds dll, modules and help files :::R # launches R IF YOU WANT TO BUILD (RECOMMENDED or FURTHER) PACKAGES: ------------------------------------------------------- The MakeRecmd.mac file is an MPW makefile you can use to build recommended packages. Script files are for recommended packages' version as to R release date. On the MPW Shell submit the following two lines: Make -f MakeRecmd.mac > build build The launch the Apple script file install_recmd from the R_HOME:script directory to finish the installation The file MakeBio.mac is a makefiles that can be used to build the Biocondutor bundle of packages as of version 1.0. You can also use other additional packages by simply providing a makefile and changing the parameters of the MakeAdd.mac file (see the doc inside the file itself). Note that some of the makefiles are already in the /src/macintosh/makefiles folder, so you just need to to the folloiwng in the order: 1) download the pkg.tgz archive 2) move it into /src/library 3) Uncompress it 4) go back to /src/macintosh 5) modify the file MakeAdd.mac 5) from MPW Shell execute Make -f MakeAdd.mac > build build 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 (discontinued): ---------------------------------------- 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 Maar 30th, 2003 Stefano M. Iacus (stefano.iacus@unimi.it)