### This is "MPWBuild" ### ### This script generates a true Makefile called ### that is needed in the following to build R. ### Just change the directory to the folder where this file is. ### Execute it by typing "MPWBuild" ### After a while this script exists and it has generated MakeR. ### Follow the instruction displayed to build R. ### ### If you have problems with the line endings of this file ### uncomment the following three lines and execute them: ### ### Duplicate -y MPWBuild MPWBuild.ux ### translate ¶0x0a ¶0x0d MPWBuild ### delete -y MPWBuild.ux ### ### ### ### Notes: to build R and run this script you need "sed" and "f2c". ### If you want just the tools you'll find them at ### http://www.ci.tuwien.ac.at/~iacus/R ### If you want the full archives refer to the ftp site ### sunsite.cnlab-switch.ch ### /software/platform/macos/src/mpw_c/ ### ### You also need the "f2cLib" that is usually distributed along ### with R but can also be found at ### http://www.ci.tuwien.ac.at/~iacus/R ### ### The Makefile assumes that the MoreFile 1.5.2 package is ### available somewhere. MoreFiles 1.5.2 is distributed along with ### the CarbonLib 1.4 SDK or later. Refer to developer.apple.com ### To build R you also need the complete Waste 2.x distribution ### Refer to http://www.merzwaren.com/waste ### ### Jago Nov 11 2001, Stefano M. Iacus ### (`iacus-ng' recently released, so it can't be bug free) ### ### Last update: April 14th 2002 ### ### bug report or optimization hints can be sent to ### ### stefano.iacus@unimi.it ### if !"`Exists "{MPW}tools:sed"`" Alert "You need to install sed tool before continuing" end echo "Setting up creator and type for scripts and makefiles" set fileList "`WhereIs -x -s ::: Å.mac ¶ BuildAll.mac News.MAC`" if "{fileList}" for f in {fileList} SetFile -c 'ttxt' -t 'TEXT' "{f}" Duplicate -y "{f}" "{f}.tmp" translate ¶0x0a ¶0x0d <"{f}.tmp" >"{f}" delete -y "{f}.tmp" end end Duplicate -y :tools:FF_CREATE :tools:FF_CREATE.ux translate ¶0x0a ¶0x0d <:tools:FF_CREATE.ux >:tools:FF_CREATE delete -y :tools:FF_CREATE.ux echo "Start creating MakeR" date echo " " if `Exists ::main:alloca.c` Rename "::main:alloca.c" "::main:alloca_c" end if "`Exists ::main:qsort-body.c`" Rename "::main:qsort-body.c" "::main:qsort-body_c" end ### if - Expected a number when "body.c" was encountered. ### MPW Shell - Execution of input terminated. echo "Setting variables and file list..." echo " " if !{Stuffit} begin Alert "Please identify Stuffit Expander" set Stuffit "`GetFilename`" {Stuffit} -wait :res:R.rsrc.hqx duplicate -y :script: ::: {Stuffit} -wait :::script:Å.hqx delete -y :::script:Å.hqx end end if !{MFDir} begin Alert "Please define MoreFiles distribution dir" set MFDir "`GetFilename -d`" end end if !{WasteDir} begin Alert "Please define 'Waste' distribution dir" set WasteDir "`GetFilename -d`" end end if !{WasteLib} set WasteLib "{WasteDir}Stub Libraries:CarbonWASTELib" end if !`Exists :::f2cLib` begin Alert "Please indicate where f2cLib is" set F2CLib "`GetFilename`" Echo "Installing f2cLib" Duplicate {F2CLib} ::: end end if !`Exists :::zlibLib` begin Alert "Please indicate where zlibLib is" set zlibLib "`GetFilename`" Echo "Installing zlibLib" Duplicate {zlibLib} ::: end end if !`Exists :::.Renviron` Duplicate :.Renviron ::: end set FortList "`Files ::appl:Å.f` `Files ::main:Å.f`" set RSrc "`Files ::main:Å.c` `Files ::nmath:Å.c` ¶ `Files ::appl:Å.c` `Files ::extra:xdr:Å.c` ¶ ::unix:dynload.c" set MacSrc "`Files Å.c` `Files :edit:Å.c` `Files :extra:Å.c` ¶ `Files :dll:Å.c` `Files :print:Å.c` ¶ `Files :waste:Å.c` `Files :gui:Å.c` ¶ `Files :dir:Å.c` `Files :graphic:Å.c` ¶ `Files :sys:Å.c`" set ExtraSrc "{MFDir}Sources:FullPath.c ¶ {MFDir}Sources:FSpCompat.c ¶ {MFDir}Sources:MoreFiles.c ¶ {MFDir}Sources:MoreFilesExtras.c" echo extraSrc = '{extraSrc}' >> MakeR if !`Exists -d :obj` NewFolder :obj end if `Exists MakeR` Delete MakeR end echo "### MakeR" >> MakeR echo "###" >> MakeR echo "### Auto generated Makefile to build R" >> MakeR echo "### `date`" >> MakeR echo "###" >> MakeR echo "### generated via MPWBuild_R" >> MakeR echo "### Jago August 2001, Stefano M. Iacus" >> MakeR echo " " >>MakeR echo " " >>MakeR echo " " >>MakeR echo Includes = -i ::include -i ::extra:xdr '¶' >>MakeR echo -i : -i :dir -i :waste -i :edit -i :gui '¶' >>MakeR echo -i :extra -i :dll -i :sys '¶' >>MakeR echo -i '"''{'WasteDir'}C_C++ Headers"' -i :f2c -i :zlib ¶ -i '"''{'MFDir'}'CHeaders'"' ¶ -i '"''{'MFDir'}'Sources'"' >>MakeR echo " " >>MakeR echo " " >>MakeR echo WasteDir = {WasteDir} >>MakeR echo WasteLib = {WasteLib} >>MakeR echo MFDir = {MFDir} >>MakeR echo F2COpt = -A -E -ec -!R -r8 -w66 -Nq150 -Nx200 -Ns801 -Nc20 ¶ -Nn401 -NL200 -NC99 -Nl256 >> MakeR if !`Exists :::WasteLib` begin Echo "Installing WasteLib" Duplicate {WasteDir}WasteLib ::: end end echo " " >>MakeR echo " " >>MakeR echo LibFiles = '¶' >>MakeR echo '"''{'PPCLibraries'}'CarbonStdCLib.o'"' '¶' >>MakeR echo '"''{'SharedLibraries'}'CarbonLib'"' '¶' >>MakeR echo '"''{'SharedLibraries'}'StdCLib'"' '¶' >>MakeR echo '"''{'PPCLibraries'}'StdCRuntime.o'"' '¶' >>MakeR echo '"''{'PPCLibraries'}'PPCCRuntime.o'"' '¶' >>MakeR echo '"''{'PPCLibraries'}'PPCToolLibs.o'"' '¶' >>MakeR echo '"''{'WasteLib'}''"' '¶' >>MakeR echo '":::f2cLib"' '¶' >>MakeR echo '":::zlibLib"' >>MakeR echo " " >>MakeR echo " " >>MakeR echo "### Generates FFTab.h and FFDecl.h" >>MakeR echo FFTab.h Ä ::appl:ROUTINES >> MakeR echo ' ' execute :tools:FF_CREATE >> MakeR echo " " >>MakeR echo " " >>MakeR echo "### Generates Rversion.h" >>MakeR echo Rversion.h Ä :::VERSION >> MakeR echo ' ' execute :tools:GETVERSION >> MakeR echo " " >>MakeR echo " " >>MakeR echo "### Generates Rconfig.h" >>MakeR echo Rconfig.h Ä ::include:config.h config.mac.h >> MakeR echo ' ' Duplicate -y config.mac.h ::include:config.h >>MakeR echo " execute :tools:GETCONFIG > Rconfig.h" >> MakeR echo ' ' Duplicate -y ::include:Rmath.h.in ::include:Rmath.h >>MakeR echo " " >>MakeR echo " " >>MakeR echo "### Auto-generated list of sources" >> MakeR echo "###" >> MakeR echo " " >> MakeR echo " " >> MakeR echo "### Main R sources" >> MakeR echo "RSrc = {RSrc}" >> MakeR echo " " >> MakeR echo " " >> MakeR echo "### Specific Macintosh sources" >> MakeR echo "macSrc = {macSrc}" >> MakeR echo " " >> MakeR echo " " >> MakeR echo "### Extra Macintosh support files" >> MakeR echo extraSrc = '¶' >> MakeR for f in {extraSrc} echo "'"{f}"'" '¶' >>MakeR end echo " " >> MakeR echo " " >> MakeR echo "### Fortran files to convert" >> MakeR echo "FortList = {FortList}" >> MakeR echo " " >> MakeR echo " " >> MakeR echo " " >> MakeR echo " " >> MakeR echo " " >> MakeR echo " " >> MakeR echo " " >> MakeR echo " " >> MakeR echo "Creating list of object files..." echo " " echo RObj = '¶' >> MakeR for f in {RSrc} begin echo `echo {f} | sed "s/\.c/.o/g" ¶ | sed "s/[^/]*:/:obj:\1/"` '¶' >>MakeR end end echo "" >> MakeR echo FObj = '¶' >> MakeR for f in {FortList} begin echo `echo {f} | sed "s/\.f/.o/g" ¶ | sed "s/[^/]*:/:obj:\1/"` '¶' >>MakeR end end echo "" >> MakeR echo MacObj = '¶' >> MakeR for f in {MacSrc} begin echo ":obj:"`echo {f} | sed "s/\.c/.o/g" ¶ | sed "s/[^/]*:/\1/"` '¶' >>MakeR end end echo "" >> MakeR echo ExtraObj = '¶' >> MakeR for f in {ExtraSrc} begin echo `echo {f} | sed "s/\.c/.o/g" ¶ | sed "s/[^/]*:/:obj:\1/"` '¶' >>MakeR end end echo "" >> MakeR echo " " >> MakeR echo " " >> MakeR echo '.c Ä .f' >> MakeR echo ' 'f2c '{'F2COpt'}' ¶ '{'DepDir'}''{'default'}'.f >> MakeR echo "" >>MakeR echo '.o Ä .c Rversion.h Rconfig.h FFTab.h FFDecl.h ¶ :::include:config.h' >> MakeR echo ' 'Mrc '{'DepDir'}''{'default'}'.c '{'includes'}' -o ¶ :obj:'{'default'}'.o -sym full -opt off -includes Unix ¶ -shared_lib_export on '¶' >> MakeR echo ' '-w 35,2,7,29,30,23 -d HAVE_CONFIG_H -d Macintosh -d ¶ TARGET_API_MAC_CARBON '¶' >> MakeR echo ' '-typecheck relaxed -noMapCR -ansi off ¶ -prefix RHeaders.h -alloca -enum int >> MakeR if `Exists :expvar` Delete :expvar end echo " " >> MakeR echo "### Main command build" >> MakeR echo " " >> MakeR echo R ÄÄ '{'RObj'}' '{'MacObj'}' '{'ExtraObj'}' ¶ '{'FObj'}' >> MakeR echo "### exporting symbols" >> MakeR echo ' '"catenate :obj:Å.x > expvar" >> MakeR echo ' 'PPCLink -o :::R '¶' >> MakeR echo ' ''{'RObj'}' '{'MacObj'}' '{'ExtraObj'}' ¶ '{'FObj'}' '¶' >> MakeR echo ' ''{'LibFiles'} ¶' >> MakeR echo ' '-sym on -mf -d -t "'APPL'" -c "'OFFF'" ¶ -m __appstart -@export ¶ expvar >> MakeR echo " " >> MakeR echo " " >> MakeR echo "R ÄÄ :res:RCarbon.r" >> MakeR echo ' '"Rez :res:RCarbon.r -o :::R -a" >>MakeR echo " " >> MakeR echo "R ÄÄ :res:Size.r" >>MakeR echo ' '"Rez :res:Size.r -o :::R -a" >>MakeR echo " " >> MakeR echo "R ÄÄ :res:RVerRes.r" >> MakeR echo ' '"Rez :res:RVerRes.r -o :::R -a" >> MakeR echo " " >> MakeR echo "R ÄÄ :res:Raete.r" >> MakeR echo ' '"Rez :res:Raete.r -o :::R -a" >>MakeR echo " " >> MakeR echo "Creating dependencies..." echo " " echo "###" >> MakeR echo "### Auto-generated dependencies" >> MakeR echo "### Main R sources" >> MakeR for f in {RSrc} begin echo `echo {f} | sed "s/\.c/.o/g" ¶ | sed "s/[^/]*:/:obj:\1/"` "Ä" '"'{f}'"' >>MakeR end end echo "### fortran to obj files" >> MakeR for f in {FortList} begin echo `echo {f} | sed "s/\.f/.o/g" | ¶ sed "s/[^/]*:/:obj:\1/"` "Ä" ¶ `echo {f} | sed "s/\.f/.c/g"` >>MakeR end end echo "### Macintosh specific" >> MakeR for f in {MacSrc} begin echo ":obj:"`echo {f} | sed "s/\.c/.o/g" ¶ | sed "s/[^/]*:/\1/"` "Ä" '"'{f}'"' >>MakeR end end echo "### Extra Macintosh sources" >> MakeR for f in {ExtraSrc} begin echo `echo {f} | sed "s/\.c/.o/g" ¶ | sed "s/[^/]*:/:obj:\1/"` "Ä" '"'{f}'"' >>MakeR end end echo "### Fortran files" >> MakeR for f in {FortList} begin echo `echo {f} | sed "s/\.f/.c/g" ¶ | sed "s/[^/]*:/:obj:\1/"` "Ä" '"'{f}'"' >>MakeR end end if "`Exists ::main:qsort-body_c`" Rename "::main:qsort-body_c" "::main:qsort-body.c" end echo " " echo "Done !" date echo " " echo "######################################################" echo " " echo "File MakeR created in the current folder" echo " " echo "Please install f2c and sed in the Tools:" echo "directory of your MPW Configuration" echo " " echo "You don't need to run this MPWBuild more than once." echo "This script creates for you a true MPW Makefile called" echo "MakeR that you'll use to build R" echo " " echo "######################################################" echo " " echo "# To build R, simply do the following" echo " " echo "Make -f MakeR R > MyMake" echo "MyMake" echo "Make -f makefile.mac > build" echo "build" echo " " echo ":::R" echo " " echo "# and each time you modify the sources simply do:" echo " " echo "Make -f MakeR R > MyMake" echo "MyMake" echo " "