From 1e490350fff9619fd30dbea910412308eb7c8661 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 11 Nov 1998 05:47:47 +0000 Subject: [PATCH] dummy commit before egcs merge --- config/ChangeLog | 32 ++++ config/mh-cygwin | 9 ++ ltmain.sh | 11 +- missing | 188 ++++++++++++++++++++++++ mkdep | 87 +++++++++++ mkinstalldirs | 36 +++++ move-if-change | 32 ++++ mpw-README | 373 +++++++++++++++++++++++++++++++++++++++++++++-- mpw-build.in | 122 ++++++++++++++-- mpw-config.in | 94 +++++++++++- mpw-configure | 161 +++++++++++++++----- mpw-install | 122 ++++++++++++++++ symlink-tree | 48 ++++++ ylwrap | 6 +- 14 files changed, 1247 insertions(+), 74 deletions(-) create mode 100644 config/mh-cygwin create mode 100755 missing create mode 100755 mkdep create mode 100755 mkinstalldirs create mode 100755 move-if-change create mode 100644 mpw-install create mode 100755 symlink-tree diff --git a/config/ChangeLog b/config/ChangeLog index d1178fb0345..dd24901c0f4 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,35 @@ +Mon Nov 2 15:15:33 1998 Geoffrey Noer + + * mh-cygwin32: delete + * mh-cygwin: was mh-cygwin32 + +1998-10-26 Syd Polk + + * acinclude.m4: TCLHDIR and TKHDIR need to be run through + cygpath for Microsoft builds. + +1998-10-20 Syd Polk + + * acinclude.m4: Re-exported TCL_LIBS and TCL_LD_SEARCH_FLAGS + because itcl needs them. + +Mon Aug 31 17:50:53 1998 David Edelsohn + + * mh-aix43 (NM_FOR_TARGET): Add -X32_64 as well. + +Sat Aug 29 14:32:55 1998 David Edelsohn + + * mh-aix43: New file. + +Mon Aug 10 00:15:47 1998 HJ Lu (hjl@gnu.org) + + * mt-linux (CXXFLAGS_FOR_TARGET): Add -D_GNU_SOURCE. + +start-sanitize-tmgr +1998-07-29 Rob Savoye + + * .Sanitize: Add acinclude.m4 to Things-To-Lose. +end-sanitize-tmgr start-sanitize-sky Mon Jul 27 16:23:04 1998 Doug Evans diff --git a/config/mh-cygwin b/config/mh-cygwin new file mode 100644 index 00000000000..29f165667a1 --- /dev/null +++ b/config/mh-cygwin @@ -0,0 +1,9 @@ +# We don't want debugging info in Win32-hosted toolchains. +# Accomplish this by overriding CFLAGS. +CFLAGS=-O2 +CXXFLAGS=-O2 + +# We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be +# built without debugging information + +LIBGCC2_DEBUG_CFLAGS= diff --git a/ltmain.sh b/ltmain.sh index 1c05d170333..eee5763387b 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -743,6 +743,11 @@ if test -z "$show_help"; then if test "$hardcode_direct" = no; then compile_command="$compile_command $dir/$linklib" elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac compile_command="$compile_command -L$dir -l$name" elif test "$hardcode_shlibpath_var" = no; then compile_shlibpath="$compile_shlibpath$dir:" @@ -1055,8 +1060,8 @@ if test -z "$show_help"; then major= versuffix= verstring="0.0" - case "$version_type" in - sunos) + case "$host" in + *-*-sunos*) versuffix=".0.0" ;; esac @@ -1757,7 +1762,7 @@ libdir='$install_libdir'\ # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL"; then + if test "$nonopt" = "$SHELL" || test "$nonopt" = "/bin/sh"; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case "$arg" in diff --git a/missing b/missing new file mode 100755 index 00000000000..cbe2b0ef0e3 --- /dev/null +++ b/missing @@ -0,0 +1,188 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in` + if test -z "$files"; then + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in` + test -z "$files" || files="$files.in" + else + files=`echo "$files" | sed -e 's/:/ /g'` + fi + test -z "$files" && files="config.h.in" + touch $files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print \ + | sed 's/^\(.*\).am$/touch \1.in/' \ + | sh + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkdep b/mkdep new file mode 100755 index 00000000000..3c5b508f142 --- /dev/null +++ b/mkdep @@ -0,0 +1,87 @@ +#!/bin/sh - +# +# Copyright (c) 1987 Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted +# provided that the above copyright notice and this paragraph are +# duplicated in all such forms and that any documentation, +# advertising materials, and other materials related to such +# distribution and use acknowledge that the software was developed +# by the University of California, Berkeley. The name of the +# University may not be used to endorse or promote products derived +# from this software without specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)mkdep.sh 5.12 (Berkeley) 6/30/88 +# + +MAKE=Makefile # default makefile name is "Makefile" + +while : + do case "$1" in + # -f allows you to select a makefile name + -f) + MAKE=$2 + shift; shift ;; + + # the -p flag produces "program: program.c" style dependencies + # so .o's don't get produced + -p) + SED='s;\.o;;' + shift ;; + *) + break ;; + esac +done + +if [ $# = 0 ] ; then + echo 'usage: mkdep [-p] [-f makefile] [flags] file ...' + exit 1 +fi + +if [ ! -w $MAKE ]; then + echo "mkdep: no writeable file \"$MAKE\"" + exit 1 +fi + +TMP=/tmp/mkdep$$ + +trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 + +cp $MAKE ${MAKE}.bak + +sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP + +cat << _EOF_ >> $TMP +# DO NOT DELETE THIS LINE -- mkdep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +_EOF_ + +# If your compiler doesn't have -M, add it. If you can't, the next two +# lines will try and replace the "cc -M". The real problem is that this +# hack can't deal with anything that requires a search path, and doesn't +# even try for anything using bracket (<>) syntax. +# +# egrep '^#include[ ]*".*"' /dev/null $* | +# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' | + +gcc -MM $* | +sed " + s; \./; ;g + $SED" >> $TMP + +cat << _EOF_ >> $TMP + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY +_EOF_ + +# copy to preserve permissions +cp $TMP $MAKE +rm -f ${MAKE}.bak $TMP +exit 0 + + diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 00000000000..cc8783edce3 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,36 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? + fi + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/move-if-change b/move-if-change new file mode 100755 index 00000000000..565825f35bc --- /dev/null +++ b/move-if-change @@ -0,0 +1,32 @@ +#!/bin/sh + +# Copyright (C) 1996 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +if +test -r $2 +then +if +cmp $1 $2 > /dev/null +then +echo $2 is unchanged +rm -f $1 +else +mv -f $1 $2 +fi +else +mv -f $1 $2 +fi diff --git a/mpw-README b/mpw-README index c762c9a3424..767140b5b26 100644 --- a/mpw-README +++ b/mpw-README @@ -1,25 +1,376 @@ -This is preliminary information about the Mac MPW port of the Cygnus tools. +This is basic information about the Macintosh(tm) MPW(tm) port of the +GNU tools. The information below applies to both native and cross +compilers. -To build everything, create an object directory, setdirectory into it, and do: +(Please note that there are two versions of this file; "mpw-README" +is the source form, and "Read Me for MPW" is the distribution form. +"Read Me for MPW" has 8-bit chars such as \Option-d embedded in it.) - ::src:mpw-configure --target --srcdir ::src: --prefix +INSTALLING GNU TOOLS -Then - mpw-build all +* System Requirements -will build everything, and +To use these tools, you will need a Mac with a 68020 or better or else +any PowerMac, System 7.1 or later, and MPW 3.3 or 3.4. You will *not* +need any other MPW compiler unless you want to rebuild from sources, +nor even any include files, unless you are building actual Mac +applications. For PowerMac native you will need PPCLink, however; +also the executables are PowerPC-only. + +* Automated Installation + +The simplest way to install GNU tools is to run the Install script. +The script will copy things to where you want to keep them, will build +a UserStartup file with settings corresponding to where things were +copied, and offer to put that UserStartup file in your MPW folder. + +The Install script does not alter anything in the System Folder, and +it does not take any action without confirmation. + +The Install script will be at the top level of the binary +distribution, or at the top level of the object directory if +rebuilding from source. (The sources include a file called +"mpw-install" at the top level, but it is the source to the Install +script and cannot be run directly.) + +* Manual Installation + +If you don't want to run the Install script, you can do installation +manually; this section describes the steps involved. + +The GNU tools can go in any directory that is in your {Commands} list. +We generally put all the tools somewhere like {Boot}Cygnus:latest:bin, +and then add to a UserStartup file: + + set Commands "{Boot}Cygnus:latest:bin:,{Commands}" + +However, the cpp and cc1 programs of GCC are not normally stored here. +Instead, they will be in a "lib" directory that is alongside "bin", +and organized by target and version underneath, with names like + + :lib:gcc-lib::cygnus-: + +If you build and install everything yourself according to the build +instructions below, then you will not have any problems. However, you +may discover that GCC seems unable to find the right cpp and cc1; +usually this will be because directory names have changed. (Even +renaming your hard disk will make this happen.) In such cases, you +have several choices. One is just to add this directory to +{Commands}, but then you will not be able to get any other cpp or cc1, +such as those used by a different target or version. Another way is +to rename your disk and directories to match the prefix used when the +tools were compiled. Finally, you can set the variable +GCC_EXEC_PREFIX to point to the library directory: + + set GCC_EXEC_PREFIX MyDisk:Stuff:lib:gcc-lib: + export GCC_EXEC_PREFIX + +You may also want to edit MPW's HEXA 128 resource. When GCC is built +using a native GCC, it is compiled to use a special stack allocator +function alloca(). While this is very efficient, it means that GCC +will need considerable stack space to run, especially when compiling +large programs with optimization turned on. You give MPW more stack +by editing the HEXA 128 resource of the MPW Shell. A value of "0008 +0000" gives 512K of stack size, which is usually sufficient. + +USING GNU TOOLS + +* Using Native PowerMac GCC + +Using a native PowerMac GCC to produce MPW tools or MacOS applications +is more complicated than just "gC foo.c", although no more complicated +than with other Mac compilers. + +To build a native PowerMac MPW tool, use this sequence, where hello.c +is the usual "hello world" program, and genericcfrg.r is the Rez file +with the code fragment resource: + +gC -I{CIncludes} -fno-builtin -Dpascal= -c -g hello.c +PPCLink hello.o -o hello \Option-d + "{PPCLibraries}"StdCRuntime.o \Option-d + "{SharedLibraries}"InterfaceLib \Option-d + "{SharedLibraries}"StdCLib \Option-d + "{PPCLibraries}"PPCToolLibs.o \Option-d + "{PPCLibraries}"PPCCRuntime.o \Option-d + "{GCCPPCLibraries}"libgcc.xcoff +rez -d APPNAME='"'hello'"' GenericCFRG.r -o hello +setfile -t 'MPST' -c 'MPS ' hello + +The same sequence works to build a MacOS application, but you set the file +type to 'APPL' and don't link in PPCToolLibs.o. For further details on +using MPW to build Mac applications, see the general MPW documentation. + +Recent versions of PPCLink have an option to generate the code +fragment resource and automatically set creator and file type; +here is what GenericCFRG.r should look like if you have an older +PPCLink or are using GNU ld: + +#include "CodeFragmentTypes.r" + +resource 'cfrg' (0) { + { + kPowerPC, + kFullLib, + kNoVersionNum,kNoVersionNum, + 0,0, + kIsApp,kOnDiskFlat,kZeroOffset,kWholeFork, + APPNAME // must be defined on Rez command line with -d option + } +}; + +In general this port of GCC supports the same option syntax and +behavior as its Unix counterpart. It also has similar compilation +rules, so it will run the assembler on .s files and so forth. + +The GCC manual includes full information on the available options. +One option that may be especially useful is "-v", which shows you what +tools and options are being used; unlike most Mac C compilers, GCC +directs assembly and linking in addition to compilation. + +MPW GCC does feature two extensions to the option syntax; '-d macro=name' +works just as '-Dmacro=name' does in Unix, and '-i directory' works the +same as '-Idirectory'. + +MPW GCC supports the usual Pascal-style strings and alignment pragmas. + +To find standard include files you can set the variable GCCIncludes: + + set GCCIncludes MyDisk:MyIncludes: + export GCCIncludes + +GCCIncludes is similar to MPW's CIncludes or CW's MWCIncludes. In +order to use MPW's usual include files, just say: + + set GCCIncludes "{CIncludes}" + export GCCIncludes + +* Using GCC as a Cross-Compiler + +If you have a cross-compiler, and you have all of the correct +target-side crt0 and libraries available, then to compile and link a +file "foo.c", you can say just + + gC foo.c + +The output file will be an MPW binary file named "a.out"; the format +of the contents will depend on which target is in use, so for instance +a MIPS-targeting GCC will produce ECOFF or ELF executables. + +Note that using MPW include files with a cross-compiler is somewhat +dangerous. + +* Using the Assembler and Friends + +The assembler ("as") and linker ("ld") are faithful ports of their +Unix counterparts. Similarly, the binutils "ar", "cplusfilt", "nm", +"objcopy", "objdump", "ranlib", "size", "strings", and "strip" are all +like they are under Unix. (Note that "cplusfilt" is usually called +"c++filt" under Unix.) + +* Using GDB + +There are two flavors of GDB. "gdb" is an MPW tool that works very +much like it does in Unix; put a command into the MPW worksheet and +type the key to send it to GDB. While "gdb" is running, you +cannot do anything else in MPW, although you can switch to other +Mac applications and use them. + +"SiowGDB" is also a Mac application, but it is GDB using the SIOW +package to provide console emulation. Commands are exactly as for the +MPW tool, but since this is its own application, you can switch +between it and MPW. + +BUILDING GNU TOOLS + +This port of the GNU tools uses a configure script similar to +that used for GNU tools under Unix, but rewritten for MPW. As with +Unix configuration, there is an "object" directory that may be +different from the "source" directory. In the example commands below, +we will assume that we are currently in the object directory, and that +the source directory is "{Boot}Cygnus:src:". + +* Requirements for Building + +In addition to the sources, you will need a set of tools that the +configure and build scripts assume to be available. These tools +(and their versions, if relevant) are as follows: + + byacc tool + flex (2.3.7) tool (and Flex.skel file) + forward-include script + MoveIfChange script + mpw-touch script + mpw-true script + NewFolderRecursive script + null-command script + open-brace script + sed (1.13) tool + tr-7to8 script + true script + +The scripts are in the sources, under utils:mpw:. You must arrange to +get the other tools yourself (they are readily available from the +"usual" net sites, and are also on many CDROMS). In addition, there +will usually be a set of these available at ftp.cygnus.com, in pub/mac. + +You may put the build tools in your usual Tools or Scripts +directories, or keep them in a separate directories. We prefer to +make a directory called "buildtools" and we put this in one of our +UserStartup files: + + set Commands "{Boot}Cygnus:buildtools:,{Commands}" + +Flex uses an environment variable FLEX_SKELETON to locate its skeleton +file, so you need to do something like this, preferably in a UserStartup: + + Set FLEX_SKELETON "{Boot}"Cygnus:buildtools:Flex.skel + Export FLEX_SKELETON + +* Configuring + +Before you can build anything, you must configure. You do this by +creating an directory where object files will be stored, setdirectory +to that directory and do a configure command: + + {Boot}Cygnus:src:mpw-configure --target --cc --srcdir {Boot}Cygnus:src: --prefix + +If the source directory is not in your {Commands} list, then you must +supply a full pathname to mpw-configure, since mpw-configure invokes +itself after switching into each subdirectory. Using a relative +pathname, even something like ':mpw-configure', will therefore not work. + + must be a known target. Valid ones include "m68k-apple-macos", +"powerpc-apple-macos", "i386-unknown-go32", "mips-idt-ecoff", and +"sh-hitachi-hms". Not all target types are accepted for all of the +tools yet. + + must be the name of the compiler to use. It defaults to "mpwc". + + (m68k) + mpwc MPW C + sc68k Symantec C + mwc68k Metrowerks C (Codewarrior) + gcc68k GCC + + (powerpc) + ppcc PPCC + mrc Macintosh on RisC (Mister C, aka(?) Frankenstein) + scppc Symantec C + mwcppc Metrowerks C (Codewarrior) + gccppc GCC + +Not all compilers will compile all tools equally well! For m68k Macs, +MPW C has the best record so far (it has problems, but they can be +worked around), while for PowerMacs, CodeWarrior is the only compiler +that has successfully compiled everything into running code. + + is the path that "gcc" will prepend when looking for tools +to execute. GCC_EXEC_PREFIX overrides this value, so you need not +include it if you plan to use GCC_EXEC_PREFIX. + +As an example, here is the configure line that you could use to build +native PowerMac GCC: + +"{Boot}"Cygnus:src:mpw-configure --cc mwcppc --target powerpc-apple-macos --srcdir "{Boot}"Cygnus:src: --prefix "{Boot}"GNUTools: + +* Building + +If you use CodeWarrior, you *must* first set MWCIncludes to +{CIncludes}. This is because you will be building MPW tools, and +their standard I/O works by making references to data that is part of +the MPW Shell, which means that the code must be compiled and linked +with macros that refer to that data, and those macros are in +{CIncludes}, not the default {MWCIncludes}. Without this change, you +will encounter problems compiling libiberty/mpw.c, but tweaking that +file only masks the real problem, and does not fix it. + +The command + + mpw-build + +will build everything. Building will take over an hour on a Quadra 800 +or PowerMac 8100/110, longer if the sources are on a shared volume. + +You may see some warnings; these are mostly likely benign, typically +disagreements about declarations of library and system functions. + +* Installing + +To install the just-built tools, use the command mpw-build install -will install it. +This part of the installation procedure just copies files to the +location specified at configure time by , and, in some cases, +renames them from temporary internal names to their usual names. This +install process is *not* the same as what the Install script does; +Install can copy tools from the installation location chosen at +configuration time to a user-chosen place, and sets up a UserStartup +file. Note that while the Install script is optional, the install +build action performs some tasks would be very hard to replicate +manually, so you should always do it before using the tools. + +* Known Problems With Using Various Compilers to Build + +Most versions of MPW C have problems with compiling GNU software. + +MPW C 3.2.x has preprocessing bugs that render it incapable of +compiling the BFD library, so it can't be used at all for building BFD. + +MPW C 3.3, 3.3.1, and 3.3.2 will spontaneously claim to have found +errors in the source code, but in fact the code is perfectly fine. If +this happens, just set the working directory back to the top-level +objdir (where the configure command above was performed), and type +"mpw-build all" again. If it goes on through the supposed error, then +you got one of the spurious errors. A full build may require a number +of these restarts. + +MPW C 3.3.3 seems to work OK, at least with the aid of a number of +workarounds that are in the sources (look for #ifdef MPW_C). + +Versions of MPW Make earlier than 4.0d2 have exhibited bizarre behavior, +failure to substitute variables and the like. + +Metrowerks CW6 PPC linker (MWLinkPPC) seems to do bad things with memory +if the "Modern Memory Manager" is turned on (in the Memory control panel), +but works OK if it is turned off. + +Metrowerks CW6 loses bigtime compiling opcodes:ppc-opc.c, which has +some deeply nested macros. (CW7 is OK.) There is a way to patch the +file, by substituting constant values. If you need to do this, +contact shebs@cygnus.com for details. + + is missing from {CIncludes} in the MPW version that comes +with CW7. You can just copy the one in CW7's {MWCIncludes}. + +CW8 and later have changes to headers and such that will require changes +to the source in order to be able to use them to rebuild. KNOWN BUGS -ar rc xxx doesn't work. +The declarations for memcpy and memcmp in some versions of header files +may conflict with GCC's builtin definition. Either use -fno-builtin +or ignore the warnings. + +This is not a bug, but - watch out for cr/nl translation! For instance, +if config/mpw-mh-mpw is not properly translated because it has been +copied or updated separately, then everything will almost build, but +you will get puzzling error messages from make or the compiler. + +'/' or ' ' embedded in any device, directory, or file name may or may +not work. + +objcopy -O srec foo.o makes random output filenames. + +Mac-x-mips requires -mgas but Unix hosts don't. -objdump -i idiocy where it creates dummy files. +GDB will frequently require a '/' on the front of a device name in order +to recognize it as an absolute rather than a relative pathname. -objcopy -O srec foo.o makes weird output filenames. +GDB doesn't seem to use the printer port correctly, although it tries. -Mac host requires -mgas but Unix hosts don't. +The cursor doesn't always spin as much as it should. To get elaborate +statistics and warnings about spin rates, add this to UserStartup: + set MEASURE_SPIN all + export MEASURE_SPIN diff --git a/mpw-build.in b/mpw-build.in index c9ea70d508b..86d9530fa3b 100644 --- a/mpw-build.in +++ b/mpw-build.in @@ -24,43 +24,91 @@ Loop Shift 1 End Loop +If "{BuildTarget}" =~ /none/ + Set BuildTarget "all" +End If + If {verify} == 1 Echo "#" Doing "{ThisScript}" "{BuildTarget}" in "`Directory`" ... End If +Set ranmake 0 + If "`Exists Makefile`" != "" Echo "Set Echo 1" >{BuildTarget}.makeout Make -f Makefile {BuildTarget} >>{BuildTarget}.makeout {BuildTarget}.makeout Delete {BuildTarget}.makeout -Else If "{BuildTarget}" =~ /all/ + Set ranmake 1 +End If + +If "`Exists Makefile.PPC`" != "" + Echo "Set Echo 1" >{BuildTarget}.makeout.ppc + Make -f Makefile.PPC {BuildTarget} >>{BuildTarget}.makeout.ppc + {BuildTarget}.makeout.ppc + Delete {BuildTarget}.makeout.ppc + Set ranmake 1 +End If + +If {ranmake} == 1 + Exit +End If + +# Dispatch on various pseudo-targets. + +If "{BuildTarget}" =~ /all/ + Echo Started `Date` "{ThisScript}" all-gcc - "{ThisScript}" all-ld "{ThisScript}" all-gdb -Else If "{BuildTarget}" =~ /all-binutils/ + Echo Finished `Date` +Else If "{BuildTarget}" =~ /all-libiberty/ "{ThisScript}" do-libiberty +Else If "{BuildTarget}" =~ /all-bfd/ "{ThisScript}" do-bfd +Else If "{BuildTarget}" =~ /all-opcodes/ "{ThisScript}" do-opcodes +Else If "{BuildTarget}" =~ /all-byacc/ + "{ThisScript}" do-byacc +Else If "{BuildTarget}" =~ /all-flex/ + "{ThisScript}" all-libiberty + "{ThisScript}" do-flex +Else If "{BuildTarget}" =~ /all-binutils/ + "{ThisScript}" all-libiberty + "{ThisScript}" all-bfd + "{ThisScript}" all-opcodes "{ThisScript}" do-binutils Else If "{BuildTarget}" =~ /all-gas/ - "{ThisScript}" do-libiberty - "{ThisScript}" do-bfd - "{ThisScript}" do-opcodes + "{ThisScript}" all-libiberty + "{ThisScript}" all-bfd + "{ThisScript}" all-opcodes "{ThisScript}" do-gas Else If "{BuildTarget}" =~ /all-gcc/ + "{ThisScript}" all-libiberty "{ThisScript}" all-gas "{ThisScript}" all-binutils + "{ThisScript}" all-ld "{ThisScript}" do-gcc Else If "{BuildTarget}" =~ /all-gdb/ - "{ThisScript}" do-libiberty - "{ThisScript}" do-bfd - "{ThisScript}" do-opcodes + "{ThisScript}" all-libiberty + "{ThisScript}" all-bfd + "{ThisScript}" all-opcodes "{ThisScript}" do-gdb +Else If "{BuildTarget}" =~ /all-grez/ + "{ThisScript}" all-libiberty + "{ThisScript}" all-bfd + "{ThisScript}" do-grez Else If "{BuildTarget}" =~ /all-ld/ - "{ThisScript}" do-libiberty - "{ThisScript}" do-bfd - "{ThisScript}" do-opcodes + "{ThisScript}" all-libiberty + "{ThisScript}" all-bfd + "{ThisScript}" all-opcodes "{ThisScript}" do-ld +Else If "{BuildTarget}" =~ /do-byacc/ + SetDirectory :byacc: + ::mpw-build all +Else If "{BuildTarget}" =~ /do-flex/ + SetDirectory :flex: + ::mpw-build _bootstrap + ::mpw-build all Else If "{BuildTarget}" =~ /do-bfd/ SetDirectory :bfd: ::mpw-build all @@ -72,25 +120,34 @@ Else If "{BuildTarget}" =~ /do-opcodes/ ::mpw-build all Else If "{BuildTarget}" =~ /do-binutils/ SetDirectory :binutils: + ::mpw-build stamps ::mpw-build all Else If "{BuildTarget}" =~ /do-gas/ SetDirectory :gas: + ::mpw-build stamps ::mpw-build all Else If "{BuildTarget}" =~ /do-gcc/ SetDirectory :gcc: - ::mpw-build all + :mpw-build all Else If "{BuildTarget}" =~ /do-gdb/ SetDirectory :gdb: ::mpw-build all +Else If "{BuildTarget}" =~ /do-grez/ + SetDirectory :grez: + ::mpw-build all Else If "{BuildTarget}" =~ /do-ld/ SetDirectory :ld: ::mpw-build all +Else If "{BuildTarget}" =~ /do-newlib/ + SetDirectory :newlib: + ::mpw-build all Else If "{BuildTarget}" =~ /install/ + "{ThisScript}" install-only-top "{ThisScript}" install-binutils "{ThisScript}" install-gas "{ThisScript}" install-gcc -# "{ThisScript}" install-gdb "{ThisScript}" install-ld + "{ThisScript}" install-gdb Else If "{BuildTarget}" =~ /install-binutils/ SetDirectory :binutils: ::mpw-build install @@ -99,14 +156,49 @@ Else If "{BuildTarget}" =~ /install-gas/ ::mpw-build install Else If "{BuildTarget}" =~ /install-gcc/ SetDirectory :gcc: - ::mpw-build install + :mpw-build install Else If "{BuildTarget}" =~ /install-gdb/ SetDirectory :gdb: ::mpw-build install +Else If "{BuildTarget}" =~ /install-grez/ + SetDirectory :grez: + ::mpw-build install Else If "{BuildTarget}" =~ /install-ld/ SetDirectory :ld: ::mpw-build install +Else If "{BuildTarget}" =~ /install-only/ + "{ThisScript}" install-only-top + "{ThisScript}" install-only-binutils + "{ThisScript}" install-only-gas + "{ThisScript}" install-only-gcc + "{ThisScript}" install-only-gdb + "{ThisScript}" install-only-ld +Else If "{BuildTarget}" =~ /install-only-binutils/ + SetDirectory :binutils: + ::mpw-build install-only +Else If "{BuildTarget}" =~ /install-only-gas/ + SetDirectory :gas: + ::mpw-build install-only +Else If "{BuildTarget}" =~ /install-only-gcc/ + SetDirectory :gcc: + :mpw-build install-only +Else If "{BuildTarget}" =~ /install-only-gdb/ + SetDirectory :gdb: + ::mpw-build install-only +Else If "{BuildTarget}" =~ /install-only-grez/ + SetDirectory :grez: + ::mpw-build install-only +Else If "{BuildTarget}" =~ /install-only-ld/ + SetDirectory :ld: + ::mpw-build install-only +Else If "{BuildTarget}" =~ /install-only-top/ + NewFolderRecursive "{prefix}" + If "{prefix}" != "`Directory`" + Duplicate -y 'Read Me for MPW' "{prefix}"'Read Me for MPW' + Duplicate -y Install "{prefix}"Install + End If Else + Echo {BuildTarget} not understood, ignoring End If SetDirectory "{savedir}" diff --git a/mpw-config.in b/mpw-config.in index 534644e61a8..8028737a8b6 100644 --- a/mpw-config.in +++ b/mpw-config.in @@ -1,13 +1,42 @@ # Configuration fragment for Cygnus source tree. -Set host_libs "libiberty opcodes bfd readline" +# Check that we can find all the special tools that we will need. +# The test for sed is semi-pointless, because it's already been invoked +# by the calculation of target_cpu in the main configure script, but +# the test will also show which one is being used. -Set host_tools "byacc flex binutils ld gas gcc gdb" +Set Exit 0 +Echo byacc is `Which byacc` +Echo flex is `Which flex` +Echo forward-include is `Which forward-include` +Echo MoveIfChange is `Which MoveIfChange` +Echo mpw-touch is `Which mpw-touch` +Echo mpw-true is `Which mpw-true` +Echo NewFolderRecursive is `Which NewFolderRecursive` +Echo null-command is `Which null-command` +Echo open-brace is `Which open-brace` +Echo sed is `Which sed` +Echo 'tr-7to8' is `Which tr-7to8` +Echo true is `Which true` +Set Exit 1 -Set target_libs "" +Set host_libs "mmalloc libiberty opcodes bfd readline gash tcl tk tclX" -Set target_tools "" +Set host_tools "texinfo byacc flex bison binutils ld gas gcc gdb make patch \Option-d + prms send-pr gprof gdbtest tgas etc expect dejagnu sim bash \Option-d + m4 autoconf ispell grep diff rcs cvs fileutils shellutils time \Option-d + textutils wdiff find emacs emacs19 uudecode hello tar gzip indent \Option-d + recode release sed utils guile perl apache inet gawk" +Set target_libs "newlib" + +Set target_tools "examples" + +# Configure the resource compiler if targeting Macs. +If {target_os} =~ /macos/ || {target_os} =~ /mpw/ + Set host_tools "{host_tools} grez" +End If + Set configdirs "{host_libs} {host_tools} {target_libs} {target_tools}" Export configdirs @@ -20,8 +49,65 @@ End If Set edir "{objdir}extra-include:" forward-include "{srcdir}"include:mpw:sys:file.h "{edir}"'sys/file.h' +forward-include "{srcdir}"include:mpw:sys:ioctl.h "{edir}"'sys/ioctl.h' forward-include "{srcdir}"include:mpw:sys:param.h "{edir}"'sys/param.h' forward-include "{srcdir}"include:mpw:sys:resource.h "{edir}"'sys/resource.h' forward-include "{srcdir}"include:mpw:sys:stat.h "{edir}"'sys/stat.h' forward-include "{srcdir}"include:mpw:sys:time.h "{edir}"'sys/time.h' forward-include "{srcdir}"include:mpw:sys:types.h "{edir}"'sys/types.h' + +forward-include "{srcroot}"include:aout:aout64.h "{edir}"'aout/aout64.h' +forward-include "{srcroot}"include:aout:ar.h "{edir}"'aout/ar.h' +forward-include "{srcroot}"include:aout:ranlib.h "{edir}"'aout/ranlib.h' +forward-include "{srcroot}"include:aout:reloc.h "{edir}"'aout/reloc.h' +forward-include "{srcroot}"include:aout:stab.def "{edir}"'aout/stab.def' +forward-include "{srcroot}"include:aout:stab_gnu.h "{edir}"'aout/stab_gnu.h' + +If "`Exists "{srcroot}"include:aout:"{target_cpu}".h`" != "" + forward-include "{srcroot}"include:aout:"{target_cpu}".h "{edir}"'aout/'"{target_cpu}"'.h' +End If + +forward-include "{srcroot}"include:coff:ecoff.h "{edir}"'coff/ecoff.h' +forward-include "{srcroot}"include:coff:internal.h "{edir}"'coff/internal.h' +forward-include "{srcroot}"include:coff:sym.h "{edir}"'coff/sym.h' +forward-include "{srcroot}"include:coff:symconst.h "{edir}"'coff/symconst.h' + +If "`Exists "{srcroot}"include:coff:"{target_cpu}".h`" != "" + forward-include "{srcroot}"include:coff:"{target_cpu}".h "{edir}"'coff/'"{target_cpu}"'.h' +End If +If "{target_cpu}" =~ /powerpc/ + forward-include "{srcroot}"include:coff:rs6000.h "{edir}"'coff/rs6000.h' +End If + +forward-include "{srcroot}"include:elf:common.h "{edir}"'elf/common.h' +forward-include "{srcroot}"include:elf:dwarf.h "{edir}"'elf/dwarf.h' +forward-include "{srcroot}"include:elf:dwarf2.h "{edir}"'elf/dwarf2.h' +forward-include "{srcroot}"include:elf:external.h "{edir}"'elf/external.h' +forward-include "{srcroot}"include:elf:internal.h "{edir}"'elf/internal.h' + +# Believe it or not, GDB needs this for all targets. +forward-include "{srcroot}"include:elf:mips.h "{edir}"'elf/mips.h' + +If "`Exists "{srcroot}"include:elf:"{target_cpu}".h`" != "" + forward-include "{srcroot}"include:elf:"{target_cpu}".h "{edir}"'elf/'"{target_cpu}"'.h' +End If +If "{target_cpu}" =~ /powerpc/ + forward-include "{srcroot}"include:elf:ppc.h "{edir}"'elf/ppc.h' +End If + +If "`Exists "{srcroot}"include:opcode:"{target_cpu}".h`" != "" + forward-include "{srcroot}"include:opcode:"{target_cpu}".h "{edir}"'opcode/'"{target_cpu}"'.h' +End If +If "{target_cpu}" =~ /powerpc/ + forward-include "{srcroot}"include:opcode:ppc.h "{edir}"'opcode/ppc.h' +End If + +# Add some bfd includes that get mentioned outside the bfd dir. + +forward-include "{srcroot}"bfd:libcoff.h "{edir}"'bfd/libcoff.h' +forward-include "{srcroot}"bfd:libecoff.h "{edir}"'bfd/libecoff.h' + +# Translate random files into MPW-only character set. + +tr-7to8 "{srcdir}"mpw-README > "{objdir}Read Me for MPW" +tr-7to8 "{srcdir}"mpw-install > "{objdir}"Install diff --git a/mpw-configure b/mpw-configure index 01e0c8b00e6..cf45148ec63 100644 --- a/mpw-configure +++ b/mpw-configure @@ -1,5 +1,5 @@ # Configuration script -# Copyright (C) 1994, 1995 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ### WARNING -### This script (and mpw-config.in fragments) must NOT use any 8-bit chars! +### This script must NOT use any 8-bit chars! ### WARNING # This is an MPW Shell script that sets everything up for compilation, @@ -38,6 +38,8 @@ Set prefix "{MPW}":GNUTools: Set exec_prefix "" +Set bindir "" + Set host_alias "m68k-apple-mpw" Set target_alias {host_alias} @@ -46,9 +48,16 @@ Set host_cc "mpwc" Set with_gnu_ld 0 +Set helpoutput 0 + +Set recurse 1 + Set verify 0 Set verifystr "" +Set enable_options "" +Set disable_options "" + # Parse arguments. Loop @@ -56,15 +65,25 @@ Loop If "{1}" =~ /--cc/ Set host_cc "{2}" Shift 1 - Else If "{1}" =~ /--enable/ - Set "{2}" 1 + Else If "{1}" =~ /--bindir/ + Set bindir "{2}" Shift 1 + Else If "{1}" =~ /--disable-?+/ + Set `Echo {1} | sed -e 's/--disable-/enable_/'` no + Set disable_options "{disable_options} '{1}'" + Else If "{1}" =~ /--enable-?+/ + Set `Echo {1} | sed -e 's/--enable-/enable_/'` yes + Set enable_options "{enable_options} '{1}'" Else If "{1}" =~ /--exec-prefix/ Set exec_prefix "{2}" Shift 1 + Else If "{1}" =~ /--help/ + Set helpoutput 1 Else If "{1}" =~ /--host/ Set host_alias "{2}" Shift 1 + Else If "{1}" =~ /--norecursion/ + Set recurse 0 Else If "{1}" =~ /--prefix/ Set prefix "{2}" Shift 1 @@ -83,12 +102,35 @@ Loop Else If "{1}" =~ /--with-gnu-ld/ Set with_gnu_ld 1 Else - Echo "{1}" is not a valid argument + Echo -n 'mpw-configure: Unrecognized option: "' + Echo -n "{1}" + Echo '"; use --help for usage.' Exit 1 End If Shift 1 End Loop +If {helpoutput} == 1 + Echo "Usage: mpw-configure [OPTIONS]" + Echo "" + Echo "Options: [defaults in brackets]" + Echo "--bindir DIR directory for binaries []" + Echo "--cc CC use C compiler CC [mpwc]" + Echo "--disable-FOO do not include feature FOO" + Echo "--enable-FOO include feature FOO" + Echo "--exec-prefix DIR install host-dependent files into DIR []" + Echo "--help print this message" + Echo "--host HOST configure for HOST [m68k-apple-mpw]" + Echo "--norecursion configure this directory only [recurse]" + Echo "--prefix DIR install into DIR [{MPW}:GNUTools:]" + Echo "--srcdir DIR find the sources in DIR [:]" + Echo "--srcroot DIR find the toplevel sources in DIR [:]" + Echo "--target TARGET configure for TARGET [TARGET=HOST]" + Echo "-v verbose" + Echo "--with-gnu-ld link using GNU ld [no]" + Exit 0 +End If + Set Exit 0 # Default exec_prefix from prefix. @@ -97,12 +139,16 @@ If "{exec_prefix}" == "" Set exec_prefix "{prefix}" End If +If "{bindir}" == "" + Set bindir "{prefix}"bin: +End If + # Point to the correct set of tools to use with the chosen compiler. If "{host_cc}" =~ /mpwc/ Set host_alias "m68k-apple-mpw" Set cc_name '{CC_MPW_C}' - Set segment_flag '-s {Default}' + Set segment_flag '-s ' Set ar_name '{AR_LIB}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_LINK}' @@ -113,7 +159,7 @@ If "{host_cc}" =~ /mpwc/ Else If "{host_cc}" =~ /sc68k/ Set host_alias "m68k-apple-mpw" Set cc_name '{CC_SC}' - Set segment_flag '-s {Default}' + Set segment_flag '-s ' Set ar_name '{AR_LIB}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_LINK}' @@ -124,18 +170,18 @@ Else If "{host_cc}" =~ /sc68k/ Else If "{host_cc}" =~ /mwc68k/ Set host_alias "m68k-apple-mpw" Set cc_name '{CC_MWC68K}' - Set segment_flag '-s {Default}' + Set segment_flag '-s ' Set ar_name '{AR_MWLINK68K}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_MWLINK68K}' Set prog_ext_name '{PROG_EXT_68K}' - Set extralibs_name '{EXTRALIBS_C}' + Set extralibs_name '{EXTRALIBS_MWC68K}' Set makepef_name '{MAKEPEF_NULL}' - Set rez_name '{REZ_PPC}' + Set rez_name '{REZ_68K}' Else If "{host_cc}" =~ /gcc68k/ Set host_alias "m68k-apple-mpw" Set cc_name '{CC_68K_GCC}' - Set segment_flag '-s {Default}' + Set segment_flag '-s ' Set ar_name '{AR_68K_AR}' Set ranlib_name '{RANLIB_RANLIB}' Set cc_ld_name '{CC_68K_GCC}' @@ -146,7 +192,7 @@ Else If "{host_cc}" =~ /gcc68k/ Else If "{host_cc}" =~ /ppcc/ Set host_alias "powerpc-apple-mpw" Set cc_name '{CC_PPCC}' - Set segment_flag '' + Set segment_flag '-d ___s_e_g___=' Set ar_name '{AR_PPCLINK}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_PPCLINK}' @@ -157,7 +203,7 @@ Else If "{host_cc}" =~ /ppcc/ Else If "{host_cc}" =~ /mrc/ Set host_alias "powerpc-apple-mpw" Set cc_name '{CC_MRC}' - Set segment_flag '' + Set segment_flag '-d ___s_e_g___=' Set ar_name '{AR_PPCLINK}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_PPCLINK}' @@ -168,7 +214,7 @@ Else If "{host_cc}" =~ /mrc/ Else If "{host_cc}" =~ /scppc/ Set host_alias "powerpc-apple-mpw" Set cc_name '{CC_SC}' - Set segment_flag '' + Set segment_flag '-d ___s_e_g___=' Set ar_name '{AR_PPCLINK}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_PPCLINK}' @@ -179,7 +225,7 @@ Else If "{host_cc}" =~ /scppc/ Else If "{host_cc}" =~ /mwcppc/ Set host_alias "powerpc-apple-mpw" Set cc_name '{CC_MWCPPC}' - Set segment_flag '' + Set segment_flag '-d ___s_e_g___=' Set ar_name '{AR_MWLINKPPC}' Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_MWLINKPPC}' @@ -191,12 +237,13 @@ Else If "{host_cc}" =~ /mwcppc/ Else If "{host_cc}" =~ /gccppc/ Set host_alias "powerpc-apple-mpw" Set cc_name '{CC_PPC_GCC}' - Set segment_flag '' + Set segment_flag '-d ___s_e_g___=' Set ar_name '{AR_PPCLINK}' - Set ranlib_name '{RANLIB_RANLIB}' If {with_gnu_ld} == 1 + Set ranlib_name '{RANLIB_RANLIB}' Set cc_ld_name '{CC_LD_GLD}' Else + Set ranlib_name '{RANLIB_NULL}' Set cc_ld_name '{CC_LD_PPCLINK}' End If Set prog_ext_name '{PROG_EXT_XCOFF}' @@ -207,6 +254,13 @@ Else Echo "{host_cc}" is not a known MPW compiler type End If +Set dash_c_flag '' +If "{host_cc}" =~ /gcc68k/ + Set dash_c_flag '-c' +Else If "{host_cc}" =~ /gccppc/ + Set dash_c_flag '-c' +End If + # (should interpret aliases if not in canonical form) Set host_canonical "{host_alias}" @@ -241,7 +295,7 @@ End If # dependencies on config.status. Echo "# This directory was configured as follows:" >config.new -Echo "{ThisScript} --host {host_alias} --target {target_alias} --srcdir {srcdir} --srcroot {srcroot} --prefix {prefix} --cc {host_cc}" >>config.new +Echo "{ThisScript} --host {host_alias} --target {target_alias} --srcdir {srcdir} --srcroot {srcroot} --prefix {prefix} --cc {host_cc} {verifystr} {enable_options} {disable_options} --norecursion" >>config.new MoveIfChange config.new config.status If "`Exists "{srcdir}"mpw-config.in`" != "" @@ -258,6 +312,7 @@ Echo "topsrcdir = " {srcroot} >> "{objdir}"Makefile.tem Echo "srcdir = " {srcdir} >> "{objdir}"Makefile.tem Echo "mpw_prefix = " {prefix} >> "{objdir}"Makefile.tem Echo "mpw_exec_prefix = " {exec_prefix} >> "{objdir}"Makefile.tem +Echo "mpw_bindir = " {bindir} >> "{objdir}"Makefile.tem Echo "host_alias = " {host_alias} >> "{objdir}"Makefile.tem Echo "target_alias = " {target_alias} >> "{objdir}"Makefile.tem Echo "target_cpu = " {target_cpu} >> "{objdir}"Makefile.tem @@ -275,6 +330,16 @@ Echo "EXTRALIBS = " {extralibs_name} >> "{objdir}"Makefile.tem Echo "MAKEPEF = " {makepef_name} >> "{objdir}"Makefile.tem Echo "REZ = " {rez_name} >> "{objdir}"Makefile.tem +If {host_cc} =~ /gccppc/ + Echo -n "dq =\Option-d\Option-d\Option-d" > "{objdir}"Makefile.tem0 + Echo '"' >> "{objdir}"Makefile.tem0 + tr-7to8 "{objdir}"Makefile.tem0 >>"{objdir}"Makefile.tem +Else + Echo -n "dq ='" >> "{objdir}"Makefile.tem + Echo -n '"' >> "{objdir}"Makefile.tem + Echo "'" >> "{objdir}"Makefile.tem +End If + # Append the master set of definitions for the various compilers. If "`Exists "{srcdir}"config:mpw-mh-mpw`" != "" @@ -304,15 +369,25 @@ If "`Exists "{srcdir}"mpw-make.sed`" != "" Else Set MakefileIn "{srcdir}"Makefile.in End If - If "`Exists "{srcroot}"utils:mpw:g-mpw-make.sed`" != "" + # Find the generic makefile editing script. + If "`Exists "{srcroot}"config:mpw:g-mpw-make.sed`" != "" + sed -f "{srcroot}"config:mpw:g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1 + Else If "`Exists "{srcroot}"utils:mpw:g-mpw-make.sed`" != "" sed -f "{srcroot}"utils:mpw:g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1 + Else If "`Exists "{srcdir}"g-mpw-make.sed`" != "" + sed -f "{srcdir}"g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1 Else + Echo Warning: g-mpw-make.sed not found, copying "{MakefileIn}" verbatim... Catenate "{MakefileIn}" >"{objdir}"Makefile.tem1 End If sed -f "{srcdir}"mpw-make.sed "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2 - sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' -e 's/^exec_prefix = .*$/exec_prefix = {mpw_exec_prefix}/g' "{objdir}"Makefile.tem2 >"{objdir}"Makefile.tem3 - sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem3 >"{objdir}"mpw-make.in + sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' -e 's/^exec_prefix = .*$/exec_prefix = {mpw_exec_prefix}/g' -e 's/^bindir = @bindir@/bindir = {mpw_bindir}/g' "{objdir}"Makefile.tem2 >"{objdir}"Makefile.tem3 + sed -e "s/@DASH_C_FLAG@/{dash_c_flag}/" -e "s/@SEGMENT_FLAG(\([^)]*\))@/{segment_flag}\1/" "{objdir}"Makefile.tem3 >"{objdir}"mpw-make.in tr-7to8 "{objdir}"mpw-make.in >>"{objdir}"Makefile.tem + If "`Exists "{objdir}"mk.sed`" != "" + sed -f "{objdir}"mk.sed "{objdir}"Makefile.tem >"{objdir}"Makefile.tem2 + Rename -y "{objdir}"Makefile.tem2 "{objdir}"Makefile.tem + End If MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile Delete -i -y "{objdir}"Makefile.tem[12] If {verify} == 1 @@ -320,8 +395,12 @@ If "`Exists "{srcdir}"mpw-make.sed`" != "" End If Else If "`Exists "{srcdir}"mpw-make.in`" != "" sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' "{srcdir}"mpw-make.in >"{objdir}"Makefile.tem1 - sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2 + sed -e "s/@DASH_C_FLAG@/{dash_c_flag}/" -e "s/@SEGMENT_FLAG(\([^)]*\))@/{segment_flag}}\1/" "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2 tr-7to8 "{objdir}"Makefile.tem2 >>"{objdir}"Makefile.tem + If "`Exists "{objdir}"mk.sed`" != "" + sed -f "{objdir}"mk.sed "{objdir}"Makefile.tem >"{objdir}"Makefile.tem2 + Rename -y "{objdir}"Makefile.tem2 "{objdir}"Makefile.tem + End If MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile Delete -i -y "{objdir}"Makefile.tem[12] If {verify} == 1 @@ -343,21 +422,27 @@ If "`Exists "{srcdir}"mpw-build.in`" != "" End If End If -For subdir In {configdirs} - Set savedir "`Directory`" - If "`Exists "{srcdir}{subdir}:"`" == "" - Echo Strange, no {subdir} in {srcdir} - Continue - End If - If {verify} == 1 - Echo Configuring {subdir}... - End If - If "`Exists "{objdir}{subdir}:"`" == "" - NewFolder "{objdir}{subdir}" - End If - SetDirectory "{objdir}{subdir}:" - "{ThisScript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" --prefix "{prefix}" --cc "{host_cc}" {verifystr} - SetDirectory "{savedir}" -End For +# Apply ourselves recursively to the list of subdirectories to configure. + +If {recurse} == 1 + For subdir In {configdirs} + Set savedir "`Directory`" + If "`Exists "{srcdir}{subdir}:"`" == "" + If {verify} == 1 + Echo No "{srcdir}{subdir}:" found, skipping + End If + Continue + End If + If {verify} == 1 + Echo Configuring {subdir}... + End If + If "`Exists "{objdir}{subdir}:"`" == "" + NewFolder "{objdir}{subdir}" + End If + SetDirectory "{objdir}{subdir}:" + "{ThisScript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" --prefix "{prefix}" --cc "{host_cc}" {verifystr} {enable_options} {disable_options} + SetDirectory "{savedir}" + End For +End If SetDirectory "{savedir}" diff --git a/mpw-install b/mpw-install new file mode 100644 index 00000000000..04c5aac2a4f --- /dev/null +++ b/mpw-install @@ -0,0 +1,122 @@ +# GNU Install script for MPW. + +Set OldExit "{Exit}" +Set Exit 0 + +Set TempUserStartup "{TempFolder}"__temp__UserStartup + +Echo '# UserStartup generated by GNU Install script' > "{TempUserStartup}" +Echo '' >> "{TempUserStartup}" + +# (should) Check that disk space is sufficient for installation. + +# Assume that the install script is where everything else is. + +Set thisdir "`Directory`" + +# Copy the binaries to the desired place. + +Confirm -t "Copy the binaries to somewhere else?" +Set TmpStatus {Status} +If {TmpStatus} == 0 + Set bindest "`GetFileName -d -m "Where to install the binaries?"`" + If {Status} == 0 + If "`Exists "{thisdir}bin"`" != "" + For afile In "{thisdir}"bin:\Option-x + Duplicate -y "{afile}" "{bindest}" + End For + Else + Echo "bin directory not found, exiting" + Exit 1 + End If + Else + Echo "No destination supplied, exiting" + Exit 1 + End If +Else If {TmpStatus} == 4 + # Use the existing directory. + Set bindest "{thisdir}bin:" +Else + # Cancelled from confirmation, escape altogether. + Exit 1 +End If + +# Copy the libraries to the desired place. + +Confirm -t "Copy the libraries to somewhere else?" +Set TmpStatus {Status} +If {TmpStatus} == 0 + Set libdest "`GetFileName -d -m "Where to install the libraries?"`" + If {Status} == 0 + If "`Exists "{thisdir}lib:"`" != "" + For afile In "{thisdir}"lib:\Option-x + Duplicate -y "{afile}" "{libdest}" + End For + Else + Echo "lib directory not found, exiting" + Exit 1 + End If + Else + Echo "No destination supplied, exiting" + Exit 1 + End If +Else If {TmpStatus} == 4 + # Use the existing directory. + Set libdest "{thisdir}lib:" +Else + # Cancelled from confirmation, escape altogether. + Exit 1 +End If + + +# Add the location of the binaries to the command path. + +Echo -n 'Set Commands "' >> "{TempUserStartup}" +Echo -n "{bindest}" >> "{TempUserStartup}" +Echo ',{Commands}"' >> "{TempUserStartup}" +Echo '' >> "{TempUserStartup}" + +# Set up GCC exec prefix. + +Set gcclibdir "{libdest}"gcc-lib: + +Echo -n 'Set GCC_EXEC_PREFIX "' >> "{TempUserStartup}" +Echo -n "{gcclibdir}" >> "{TempUserStartup}" +Echo '"' >> "{TempUserStartup}" +Echo "Export GCC_EXEC_PREFIX" >> "{TempUserStartup}" +Echo '' >> "{TempUserStartup}" + +# Set up path to libgcc.xcoff etc. + +Echo -n 'Set GCCPPCLibraries "' >> "{TempUserStartup}" +Echo -n "{libdest}" >> "{TempUserStartup}" +Echo '"' >> "{TempUserStartup}" +Echo "Export GCCPPCLibraries" >> "{TempUserStartup}" +Echo '' >> "{TempUserStartup}" + +# Display contents of UserStartup, confirm installation. + +Set UserStartupName "UserStartup\Option-8GNU" + +Echo "Contents of" {UserStartupName} "will be:" +Catenate "{TempUserStartup}" + +Confirm "Install {UserStartupName} into the MPW folder {MPW} ?" +If {Status} == 0 + Duplicate "{TempUserStartup}" "{MPW}{UserStartupName}" + Delete -y "{TempUserStartup}" +Else + Echo "{UserStartupName} file not installed" +End If + +# (should) Check HEXA resource, warn if low. + +# (should) Check for spaces in pathnames, warn if found. + +Echo "Installation was successful." +Echo "" +Echo "Be sure to review the usage notes in 'Read Me for MPW' before proceeding!" + +# Restore previous settings. + +Set Exit "{OldExit}" diff --git a/symlink-tree b/symlink-tree new file mode 100755 index 00000000000..096582db6eb --- /dev/null +++ b/symlink-tree @@ -0,0 +1,48 @@ +#!/bin/sh +# Create a symlink tree. +# +# Syntax: symlink-tree srcdir "ignore1 ignore2 ..." +# +# where srcdir is the directory to create a symlink tree to, +# and "ignoreN" is a list of files/directories to ignore. + +prog=$0 +srcdir=$1 +ignore="$2" + +ignore_additional=". .. CVS" + +# If we were invoked with a relative path name, adjust ${prog} to work +# in subdirs. +case ${prog} in +/*) ;; +*) prog=../${prog} ;; +esac + +# Set newsrcdir to something subdirectories can use. +case ${srcdir} in +/*) newsrcdir=${srcdir} ;; +*) newsrcdir=../${srcdir} ;; +esac + +for f in `ls -a ${srcdir}`; do + if [ -d ${srcdir}/$f ]; then + found= + for i in ${ignore} ${ignore_additional}; do + if [ "$f" = "$i" ]; then + found=yes + fi + done + if [ -z "${found}" ]; then + echo "$f ..working in" + if [ -d $f ]; then true; else mkdir $f; fi + (cd $f; ${prog} ${newsrcdir}/$f "${ignore}") + fi + else + echo "$f ..linked" + rm -f $f + ln -s ${srcdir}/$f . + fi +done + +exit 0 diff --git a/ylwrap b/ylwrap index 2d0f97ff4f8..2288ccde3ac 100755 --- a/ylwrap +++ b/ylwrap @@ -31,7 +31,7 @@ prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in - /*) ;; + /* | [A-Za-z]:\\*) ;; */*) prog="`pwd`/$prog" ;; esac @@ -75,7 +75,7 @@ mkdir $dirname || exit 1 cd $dirname case "$input" in - /*) + /* | [A-Za-z]:\\*) # Absolute path; do nothing. ;; *) @@ -95,7 +95,7 @@ if test $status -eq 0; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in - /*) target="$2";; + /* | [A-Za-z]:\\*) target="$2";; *) target="../$2";; esac mv "$1" "$target" || status=$? -- 2.30.2