Mail Archives: djgpp-workers/2000/08/03/07:15:42
I tried to compile djgpp docs from the CVS sources on a Unix machine,
and found it to be very difficult without a cross compiler, because
the makefiles are not designed so that docs could be built without
compiling the libraries and executables at the same time. Would it
be a good idea to make the build process more flexible?
Actually, I was able to build the docs by providing dummy shell
scripts for cross-gcc, cross-ar, and cross-ld that just touch their
specified output file. I could have done the same for native dxegen
and stubify, but it wasn't really necessary for dxegen (make process
in src/libemu will fail, but it wouldn't build any docs anyway), and
stubify works well enough after applying the following patch (which
just prevents stubify from reading past the end of its input file).
Index: src/stub/stubify.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/stub/stubify.c,v
retrieving revision 1.4
diff -c -r1.4 stubify.c
*** stubify.c 1999/12/14 12:01:36 1.4
--- stubify.c 2000/08/03 10:59:49
***************
*** 49,55 ****
char *ofname, *ofext;
char buf[4096];
int rbytes, used_temp = 0, i, n;
! long coffset=0;
unsigned char filehdr_buf[20];
int max_file_size = 0;
int coff_file_size = 0;
--- 49,56 ----
char *ofname, *ofext;
char buf[4096];
int rbytes, used_temp = 0, i, n;
! long coffset = 0;
! long file_size;
unsigned char filehdr_buf[20];
int max_file_size = 0;
int coff_file_size = 0;
***************
*** 85,92 ****
--- 86,99 ----
perror(fname);
return;
}
+ file_size = lseek(ifile, 0, SEEK_END);
while (1)
{
+ if (coffset == file_size)
+ {
+ fprintf(stderr, "Warning: input file is empty or stub without COFF\n");
+ break;
+ }
lseek(ifile, coffset, 0);
read(ifile, buf, 6);
if (buf[0] == 'M' && buf[1] == 'Z') /* stubbed already, skip stub */
***************
*** 108,137 ****
}
}
! coff_file_size = lseek(ifile, 0, SEEK_END) - coffset;
! lseek(ifile, coffset, 0);
! read(ifile, filehdr_buf, 20); /* get the COFF header */
! lseek(ifile, get16(filehdr_buf+16), SEEK_CUR); /* skip optional header */
! n = get16(filehdr_buf + 2);
! for (i=0; i<n; i++) /* for each COFF section */
{
! int addr, size, flags;
! unsigned char coffsec_buf[40];
! read(ifile, coffsec_buf, 40);
! size = get32(coffsec_buf+16);
! addr = get32(coffsec_buf+20);
! flags = get32(coffsec_buf+36);
! if (flags & 0x60) /* text or data */
! {
! int maybe_file_size = size + addr;
! if (max_file_size < maybe_file_size)
! max_file_size = maybe_file_size;
}
}
- if (coff_file_size == max_file_size + 4)
- /* it was built with "gcc -s" and has four too many bytes */
- drop_last_four_bytes = 1;
lseek(ifile, coffset, 0);
--- 115,147 ----
}
}
! coff_file_size = file_size - coffset;
! if (coff_file_size)
{
! lseek(ifile, coffset, 0);
! read(ifile, filehdr_buf, 20); /* get the COFF header */
! lseek(ifile, get16(filehdr_buf+16), SEEK_CUR); /* skip optional header */
! n = get16(filehdr_buf + 2);
! for (i=0; i<n; i++) /* for each COFF section */
! {
! int addr, size, flags;
! unsigned char coffsec_buf[40];
! read(ifile, coffsec_buf, 40);
! size = get32(coffsec_buf+16);
! addr = get32(coffsec_buf+20);
! flags = get32(coffsec_buf+36);
! if (flags & 0x60) /* text or data */
! {
! int maybe_file_size = size + addr;
! if (max_file_size < maybe_file_size)
! max_file_size = maybe_file_size;
! }
}
+ if (coff_file_size == max_file_size + 4)
+ /* it was built with "gcc -s" and has four too many bytes */
+ drop_last_four_bytes = 1;
}
lseek(ifile, coffset, 0);
--
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/
- Raw text -