public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: crosscompiling GNU, how?
@ 1997-04-08 18:15 Mikey
  0 siblings, 0 replies; 2+ messages in thread
From: Mikey @ 1997-04-08 18:15 UTC (permalink / raw)
  To: Janusz J. Mlodzianowski; +Cc: cygnus

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

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.

[-- Attachment #2: ar_obj.dif --]
[-- Type: text/x-diff, Size: 1123 bytes --]

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

[-- Attachment #3: Cygmake --]
[-- Type: text/x-shellscript, Size: 74 bytes --]

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


[-- Attachment #4: gas.dif --]
[-- Type: text/x-diff, Size: 947 bytes --]

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

[-- Attachment #5: SB.cross --]
[-- Type: text/x-shellscript, Size: 3636 bytes --]

#!/bin/sh
#this is a bash shell script to make a linux/cygwin32 cross compiler
#it is designed to hopefully :^) minimize disk space usage, and
#maximize the speed of the resulting cross-compiler
set -a #export all variables

#echo change the following variables to fit your setup

CROSS_PREFIX=/dos/c/usr
CWD=`pwd`
GXXINCLUDE=$CROSS_PREFIX/include/g++
MY_HOST_COMPILER=i586-unknown-linux
CC=gcc
CPPNAME="gcc -E"
SRC_DIR=$CROSS_PREFIX/src/cygwin32
CYG_VER=cygnus-2.7.2-961023

if [ ! -f $SRC_DIR/CYGNUS ];then
 echo "please show me the source Luke :^)"
 exit 1;
fi

# first make sure only the necessary dirs get built
[ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild
if [ -d $SRC_DIR/byacc ];then
  pushd $SRC_DIR
  mv -f bash byacc dejagnu diff dosrel expect fileutils findutils flex gawk \
    gdb gprof grep grez gzip less libg++ libgloss libio librx libstdc++ m4 \
    make mmalloc ncurses newlib patch readline release sed send-pr \
    shellutils sim tar tcl texinfo textutils time tk utils winsup xiberty \
    znobuild/
  popd
fi 

if [ x"$TMP" = x ];then
  [ -d /tmp ] || mkdir /tmp
  TMP=/tmp;
fi

cd $TMP
mkdir -p cx32o tmp/usr

if [ ! -f $SRC_DIR/binutils/Makefile.in.* ];then
	patch -p0 -d $SRC_DIR/binutils/ < $CWD/ar_obj.dif;
fi
if [ ! -f $SRC_DIR/gas/Makefile.in.* ];then
	patch -p0 -d $SRC_DIR/gas/ < $CWD/gas.dif;
fi
 
cd cx32o

if [ ! -f config.status ];then
    $SRC_DIR/configure --prefix=/usr\
      --enable-commonbfdlib --enable-shared\
      --host=$MY_HOST_COMPILER\
      --target=i386-cygwin32 -v 
fi

make CFLAGS="-O3 -m486 -malign-jumps=2 -malign-functions=2 -malign-loops=2 -fno-strength-reduce" LDFLAGS=-s

make CFLAGS="-O3 -m486 -malign-jumps=2 -malign-functions=2 -malign-loops=2 -fno-strength-reduce" LDFLAGS=-s -C binutils/ ar_with_ranlib objcopy_with_strip

make prefix=$TMP/tmp/usr install

#this causes a bad invocation of cpp at least for me :^) so get rid of it.

sed s/%\\[cpp_cpu\\]// < gcc/specs > $TMP/tmp/usr/lib/gcc-lib/i386-cygwin32/$CYG_VER/specs

cd ../tmp/usr/bin
rm protoize unprotoize
ln -sf i386-cygwin32-ar i386-cygwin32-ranlib
ln -sf i386-cygwin32-objcopy i386-cygwin32-strip
ln -sf i386-cygwin32-g++ i386-cygwin32-c++
strip *
cd ../lib
rm -fr *.a ../man ../info
strip * 
cd ../include
ln -sf GXXINCLUDE g++cygwin32
cd ../i386-cygwin32/bin
rmdir ../install-tools #how this got here I have no idea :)
ln -sf ../../bin/i386-cygwin32-ar ranlib
ln -sf ../../bin/i386-cygwin32-ar ar
ln -sf ../../bin/i386-cygwin32-gcc gcc
ln -sf ../../bin/i386-cygwin32-as as
ln -sf ../../bin/i386-cygwin32-dlltool dlltool
ln -sf ../../bin/i386-cygwin32-ld ld
ln -sf ../../bin/i386-cygwin32-nm nm
ln -sf ../../bin/i386-cygwin32-objcopy strip
# for when you have to reset path in the Makefile to use all cross tools
ln -sf ../../bin/i386-cygwin32-g++ g++
ln -sf ../../bin/i386-cygwin32-g++ c++
ln -sf ../../bin/i386-cygwin32-c++filt c++filt
ln -sf ../../bin/i386-cygwin32-gasp gasp
ln -sf ../../bin/i386-cygwin32-objcopy objcopy
ln -sf ../../bin/i386-cygwin32-objdump objdump
ln -sf ../../bin/i386-cygwin32-size size
ln -sf ../../bin/i386-cygwin32-strings strings
rm -fr ../include ../lib
cd ..
ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/include include
ln -s $CROSS_PREFIX/H-i386-cygwin32/i386-cygwin32/lib lib
cd ../lib/gcc-lib/i386-cygwin32/$CYG_VER/
strip c* ld
rm -fr include
ln -s $CROSS_PREFIX/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/$CYG_VER/include include

cd $TMP/tmp
makepkg cx32.tgz;mv cx32.tgz .. # or put your binary package maker here
cd $TMP

if [ x"$1" = x--cleanup ];then
	rm -fr $TMP/tmp $TMP/cx32o;
        pushd $SRC_DIR
	mv -f znobuild/* .
	rmdir znobuild
	popd
fi


[-- Attachment #6: SB.libs --]
[-- Type: text/x-shellscript, Size: 3107 bytes --]

#!/bin/sh
#this is a bash shell script to make a the cygwin32 libraries from linux
#it is designed to hopefully :^) minimize disk space usage, by installing
#the new libraries to your vfat drive where the native cygwin32 compiler lives
set -a #export all variables

#echo change the following variables to fit your setup

CROSS_PREFIX=dos/c/usr/H-i386-cygwin32 # !! NO slash here
SRC_DIR=/dos/c/usr/src/cygwin32

if [ ! -f $SRC_DIR/CYGNUS ];then
 echo "please show me the source Luke :^)"
 exit 1;
fi

if [ ! -d /$CROSS_PREFIX ];then
 echo "please show me the destination Luke :^)"
fi

if [ x"$TMP" = x ];then
  [ -d /tmp ] || mkdir /tmp
  TMP=/tmp;
fi

cd $TMP
mkdir -p lx32o tmp/$CROSS_PREFIX/ tmp/usr/include

pushd tmp/usr/include
ln -sf /$CROSS_PREFIX/../include/g++ g++win32
popd

cd lx32o

#make sure only the necesary dirs get built
[ -d $SRC_DIR/znobuild ] || mkdir -p $SRC_DIR/znobuild
if [ -d $SRC_DIR/byacc ];then
  pushd $SRC_DIR
  mv -f bash binutils byacc diff fileutils\
    findutils gdb gas gawk gcc gdb grep gzip ld less \
    libgloss m4 make ncurses patch sed \
    shellutils tar texinfo textutils time utils xiberty \
    dejagnu dosrel expect grez release send-pr sim tcl tk \
    znobuild/
  popd
fi

export PATH=/usr/i386-cygwin32/bin:$PATH

[ -f config.status ] || CC="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023"\
 CXX="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023"\
 $SRC_DIR/configure --prefix=/usr\
 --srcdir=$SRC_DIR --host=i586-unknown-linux --target=i386-cygwin32 -v

make CFLAGS="-O -g" LDFLAGS=

make prefix=$TMP/tmp/$CROSS_PREFIX install

cd $TMP/tmp/$CROSS_PREFIX/i386-cygwin32/lib
mv cygwin.dll ../../bin
mv libstdc++.a libg++.a libiberty.a libc.a libg.a libm.a ../../lib
i386-cygwin32-strip --strip-debug *.a #since these are mostly just dll stubs

cd ../../lib
mv libi386-cygwin32-bfd.a libbfd.a
mv libi386-cygwin32-opcodes.a libopcodes.a
mv *.a ../i386-cygwin32/lib/

cd ../bin
for file in cygwin ps mount umount kill;do
  mv i386-cygwin32-$file $file.exe;
done
mv flex flex.exe
rm flex++
cp flex.exe flex++.exe
strip *.exe
mv ../include ../man ../etc ../..

cd ../../include

mv *.h readline ../H-i386-cygwin32/i386-cygwin32/include/
mv g++/String.h g++/_String.h
mv g++/Complex.h g++/_Complex.h

if [ "1" = "0" ];then #ncurses really dosen't like being built cross

cd $TMP/lx32o
[ -d ncurses ] || mkdir ncurses
cd ncurses
[ -f config.status ] || CC="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023 -I/usr/i386-cygwin32/include "\
 CXX="gcc -b i386-cygwin32 -V cygnus-2.7.2-961023 -I/usr/i386-cygwin32/include -I/dos/c/usr/include/g++"\
 PATH=/usr/i386-cygwin32/bin:$PATH $SRC_DIR/ncurses/configure --prefix=/usr\
 --target=i386-cygwin32 --enable-getcap --enable-termcap \
 --program-suffix=.exe --enable-symlinks -v
make includedir=/usr/i386-cygwin32/include

make LDFLAGS= prefix=$TMP/tmp/$CROSS_PREFIX/.. install

fi

cd $TMP/tmp
makepkg lx32.tgz;mv lx32.tgz .. # or put your binary package maker here
cd $TMP

if [ x"$1" = x--cleanup ];then
	rm -fr $TMP/tmp $TMP/lx32o;
        pushd $SRC_DIR
        mv -f znobuild/* .
        rmdir znobuild
        popd
fi






^ permalink raw reply	[flat|nested] 2+ messages in thread

* crosscompiling GNU, how?
@ 1997-04-08  2:50 Janusz J. Mlodzianowski
  0 siblings, 0 replies; 2+ messages in thread
From: Janusz J. Mlodzianowski @ 1997-04-08  2:50 UTC (permalink / raw)
  To: gnu-win32

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?
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?)
Is it possible that I use the existing GNU compiler to produce the assembler
output and then run it through crossassembler and crosslinker? This would
greatly speed up the whole procedure.
janusz


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-04-08 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-08 18:15 crosscompiling GNU, how? Mikey
  -- strict thread matches above, loose matches on Subject: below --
1997-04-08  2:50 Janusz J. Mlodzianowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).