pkgsrc/emulators/doscmd/patches/patch-ab
christos 45bf2691a2 Use objcopy to make the binary file and load it directly,
instead of using loadfile which is less portable. [suggested by Tron]
1999-12-18 22:10:02 +00:00

59 lines
1.9 KiB
Text

$NetBSD: patch-ab,v 1.6 1999/12/18 22:10:02 christos Exp $
--- Makefile.orig Thu May 2 13:55:19 1996
+++ Makefile Sat Dec 18 17:02:32 1999
@@ -8,30 +8,45 @@
int1a.c int2f.c intff.c \
mem.c mouse.c net.c null.c port.c setver.c signal.c timer.c trace.c trap.c tty.c xms.c
+BINDIR= ${PREFIX}/bin
+MANDIR= ${PREFIX}/man
+
BINGRP= kmem
EXEGRP= bin
BINMODE=2555
EXEMODE=444
-CFLAGS+=-I/usr/X11/include -DDISASSEMBLER -g
-LDFLAGS+=-L/usr/X11/lib
+START_ADDRESS=0x110000
+CFLAGS+=-I${X11BASE}/include -DDISASSEMBLER -g -DSTART_ADDRESS=${START_ADDRESS}
+LDFLAGS+=-L${X11BASE}/lib -R${X11BASE}/lib
LDADD+= -lX11 -li386 -lgcc -lc -lgcc
-DPADD+= /usr/X11/lib/libX11.a ${LIBC} ${LIBGCC}
+DPADD+= ${X11BASE}/lib/libX11.a ${LIBC} ${LIBGCC}
+
+.include <bsd.prog.mk>
+.if ${OBJECT_FMT} == "ELF"
+TEXT=-e start -Ttext ${START_ADDRESS}
+CRTBEGIN=/usr/lib/crtbegin.o
+.else
+TEXT=-e _start -T ${START_ADDRESS}
+CRTBEGIN=
+.endif
+
afterinstall:
install ${COPY} -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
- doscmd.kernel ${DESTDIR}/usr/libexec/doscmd.kernel
+ doscmd.kernel ${PREFIX}/libexec/doscmd.kernel
install -c -o ${BINOWN} -g ${EXEGRP} -m ${EXEMODE} \
- ${.CURDIR}/instbsdi.exe ${DESTDIR}/usr/dos/
+ ${.CURDIR}/instbsdi.exe ${PREFIX}/libexec/
-doscmd: doscmd.kernel ${LIBCRT0} doscmd_loader.o
- ld -N -Bstatic -o doscmd ${LDFLAGS} ${LIBCRT0} doscmd_loader.o ${LDADD}
+doscmd: doscmd.kernel ${LIBCRT0} ${CRTBEGIN} doscmd_loader.o
+ ld -N -Bstatic -o doscmd ${LDFLAGS:S/^-Wl,//g} ${LIBCRT0} ${CRTBEGIN} doscmd_loader.o ${LDADD}
-.include <bsd.prog.mk>
.depend: doscmd_loader.c
doscmd.kernel: crt0.o ${OBJS}
- ld -N -Bstatic -T 110000 -o doscmd.kernel ${LDFLAGS} crt0.o ${OBJS} ${LDADD}
+ ld -N -Bstatic ${TEXT} -o doscmd.bin ${LDFLAGS:S/^-Wl,//g} crt0.o ${OBJS} ${LDADD}
+ objcopy -O binary doscmd.bin $@
+ @rm -f doscmd.bin
doscmd.0: doscmd.1
tbl ${.IMPSRC} | nroff -mandoc > ${.TARGET}