From 01d0b9ae52cec99cd1822bb397a2bed2859e2ec0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 22 Dec 2010 13:45:38 +0100 Subject: [PATCH] dev86: update to 0.16.18 and make it build on x86_64 FINALLY! --- srcpkgs/dev86/patches/dev86-long.patch | 17 ++++++++++ srcpkgs/dev86/patches/dev86-noelks.patch | 26 +++++++++++++++ srcpkgs/dev86/patches/dev86-nostrip.patch | 11 +++++++ srcpkgs/dev86/patches/dev86-overflow.patch | 24 ++++++++++++++ srcpkgs/dev86/patches/dev86-pic.patch | 20 ------------ .../dev86/patches/dev86-print-overflow.patch | 27 ++++++++++++++++ srcpkgs/dev86/template | 32 +++++++++---------- 7 files changed, 120 insertions(+), 37 deletions(-) create mode 100644 srcpkgs/dev86/patches/dev86-long.patch create mode 100644 srcpkgs/dev86/patches/dev86-noelks.patch create mode 100644 srcpkgs/dev86/patches/dev86-nostrip.patch create mode 100644 srcpkgs/dev86/patches/dev86-overflow.patch delete mode 100644 srcpkgs/dev86/patches/dev86-pic.patch create mode 100644 srcpkgs/dev86/patches/dev86-print-overflow.patch diff --git a/srcpkgs/dev86/patches/dev86-long.patch b/srcpkgs/dev86/patches/dev86-long.patch new file mode 100644 index 00000000000..34cde195bc9 --- /dev/null +++ b/srcpkgs/dev86/patches/dev86-long.patch @@ -0,0 +1,17 @@ +diff -up dev86-0.16.17/ld/x86_aout.h.long dev86-0.16.17/ld/x86_aout.h +--- dev86-0.16.17/ld/x86_aout.h.long 2003-01-28 23:17:14.000000000 +0100 ++++ dev86-0.16.17/ld/x86_aout.h 2009-02-19 11:37:10.000000000 +0100 +@@ -11,10 +11,11 @@ + /* If the host isn't an x86 all bets are off, use chars. */ + #if defined(i386) || defined(__BCC__) || defined(MSDOS) + typedef long Long; +-#define __OUT_OK 1 + #else +-typedef char Long[4]; ++#include ++typedef int32_t Long; + #endif ++#define __OUT_OK 1 + + struct exec { /* a.out header */ + unsigned char a_magic[2]; /* magic number */ diff --git a/srcpkgs/dev86/patches/dev86-noelks.patch b/srcpkgs/dev86/patches/dev86-noelks.patch new file mode 100644 index 00000000000..ef4042f04e8 --- /dev/null +++ b/srcpkgs/dev86/patches/dev86-noelks.patch @@ -0,0 +1,26 @@ +--- orig/makefile.in 2010-12-22 12:56:31.610881756 +0100 ++++ new/makefile.in 2010-12-22 12:57:12.344232346 +0100 +@@ -89,10 +89,10 @@ EXE= + + #ifdef GNUMAKE + all: check_config bcc86 cpp unproto copt as86 ar86 ld86 objdump86 \ +- library lib-bsd alt-libs elksemu ++ library lib-bsd alt-libs + + install: check_config install-bcc install-man \ +- install-lib install-emu ++ install-lib + + install-all: install install-other + +@@ -123,10 +123,6 @@ INCLDIR= %INCLDIR% + ASLDDIR= %ASLDDIR% + MANDIR= %MANDIR% + +-#ifdef GNUMAKE +-export ELKSSRC +-#endif +- + DISTBIN= $(DIST)$(BINDIR) + DISTLIB= $(DIST)$(LIBDIR) + DISTASLD=$(DIST)$(ASLDDIR) diff --git a/srcpkgs/dev86/patches/dev86-nostrip.patch b/srcpkgs/dev86/patches/dev86-nostrip.patch new file mode 100644 index 00000000000..b26169abb2e --- /dev/null +++ b/srcpkgs/dev86/patches/dev86-nostrip.patch @@ -0,0 +1,11 @@ +--- dev86-0.16.17/makefile.in.nostrip 2007-01-30 14:28:38.000000000 +0100 ++++ dev86-0.16.17/makefile.in 2007-01-30 14:40:56.000000000 +0100 +@@ -78,7 +78,7 @@ + + # Install files with the userid of the currently running process. + INDAT=-m 644 +-INEXE=-m 755 -s ++INEXE=-m 755 + INSCR=-m 755 + + #ifdef __CYGWIN__ diff --git a/srcpkgs/dev86/patches/dev86-overflow.patch b/srcpkgs/dev86/patches/dev86-overflow.patch new file mode 100644 index 00000000000..7b2e5666f18 --- /dev/null +++ b/srcpkgs/dev86/patches/dev86-overflow.patch @@ -0,0 +1,24 @@ +diff -up dev86-0.16.17/bcc/bcc.c.overflow dev86-0.16.17/bcc/bcc.c +--- dev86-0.16.17/bcc/bcc.c.overflow 2005-01-03 23:41:55.000000000 +0100 ++++ dev86-0.16.17/bcc/bcc.c 2009-02-19 10:49:32.000000000 +0100 +@@ -16,6 +16,7 @@ + * -M0 A framework for the -B option. + */ + #include ++#include + #ifdef __STDC__ + #include + #ifndef MSDOS +@@ -1308,11 +1309,7 @@ void reset_prefix_path() + + for(d=s=ptr; d && *s; s=d) + { +-#ifdef MAXPATHLEN +- char buf[MAXPATHLEN]; +-#else +- char buf[1024]; +-#endif ++ char buf[PATH_MAX]; + + free(temp); + d=strchr(s, ':'); diff --git a/srcpkgs/dev86/patches/dev86-pic.patch b/srcpkgs/dev86/patches/dev86-pic.patch deleted file mode 100644 index 439c2648b7d..00000000000 --- a/srcpkgs/dev86/patches/dev86-pic.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- elksemu/elks.c.orig 2005-11-04 01:35:37.000000000 +0100 -+++ elksemu/elks.c 2005-11-04 01:45:28.000000000 +0100 -@@ -129,8 +129,17 @@ - static inline int vm86_mine(struct vm86_struct* v86) - { - int __res; -+#ifndef __PIC__ - __asm__ __volatile__("int $0x80\n" - :"=a" (__res):"a" ((int)OLD_SYS_vm86), "b" ((int)v86)); -+#else -+ __asm__ __volatile__( -+ "movl %%ebx,%%ecx\n\t" -+ "movl %2,%%ebx\n\t" -+ "int $0x80\n\t" -+ "movl %%ecx,%%ebx\n\t" -+ :"=a" (__res):"a" ((int)OLD_SYS_vm86), "r" ((int)v86) : "ecx"); -+#endif - return __res; - } - #endif diff --git a/srcpkgs/dev86/patches/dev86-print-overflow.patch b/srcpkgs/dev86/patches/dev86-print-overflow.patch new file mode 100644 index 00000000000..c75e18c9bbf --- /dev/null +++ b/srcpkgs/dev86/patches/dev86-print-overflow.patch @@ -0,0 +1,27 @@ +From: Lubomir Rintel + +There are off-by-one errors when filling the ar headers, the trailing nul +would overflow the target buffer. + +diff -urp dev86-0.16.17/ld/mkar.c dev86-0.16.17.fixed/ld/mkar.c +--- dev86-0.16.17/ld/mkar.c 2004-06-20 09:23:27.000000000 +0200 ++++ dev86-0.16.17.fixed/ld/mkar.c 2010-03-29 23:34:30.351426404 +0200 +@@ -51,12 +51,12 @@ char buf[128]; + memset(&arbuf, ' ', sizeof(arbuf)); + strcpy(buf, ptr); strcat(buf, "/ "); + strncpy(arbuf.ar_name, buf, sizeof(arbuf.ar_name)); +- +- sprintf(arbuf.ar_date, "%-12ld", (long)st.st_mtime); +- sprintf(arbuf.ar_uid, "%-6d", (int)(st.st_uid%1000000L)); +- sprintf(arbuf.ar_gid, "%-6d", (int)(st.st_gid%1000000L)); +- sprintf(arbuf.ar_mode, "%-8lo", (long)st.st_mode); +- sprintf(arbuf.ar_size, "%-10ld", (long)st.st_size); ++ ++ snprintf(arbuf.ar_date, 12, "%-12ld", (long)st.st_mtime); ++ snprintf(arbuf.ar_uid, 6, "%-6d", (int)(st.st_uid%1000000L)); ++ snprintf(arbuf.ar_gid, 6, "%-6d", (int)(st.st_gid%1000000L)); ++ snprintf(arbuf.ar_mode, 8, "%-8lo", (long)st.st_mode); ++ snprintf(arbuf.ar_size, 10, "%-10ld", (long)st.st_size); + memcpy(arbuf.ar_fmag, ARFMAG, sizeof(arbuf.ar_fmag)); + + if( fwrite(&arbuf, 1, sizeof(arbuf), fd) != sizeof(arbuf) ) diff --git a/srcpkgs/dev86/template b/srcpkgs/dev86/template index 8456c8ed5c0..58b0b2134ce 100644 --- a/srcpkgs/dev86/template +++ b/srcpkgs/dev86/template @@ -1,36 +1,34 @@ # Template file for 'dev86' pkgname=dev86 -version=0.16.17 +version=0.16.18 +patch_args="-Np1" distfiles="http://www.debath.co.uk/dev86/Dev86src-$version.tar.gz" -build_style=gnu_makefile -make_build_args="PREFIX=/usr DIST=$XBPS_DESTDIR/$pkgname-$version" -make_install_target="DIST=$XBPS_DESTDIR/$pkgname-$version install-all" +build_style=custom-install short_desc="8086 cross development compiler, assembler and linker" maintainer="Juan RP " -checksum=52ed4980c0e4b68d2624aadb0ceb0339cb3fd8dd7c2175419d4f77a451846cbe +checksum=049852a83898d3ee0ba97b88e526897ec6eaf0a051f4af1e9e073b1151178ff1 long_desc=" This package provides a cross development C compiler, assembler and linker environment for the production of 8086 executables (Optionally MSDOS COM)." nostrip=yes -disable_parallel_build=yes - Add_dependency run glibc -Add_dependency build bin86 +Add_dependency full bin86 -pre_build() +do_build() { - if [ "${xbps_machine}" = "x86_64" ]; then - sed -i -e 's,alt-libs elksemu,alt-libs,' \ - -e 's,install-lib install-emu,install-lib,' \ - ${wrksrc}/makefile.in - fi + for f in libc/bcc libc/misc libc/msdos libc/string libc/syscall \ + libc/bios; do + sed -i -e "s|\$(CCFLAGS) ||g" ${wrksrc}/${f}/Makefile + done + make DIST=${DESTDIR} } -post_install() +do_install() { - install -d ${DESTDIR}/usr/share - mv ${DESTDIR}/usr/man ${DESTDIR}/usr/share + make DIST=${DESTDIR} MANDIR=/usr/share/man \ + install install-man + # Remove stuff supplied by bin86 rm -f ${DESTDIR}/usr/bin/{as,ld,nm,objdump,size}86 rm -f ${DESTDIR}/usr/share/man/man1/{as,ld}86.1