delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/08/09:38:23

Date: Thu, 8 Jun 2000 14:35:59 +0100
From: Neil Townsend <neil AT robots DOT ox DOT ac DOT uk>
To: djgpp-workers AT delorie DOT com
Subject: cross compiling directory rewrite
Message-ID: <20000608143559.A3069@arragon.robots.ox.ac.uk>
Mime-Version: 1.0
User-Agent: Mutt/1.2i
Reply-To: djgpp-workers AT delorie DOT com

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I'm told this is the place to submit stuff. I'm not on this mailing list,
mainly because what I know about compilers could be written on a postage
stamp. However, following some adivce from Eli I have managed to get a
solaris to djgpp cross compiler. Along the way I encounter a few hitches and
I've rewritten the cross directory to (I hope!) work with newer versions of
gcc and binutils. It now has the following files:

cross/install              D
cross/makefile             D
cross/readme               D
cross/stdlib.h             A
cross/linux-x-djgpp.diff   *
cross/build-stub           d
cross/build-stub/makefile  A

d - directory
D - diffs from previous version attached
* - no idea if this is any use at all, but I applied it. The instuctions in
    install make no mention of it as I'm not actually convinced that it is
    needed.
A - new file, attached in full.

The whole directory is available for download from

http://www.robots.ox.ac.uk/~neil/allegro/newcross.zip

I hope that this makes sense and is ok.

Neil

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="stdlib.h"

/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_stdlib_h_
#define __dj_include_stdlib_h_

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __dj_ENFORCE_ANSI_FREESTANDING

#include <sys/djtypes.h>
  
/* Some programs think they know better... */
#undef NULL

#define EXIT_FAILURE	1
#define EXIT_SUCCESS	0
#define MB_CUR_MAX	__dj_mb_cur_max
#define NULL		0
#define RAND_MAX	2147483647

extern int __dj_mb_cur_max;

typedef struct {
  int quot;
  int rem;
} div_t;

typedef struct {
  long quot;
  long rem;
} ldiv_t;

__DJ_size_t
#define _SIZE_T
#undef __DJ_size_t
#define __DJ_size_t
__DJ_wchar_t
#define _WCHAR_T
#undef __DJ_wchar_t
#define __DJ_wchar_t

void	abort(void) __attribute__((noreturn));
int	abs(int _i);
int	atexit(void (*_func)(void));
double	atof(const char *_s);
int	atoi(const char *_s);
long	atol(const char *_s);
void *	bsearch(const void *_key, const void *_base, size_t _nelem,
		size_t _size, int (*_cmp)(const void *_ck, const void *_ce));
void *	calloc(size_t _nelem, size_t _size);
div_t	div(int _numer, int _denom);
void	exit(int _status) __attribute__((noreturn));
void	free(void *_ptr);
char *	getenv(const char *_name);
long	labs(long _i);
ldiv_t	ldiv(long _numer, long _denom);
void *	malloc(size_t _size);
int	mblen(const char *_s, size_t _n);
size_t	mbstowcs(wchar_t *_wcs, const char *_s, size_t _n);
int	mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
void	qsort(void *_base, size_t _nelem, size_t _size,
	      int (*_cmp)(const void *_e1, const void *_e2));
int	rand(void);
void *	realloc(void *_ptr, size_t _size);
void	srand(unsigned _seed);
double	strtod(const char *_s, char **_endptr);
long	strtol(const char *_s, char **_endptr, int _base);
unsigned long	strtoul(const char *_s, char **_endptr, int _base);
int	system(const char *_s);
size_t	wcstombs(char *_s, const wchar_t *_wcs, size_t _n);
int	wctomb(char *_s, wchar_t _wchar);

#ifndef __STRICT_ANSI__

#ifndef _POSIX_SOURCE

typedef struct {
  long long quot;
  long long rem;
} lldiv_t;

void *		alloca(size_t _size);
long double	_atold(const char *_s);
long long	atoll(const char *_s);
void		cfree(void *_ptr);
double          drand48(void);
char *		ecvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf);
char *		ecvt(double _val, int _nd, int *_dp, int *_sn);
double          erand48(unsigned short state[3]);
char *		fcvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf);
char *		fcvt(double _val, int _nd, int *_dp, int *_sn);
char *		gcvt(double _val, int _nd, char *_buf);
char *		getpass(const char *_prompt);
int		getlongpass(const char *_prompt, char *_buffer, int _max_len);
char *		itoa(int value, char *buffer, int radix);
long            jrand48(unsigned short state[3]);
long long	llabs(long long _i);
lldiv_t		lldiv(long long _numer, long long _denom);
void            lcong48(unsigned short param[7]);
unsigned long   lrand48(void);
long            mrand48(void);
unsigned long   nrand48(unsigned short state[3]);
int		putenv(const char *_val);
unsigned short *seed48(unsigned short state_seed[3]);
int		setenv(const char *_var, const char *_val, int _replace);
void            srand48(long seedval);
int		stackavail(void);
long double	_strtold(const char *_s, char **_endptr);
long long	strtoll(const char *_s, char **_endptr, int _base);
unsigned long long strtoull(const char *_s, char **_endptr, int _base);
void		swab(const void *from, void *to, int nbytes);

#ifndef alloca
#define alloca __builtin_alloca
#endif

/* BSD Random Number Generator */
char  *	initstate (unsigned _seed, char *_arg_state, int _n);
char  *	setstate(char *_arg_state);
long	random(void);
int	srandom(int _seed);

/* These vary in expected prototype, so we just don't prototype them.
void		xfree(void *_ptr);
void *		xmalloc(size_t _size);
void *		xrealloc(void *ptr, size_t _size);
*/

#define __system_redirect	      0x0001 /* redirect internally */
#define __system_call_cmdproc	      0x0002 /* always call COMMAND/$SHELL */
#define __system_use_shell	      0x0004 /* use $SHELL if set */
#define __system_allow_multiple_cmds  0x0008 /* allow `cmd1; cmd2; ...' */
#define __system_allow_long_cmds      0x0010 /* handle commands > 126 chars  */
#define __system_emulate_command      0x0020 /* try to emulate the shell */
#define __system_handle_null_commands 0x1000 /* ignore cmds with no effect */
#define __system_ignore_chdir	      0x2000 /* make `cd' be a null command */
#define __system_emulate_chdir	      0x4000 /* handle `cd' internally */

extern int __system_flags;

#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */

#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */

#ifdef __cplusplus
}
#endif

#endif /* !__dj_include_stdlib_h_ */

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=makefile

# Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details
#
# Makefile for building and installing the cross compiler versions
# of stubedit and stubify.
#
# This is a sub-makefile which is driven my the makefile in the
# above directory. You should not need to edit this makefile.
#
# This is the list of what to make:
#

executable_list=stubify stubedit

#
# Make that a list of things in the right place:
#

executable_in_dest_list=${executable_list:%=$(BINDIR)/%}

#
# And the rules ...
#

all_and_install : $(executable_in_dest_list)

$(BINDIR)/% : $(SRCDIR)/%.c
	$(CC) $(CFLAGS) $< -o $@

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="makefile.diff"

3,9c3
< # Step 1: Choose the compile flags to use.
< #
< CFLAGS=-O3 -m486 -fno-strength-reduce
< # CFLAGS= -O2
< 
< #
< # Step 2: Choose where the binaries will be install
---
> # Step 1: Choose where the binaries will be install
13,15c7,8
< # The support files will go in ${PREFIX}/lib/gcc-lib/i386-msdos-go32.
< # The binaries will go in ${PREFIX}/bin/dos-${program} e.g.
< #    ${PREFIX}/bin/dos-gcc, ${PREFIX}/bin/dos-stubedit, etc.
---
> # All the binaries you want will be linked to ${PREFIX}/bin/dos-${program}
> # e.g. ${PREFIX}/bin/dos-gcc, ${PREFIX}/bin/dos-stubedit, etc.
17c10,18
< PREFIX=/usr/home/cgjks1/test
---
> # The various files will go in the following directories:
> #  - ${PREFIX}/lib/${binutils-lib-file}
> #  - ${PREFIX}/lib/gcc-lib/i386-pc-msdosdjgpp/${gcc-lib-file}
> #  - ${PREFIX}/bin/i386-pc-msdosdjgpp-${program}
> #  - ${PREFIX}/i386-pc-msdosdjgpp/bin/${program}
> #  - ${PREFIX}/i386-pc-msdosdjgpp/sys-include/${include_files}
> #  - ${PREFIX}/i386-pc-msdosdjgpp/lib/${lib_file}
> #
> PREFIX=/users/neil/bli/sun4-sunos
21c22,23
< # Step 3: Tell me where to find the source code for gcc and binutils.
---
> # Step 2: Tell me where to find the source code for gcc and binutils,
> # with respect to the directory this file is in.
23c25
< # This package has been tested with GCC 2.7.2 and BINTUILS 2.7.
---
> # This package has been tested with GCC 2.95.2 and BINTUILS 2.9.1
26,27c28,30
< # If you untar both gcc-2.7.2.tar.gz and binutils-2.7.tar.gz in the
< # current directory then use the following paths.
---
> # If you untar both gcc-2.95.2.tar.gz and binutils-2.9.1.tar.gz in the
> # current directory then use the following paths. Otherwise, use paths
> # relative to this point or absolute paths.
29,30c32,33
< GCCDIR=		./gcc-2.7.2
< BINUTILSDIR=	./binutils-2.7
---
> GCCDIR=		gcc-2.95.2
> BINUTILSDIR=	binutils-2.9.1
38c41
< GCCVER=		2.7.2
---
> GCCVER=		2.8.1
42c45
< # Step 4: Extra configure arguments for gcc and binutils.
---
> # Step 3: Extra configure arguments for gcc and binutils.
45c48
< # binutils.
---
> # binutils as well as the languages you wish to build compilers for.
53,54c56,58
< EXTRA= --host=i486-elf-linux
< #EXTRA=
---
> #EXTRA= --host=i486-elf-linux
> EXTRA=
> LANGUAGES=c
58c62
< # Step 5: Choose a compiler
---
> # Step 4: Choose a compiler
61,62c65,66
< # The compiler defined here will be used to compile two programs in
< # the DJGPP package.
---
> # The compiler and options defined here will be used to compile two
> # programs in the DJGPP package.
64a69
> CFLAGS=-O2 -fno-strength-reduce
70a76,77
> TARGET=i386-pc-msdosdjgpp
> 
72,74c79,80
< LIBDIR=${PREFIX}/lib/gcc-lib/i386-go32-msdos/${GCCVER}
< BINDIR=${LIBDIR}/bin
< OFFICIALBIN=${PREFIX}/bin
---
> OFFICIALBINDIR=${PREFIX}/bin
> REALBINDIR=${PREFIX}/${TARGET}/bin
75a82,84
> BINUTILSBUILDDIR= build-binutils
> GCCBUILDDIR=      build-gcc
> STUBBUILDDIR=     build-stub
77,78c86,98
< all		: binutils gcc stub
< 		echo Done > /dev/null
---
> BINUTILSDIR_FROM_BUILDDIR= ../$(BINUTILSDIR)
> GCCDIR_FROM_BUILDDIR=      ../$(GCCDIR)
> STUBSRCDIR_FROM_BUILDDIR=  ../../src/stub
> 
> #
> # Where the djgpp libraries and headers files are in the distribution
> # that this makefile is part of.
> #
> DJGPP_LIBS_IN_DIST=    ../../lib
> DJGPP_HEADERS_IN_DIST= ../../include
> 
> all		: binutils stub gcc links
> 		@echo Cross compiler built and installed
81,105c101,129
< 		( cd ${BINUTILSDIR} ; \
< 		  ./configure --prefix=${PREFIX} ${EXTRA} \
< 			--target=i386-coff-go32 ; \
< 		  make CFLAGS="${CFLAGS}" )
< 
< 
< gcc		:
< 		( cd ${GCCDIR} ; \
< 		  ./configure --prefix=${PREFIX} ${EXTRA} \
< 			--target=i386-go32-msdos ; \
< 		  make CFLAGS="${CFLAGS}" LANGUAGES=c | 2>&1 tee make.out \
< 			|| true )
< 		tail -2 ${GCCDIR}/make.out | grep "way to make libgcc1.a"
< 		echo That error was expected.  Make of gcc succeeded. \
< 			> /dev/null
< 
< stub		:
< 		${CC} ${CFLAGS} src/stub/stubify.c -o stubify
< 		${CC} ${CFLAGS} src/stub/stubedit.c -o stubedit
< 
< install		: install.pre install.binu install.gcc install.djgpp
< 		if [ ! -d ${OFFICIALBIN} ]; then \
< 		  ${GCCDIR}/install.sh -d ${OFFICIALBIN} -m 755 ; \
< 		fi
< 		for a in ${BINDIR}/* ; do  \
---
> 		@if [ ! -d ${BINUTILSBUILDDIR} ]; then \
> 		  mkdir ${BINUTILSBUILDDIR}; fi
> 		@( cd ${BINUTILSBUILDDIR} ; \
> 		   $(BINUTILSDIR_FROM_BUILDDIR)/configure \
> 		        --prefix=${PREFIX} ${EXTRA} \
> 			--target=${TARGET} -v ; \
> 		   make all install )
> 
> stub            :
> 		@( cd ${STUBBUILDDIR} ;\
> 		   make CC="$(CC)" CFLAGS="$(CFLAGS)" \
> 			BINDIR="$(REALBINDIR)" \
> 			SRCDIR="$(STUBSRCDIR_FROM_BUILDDIR)" \
> 			all_and_install )
> 
> ../include/stdlib.orig :
> 		@if [ ! -f ../include/stdlib.orig ]; then \
> 		   mv ../include/stdlib.h ../include/stdlib.orig ; \
> 		   cp stdlib.h ../include ; fi
> 
> gcc		: ../include/stdlib.orig ${GCCBUILDDIR}/Makefile
> 		@( cd ${GCCBUILDDIR} ; \
> 		   make all install )	
> 		mv -f ${PREFIX}/lib/gcc-lib/${TARGET}/include \
> 			${PREFIX}/lib/gcc-lib/${TARGET}/gcc-broken-include
> 		mv -f ../include/stdlib.orig ../include/stdlib.h
> 
> links		:
> 		for a in ${REALBINDIR}/* ; do \
107,110c131,132
< 		  rm -f ${LIBDIR}/$$b ; \
< 		  ln -s $$a ${LIBDIR}/$$b ; \
< 		  rm -f ${OFFICIALBIN}/dos-$$b ; \
< 		  ln -s $$a ${OFFICIALBIN}/dos-$$b ; \
---
> 		  rm -f ${OFFICIALBINDIR}/dos-$$b ; \
> 		  ln -s ${REALBINDIR}/$$b ${OFFICIALBINDIR}/dos-$$b ; \
113,150c135,150
< install.pre	:
< 		${GCCDIR}/install.sh -d ${BINDIR} -m 755
< 		${GCCDIR}/install.sh -d ${LIBDIR} -m 755
< 
< install.binu	:
< 		( cd ${BINUTILSDIR}/binutils ; \
< 		  ../install.sh -s -m 755 c++filt ${BINDIR} ; \
< 		  ../install.sh -s -m 755 objcopy ${BINDIR} ; \
< 		  ../install.sh -s -m 755 objdump ${BINDIR} ; \
< 		  ../install.sh -s -m 755 ar ${BINDIR} ; \
< 		  ../install.sh -s -m 755 size ${BINDIR} ; \
< 		  ../install.sh -s -m 755 nm.new ${BINDIR}/nm ; \
< 		  ../install.sh -s -m 755 strip.new ${BINDIR}/strip )
< 		( cd ${BINUTILSDIR}/gas ; \
< 		  ../install.sh -s -m 755 as.new ${BINDIR}/as  ; \
< 		  ../install.sh -s -m 755 gasp.new ${BINDIR}/gasp )
< 		( cd ${BINUTILSDIR}/ld ; \
< 		  ../install.sh -s -m 755 ld.new ${BINDIR}/ld )
< 
< install.gcc	:
< 		( cd ${GCCDIR} ; \
< 		  ./install.sh -s -m 755 xgcc ${BINDIR}/gcc ; \
< 		  ./install.sh -s -m 755 cc1 ${LIBDIR}/cc1 ; \
< 		  ./install.sh -s -m 755 cccp ${LIBDIR}/cpp )
< 
< install.djgpp	:
< 		cp ${GCCDIR}/install.sh .
< 		chmod 755 install.sh
< 		( cd lib ; \
< 		  for a in * ; do \
< 		    ../install.sh -m 755 $$a ${LIBDIR} ; \
< 		  done )
< 		find include -type d -print | xargs chmod 755
< 		find include -type f -print | xargs chmod 644
< 		chmod 755 include
< 		yes | cp -Rp include ${LIBDIR}
< 		./install.sh -m 755 -s stubedit ${BINDIR}
< 		./install.sh -m 755 -s stubify ${BINDIR}
---
> distclean	:
> 		for d in ${GCCBUILDDIR} ${BINUTILSBUILDDIR}; do \
> 		  if [ -d $$d ]; then rm -rf $$d; fi; \
> 		  done
> 
> ${GCCBUILDDIR}/Makefile : ${GCCBUILDDIR}/config.cache
> 		@( cd ${GCCBUILDDIR} ; \
> 		  $(GCCDIR_FROM_BUILDDIR)/configure \
> 		        --prefix=${PREFIX} ${EXTRA} \
> 			--target=${TARGET} \
> 			--enable-languages=${LANGUAGES} \
> 			--with-headers=${DJGPP_HEADERS_IN_DIST} \
> 			--with-libs=${DJGPP_LIBS_IN_DIST} -v )
> 
> ${GCCBUILDDIR}/config.cache :
> 		@if [ ! -d ${GCCBUILDDIR} ]; then mkdir ${GCCBUILDDIR}; fi

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="install.diff"

12,13c12,13
<         ftp://prep.ai.mit.edu/pub/gnu/gcc-2.7.2.tar.gz
<         ftp://prep.ai.mit.edu/pub/gnu/binutils-2.7.tar.gz
---
>         ftp://prep.ai.mit.edu/pub/gnu/gcc-2.95.2.tar.gz
>         ftp://prep.ai.mit.edu/pub/gnu/binutils-2.9.1.tar.gz
18,19c18,19
<         gzip -c gcc-2.7.2.tar.gz | tar -xf -
<         gzip -c binutils-2.7.tar.gz | tar -xf -
---
>         gzip -c gcc-2.95.2.tar.gz | tar -xf -
>         gzip -c binutils-2.9.1.tar.gz | tar -xf -
24,30d23
<     
< 5.  Apply the patch "patch.lib" found in the current directory
< 
<         patch < patch.lib
<         
<             
< 6.  Build the cross compiler:
32d24
<         make all
34,35c26
<     
< 7.  Install the cross compiler:
---
> 5.  Build and install the cross compiler:
37c28
<         make install
---
>         make

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="readme.diff"

20c20,26
< 3. Using the cross compiler:
---
> 3. Installing the cross compiler:
> 
>    Instructions are given in the 'install' file in the same directory at
>    this file.
> 
> 
> 4. Using the cross compiler:
56c62
< 4. Reading the documentation:
---
> 5. Reading the documentation:
65c71
< 5. How do I get DJGPP: [from DJGPP Mini-FAQ]
---
> 6. How do I get DJGPP: [from DJGPP Mini-FAQ]
75c81
< 6. More information on DJGPP: [from DGJPP Mini-FAQ]
---
> 7. More information on DJGPP: [from DGJPP Mini-FAQ]

--CE+1k2dSO48ffgeK--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019