Subject: Re: crosscompiling GNU, how?
From: [email-masked] ("Mikey")

8 Apr 1997 22:28:57 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_NextPart_000_01BC4407.E0836AA0"
Content-Transfer-Encoding: 7bit
Original-To: "Janusz J. Mlodzianowski" <[email-masked]>
Original-Cc: "cygnus" <[email-masked]>
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
Original-Sender: [email-masked]

This is a multi-part message in MIME format.

------=_NextPart_000_01BC4407.E0836AA0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Enclosed is the shell script I used to set up a cross compiler for my linux
box, It may not be exactly what you need, but reading throug it should give
you some pointers ;^).
 
> I have the following problem and question:
> I need to build a crosscompiler host: NeXT or Linux and target: Win95.
> I have downloaded the complete cdksrc.tar.gz package. After unpacking
> I am faced with zillions of files and some 200-300MB of source code.
> I understand that I do not need at least some of this code.
> Could I simply remove unnecessary files and packages (like hp 68k z88
etc)?
> If so what files need to remain?
(see enclosed)
> I already have a working GNU package supplied with my NeXT installation.
> I do not want to corrupt it. Should I (how and where to) change the
default
> directories (/usr , /etc)? If I recompile the lot as a user and not root
> NeXT (Linux) will not allow make to access system directories (am I
right?)
(depends on what permissions your user account has, but installing as root
will probably be necessary)
> Is it possible that I use the existing GNU compiler to produce the
assembler

(ummm, I think you mean the compiler output, and no, the compiler, and
assembler, are the 2 tools that HAVE to be different, you can rebuild your
system binutils with --enable-targets i386-cygwin32, so that you only have
1 set of ranlib ar ..., but that is a lot of work, especially since you
would need (I believe) to go to an all cygnus toolchain, and for only a
couple of megabytes I don't think it's worth it.)

> output and then run it through crossassembler and crosslinker? This would
> greatly speed up the whole procedure.

------=_NextPart_000_01BC4407.E0836AA0
Content-Type: application/octet-stream; name="ar_obj.dif"
Content-Transfer-Encoding: quoted-printable
Content-Description: ar_obj.dif (DIF File)
Content-Disposition: attachment; filename="ar_obj.dif"

--- Makefile.in	1997/03/06 00:54:31	1.1=0A=
+++ Makefile.in	1997/03/06 01:01:16=0A=
@@ -308,15 +308,15 @@=0A=
 =0A=
 # Alternatively, you can install ranlib.sh as ranlib.=0A=
 =0A=
-ar_with_ranlib: $(ADDL_DEPS) ar.o maybe-ranlib.o=0A=
-	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o =
maybe-ranlib.o $(ADDL_LIBS) $(EXTRALIBS)=0A=
+ar_with_ranlib: $(ADDL_DEPS) ar.o arparse.o arlex.o maybe-ranlib.o =
arsup.o=0A=
+	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(AR_PROG) ar.o =
arparse.o arlex.o maybe-ranlib.o arsup.o $(ADDL_LIBS) $(EXTRALIBS)=0A=
 	-rm -f $(RANLIB_PROG)=0A=
 	-ln $(AR_PROG) $(RANLIB_PROG)=0A=
 =0A=
 # objcopy and strip in one binary that uses argv[0] to decide its =
action.=0A=
 =0A=
-objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o=0A=
-	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) =
objcopy.o maybe-strip.o $(ADDL_LIBS) $(EXTRALIBS)=0A=
+objcopy_with_strip: $(ADDL_DEPS) objcopy.o maybe-strip.o =
$(WRITE_DEBUG_OBJS)=0A=
+	$(HLDENV) $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(OBJCOPY_PROG) =
objcopy.o maybe-strip.o $(WRITE_DEBUG_OBJS) $(ADDL_LIBS) $(EXTRALIBS)=0A=
 	-rm -f $(STRIP_PROG)=0A=
 	-ln $(OBJCOPY_PROG) $(STRIP_PROG)=0A=
 =0A=

------=_NextPart_000_01BC4407.E0836AA0
Content-Type: application/octet-stream; name="gas.dif"
Content-Transfer-Encoding: quoted-printable
Content-Description: gas.dif (DIF File)
Content-Disposition: attachment; filename="gas.dif"

--- Makefile.in	1997/03/06 00:27:41	1.1=0A=
+++ Makefile.in	1997/03/06 00:21:58=0A=
@@ -231,9 +231,9 @@=0A=
 =0A=
 # How to link with both our special library facilities=0A=
 # and the system's installed libraries.=0A=
-=0A=
+LIBIBERTY =3D ../libiberty/libiberty.a=0A=
 LIBDEPS =3D @OPCODES_DEP@ @BFDDEP@ $(LOCAL_LOADLIBES) =
..../libiberty/libiberty.a=0A=
-LIBS =3D @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) =
..../libiberty/libiberty.a=0A=
+LIBS =3D @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) $(LIBIBERTY)=0A=
 =0A=
 # Specify the directories to be searched for header files.=0A=
 # Both . and srcdir are used, in that order,=0A=
@@ -262,7 +262,7 @@=0A=
 	listing.h bignum.h $(srcdir)/../include/libiberty.h=0A=
 =0A=
 gasp.new: $(GASPOBJS) ../libiberty/libiberty.a=0A=
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) =
..../libiberty/libiberty.a $(LOADLIBES)=0A=
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) $(LIBS) =
$(LOADLIBES)=0A=
 =0A=
 installcheck:=0A=
 	@echo No installcheck target is available yet for the GNU =
assembler.=0A=

------=_NextPart_000_01BC4407.E0836AA0
Content-Type: application/octet-stream; name="SB.cross"
Content-Transfer-Encoding: quoted-printable
Content-Description: SB.cross (CROSS File)
Content-Disposition: attachment; filename="SB.cross"

#!/bin/sh=0A=
#this is a bash shell script to make a linux/cygwin32 cross compiler=0A=
#it is designed to hopefully :^) minimize disk space usage, and=0A=
#maximize the speed of the resulting cross-compiler=0A=
set -a #export all variables=0A=
=0A=
#echo change the following variables to fit your setup=0A=
=0A=
CROSS_PREFIX=3D/dos/c/usr=0A=
CWD=3D`pwd`=0A=
GXXINCLUDE=3D$CROSS_PREFIX/include/g++=0A=
MY_HOST_COMPILER=3Di586-unknown-linux=0A=
CC=3Dgcc=0A=
CPPNAME=3D"gcc -E"=0A=
SRC_DIR=3D$CROSS_PREFIX/src/cygwin32=0A=
CYG_VER=3Dcygnus-2.7.2-961023=0A=
=0A=
if [ ! -f $SRC_DIR/CYGNUS ];then=0A=
 echo "please show me the source Luke :^)"=0A=
 exit 1;=0A=
fi=0A=
=0A=
# first make sure only the necessary dirs get built=0A=
[ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild=0A=
if [ -d $SRC_DIR/byacc ];then=0A=
  pushd $SRC_DIR=0A=
  mv -f bash byacc dejagnu diff dosrel expect fileutils findutils flex =
gawk \=0A=
    gdb gprof grep grez gzip less libg++ libgloss libio librx libstdc++ =
m4 \=0A=
    make mmalloc ncurses newlib patch readline release sed send-pr \=0A=
    shellutils sim tar tcl texinfo textutils time tk utils winsup =
xiberty \=0A=
    znobuild/=0A=
  popd=0A=
fi =0A=
=0A=
if [ x"$TMP" =3D x ];then=0A=
  [ -d /tmp ] || mkdir /tmp=0A=
  TMP=3D/tmp;=0A=
fi=0A=
=0A=
cd $TMP=0A=
mkdir -p cx32o tmp/usr=0A=
=0A=
if [ ! -f $SRC_DIR/binutils/Makefile.in.* ];then=0A=
	patch -p0 -d $SRC_DIR/binutils/ < $CWD/ar_obj.dif;=0A=
fi=0A=
if [ ! -f $SRC_DIR/gas/Makefile.in.* ];then=0A=
	patch -p0 -d $SRC_DIR/gas/ < $CWD/gas.dif;=0A=
fi=0A=
 =0A=
cd cx32o=0A=
=0A=
if [ ! -f config.status ];then=0A=
    $SRC_DIR/configure --prefix=3D/usr\=0A=
      --enable-commonbfdlib --enable-shared\=0A=
      --host=3D$MY_HOST_COMPILER\=0A=
      --target=3Di386-cygwin32 -v =0A=
fi=0A=
=0A=
make CFLAGS=3D"-O3 -m486 -malign-jumps=3D2 -malign-functions=3D2 =
-malign-loops=3D2 -fno-strength-reduce" LDFLAGS=3D-s=0A=
=0A=
make CFLAGS=3D"-O3 -m486 -malign-jumps=3D2 -malign-functions=3D2 =
-malign-loops=3D2 -fno-strength-reduce" LDFLAGS=3D-s -C binutils/ =
ar_with_ranlib objcopy_with_strip=0A=
=0A=
make prefix=3D$TMP/tmp/usr install=0A=
=0A=
#this causes a bad invocation of cpp at least for me :^) so get rid of =
it.=0A=
=0A=
sed s/%\\[cpp_cpu\\]// < gcc/specs > =
$TMP/tmp/usr/lib/gcc-lib/i386-cygwin32/$CYG_VER/specs=0A=
=0A=
cd ../tmp/usr/bin=0A=
rm protoize unprotoize=0A=
ln -sf i386-cygwin32-ar i386-cygwin32-ranlib=0A=
ln -sf i386-cygwin32-objcopy i386-cygwin32-strip=0A=
ln -sf i386-cygwin32-g++ i386-cygwin32-c++=0A=
strip *=0A=
cd ../lib=0A=
rm -fr *.a ../man ../info=0A=
strip * =0A=
cd ../include=0A=
ln -sf GXXINCLUDE g++cygwin32=0A=
cd ../i386-cygwin32/bin=0A=
rmdir ../install-tools #how this got here I have no idea :)=0A=
ln -sf ../../bin/i386-cygwin32-ar ranlib=0A=
ln -sf ../../bin/i386-cygwin32-ar ar=0A=
ln -sf ../../bin/i386-cygwin32-gcc gcc=0A=
ln -sf ../../bin/i386-cygwin32-as as=0A=
ln -sf ../../bin/i386-cygwin32-dlltool dlltool=0A=
ln -sf ../../bin/i386-cygwin32-ld ld=0A=
ln -sf ../../bin/i386-cygwin32-nm nm=0A=
ln -sf ../../bin/i386-cygwin32-objcopy strip=0A=
# for when you have to reset path in the Makefile to use all cross =
tools=0A=
ln -sf ../../bin/i386-cygwin32-g++ g++=0A=
ln -sf ../../bin/i386-cygwin32-g++ c++=0A=
ln -sf ../../bin/i386-cygwin32-c++filt c++filt=0A=
ln -sf ../../bin/i386-cygwin32-gasp gasp=0A=
ln -sf ../../bin/i386-cygwin32-objcopy objcopy=0A=
ln -sf ../../bin/i386-cygwin32-objdump objdump=0A=
ln -sf ../../bin/i386-cygwin32-size size=0A=
ln -sf ../../bin/i386-cygwin32-strings strings=0A=
rm -fr ../include ../lib=0A=
cd ..=0A=
ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/include include=0A=
ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/lib lib=0A=
cd ../lib/gcc-lib/i386-cygwin32/$CYG_VER/=0A=
strip c* ld=0A=
rm -fr include=0A=
ln -s =
$CROSS_PREFIX/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/$CYG_VER/include =
include=0A=
=0A=
cd $TMP/tmp=0A=
makepkg cx32.tgz;mv cx32.tgz .. # or put your binary package maker =
here=0A=
cd $TMP=0A=
=0A=
if [ x"$1" =3D x--cleanup ];then=0A=
	rm -fr $TMP/tmp $TMP/cx32o;=0A=
        pushd $SRC_DIR=0A=
	mv -f znobuild/* .=0A=
	rmdir znobuild=0A=
	popd=0A=
fi=0A=
=0A=

------=_NextPart_000_01BC4407.E0836AA0
Content-Type: application/octet-stream; name="SB.libs"
Content-Transfer-Encoding: quoted-printable
Content-Description: SB.libs (LIBS File)
Content-Disposition: attachment; filename="SB.libs"

#!/bin/sh=0A=
#this is a bash shell script to make a the cygwin32 libraries from =
linux=0A=
#it is designed to hopefully :^) minimize disk space usage, by =
installing=0A=
#the new libraries to your vfat drive where the native cygwin32 compiler =
lives=0A=
set -a #export all variables=0A=
=0A=
#echo change the following variables to fit your setup=0A=
=0A=
CROSS_PREFIX=3Ddos/c/usr/H-i386-cygwin32 # !! NO slash here=0A=
SRC_DIR=3D/dos/c/usr/src/cygwin32=0A=
=0A=
if [ ! -f $SRC_DIR/CYGNUS ];then=0A=
 echo "please show me the source Luke :^)"=0A=
 exit 1;=0A=
fi=0A=
=0A=
if [ ! -d /$CROSS_PREFIX ];then=0A=
 echo "please show me the destination Luke :^)"=0A=
fi=0A=
=0A=
if [ x"$TMP" =3D x ];then=0A=
  [ -d /tmp ] || mkdir /tmp=0A=
  TMP=3D/tmp;=0A=
fi=0A=
=0A=
cd $TMP=0A=
mkdir -p lx32o tmp/$CROSS_PREFIX/ tmp/usr/include=0A=
=0A=
pushd tmp/usr/include=0A=
ln -sf /$CROSS_PREFIX/../include/g++ g++win32=0A=
popd=0A=
=0A=
cd lx32o=0A=
=0A=
#make sure only the necesary dirs get built=0A=
[ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild=0A=
if [ -d $SRC_DIR/byacc ];then=0A=
  pushd $SRC_DIR=0A=
  mv -f bash binutils byacc diff fileutils\=0A=
    findutils gdb gas gawk gcc gdb grep gzip ld less \=0A=
    libgloss m4 make ncurses patch sed \=0A=
    shellutils tar texinfo textutils time utils xiberty \=0A=
    dejagnu dosrel expect grez release send-pr sim tcl tk \=0A=
    znobuild/=0A=
  popd=0A=
fi=0A=
=0A=
export PATH=3D/usr/i386-cygwin32/bin:$PATH=0A=
=0A=
[ -f config.status ] || CC=3D"gcc -b i386-cygwin32 -V =
cygnus-2.7.2-961023"\=0A=
 CXX=3D"gcc -b i386-cygwin32 -V cygnus-2.7.2-961023"\=0A=
 $SRC_DIR/configure --prefix=3D/usr\=0A=
 --srcdir=3D$SRC_DIR --host=3Di586-unknown-linux =
--target=3Di386-cygwin32 -v=0A=
=0A=
make CFLAGS=3D"-O -g" LDFLAGS=3D=0A=
=0A=
make prefix=3D$TMP/tmp/$CROSS_PREFIX install=0A=
=0A=
cd $TMP/tmp/$CROSS_PREFIX/i386-cygwin32/lib=0A=
mv cygwin.dll ../../bin=0A=
mv libstdc++.a libg++.a libiberty.a libc.a libg.a libm.a ../../lib=0A=
i386-cygwin32-strip --strip-debug *.a #since these are mostly just dll =
stubs=0A=
=0A=
cd ../../lib=0A=
mv libi386-cygwin32-bfd.a libbfd.a=0A=
mv libi386-cygwin32-opcodes.a libopcodes.a=0A=
mv *.a ../i386-cygwin32/lib/=0A=
=0A=
cd ../bin=0A=
for file in cygwin ps mount umount kill;do=0A=
  mv i386-cygwin32-$file $file.exe;=0A=
done=0A=
mv flex flex.exe=0A=
rm flex++=0A=
cp flex.exe flex++.exe=0A=
strip *.exe=0A=
mv ../include ../man ../etc ../..=0A=
=0A=
cd ../../include=0A=
=0A=
mv *.h readline ../H-i386-cygwin32/i386-cygwin32/include/=0A=
mv g++/String.h g++/_String.h=0A=
mv g++/Complex.h g++/_Complex.h=0A=
=0A=
if [ "1" =3D "0" ];then #ncurses really dosen't like being built =
cross=0A=
=0A=
cd $TMP/lx32o=0A=
[ -d ncurses ] || mkdir ncurses=0A=
cd ncurses=0A=
[ -f config.status ] || CC=3D"gcc -b i386-cygwin32 -V =
cygnus-2.7.2-961023 -I/usr/i386-cygwin32/include "\=0A=
 CXX=3D"gcc -b i386-cygwin32 -V cygnus-2.7.2-961023 =
-I/usr/i386-cygwin32/include -I/dos/c/usr/include/g++"\=0A=
 PATH=3D/usr/i386-cygwin32/bin:$PATH $SRC_DIR/ncurses/configure =
--prefix=3D/usr\=0A=
 --target=3Di386-cygwin32 --enable-getcap --enable-termcap \=0A=
 --program-suffix=3D.exe --enable-symlinks -v=0A=
make includedir=3D/usr/i386-cygwin32/include=0A=
=0A=
make LDFLAGS=3D prefix=3D$TMP/tmp/$CROSS_PREFIX/.. install=0A=
=0A=
fi=0A=
=0A=
cd $TMP/tmp=0A=
makepkg lx32.tgz;mv lx32.tgz .. # or put your binary package maker =
here=0A=
cd $TMP=0A=
=0A=
if [ x"$1" =3D x--cleanup ];then=0A=
	rm -fr $TMP/tmp $TMP/lx32o;=0A=
        pushd $SRC_DIR=0A=
        mv -f znobuild/* .=0A=
        rmdir znobuild=0A=
        popd=0A=
fi=0A=
=0A=
=0A=
=0A=
=0A=
=0A=

------=_NextPart_000_01BC4407.E0836AA0
Content-Type: application/octet-stream; name="Cygmake"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="Cygmake"

#!/bin/sh
set -a
W32PATH=$PATH
PATH=/usr/i386-cygwin32/bin:$PATH
make $*

------=_NextPart_000_01BC4407.E0836AA0--

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".