1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00

Fix build in -current.

PR:		ports/45710
Submitted by:	Statue <statue@freebsd.sinica.edu.tw>
Obtained from:	japanese/kon2-*
This commit is contained in:
Vanilla I. Shu 2002-11-27 15:38:38 +00:00
parent 25f5411408
commit 4e0f174ab0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=71160
17 changed files with 326 additions and 96 deletions

View File

@ -19,6 +19,7 @@ ONLY_FOR_ARCHS= i386
EXTRACT_ONLY= ${DISTNAME}.tgz
USE_REINPLACE= yes
REINPLACE_ARGS= # empty
# With the help from pa@freebsd.ee.ntu.edu.tw
# +0.92d use kc-fonts, whcih can be included in cdrom, instead of taipei-fonts.
@ -31,7 +32,10 @@ USE_REINPLACE= yes
.include <bsd.port.pre.mk>
post-patch:
.if ${OSVERSION} > 500012
@${REINPLACE_CMD} -e 's,machine/console.h>,sys/consio.h>\n#include\t<sys/kbio.h>\n,' ${WRKSRC}/include/* ${WRKSRC}/src/*
.for i in include/ksymdef.h src/term.c src/vc.c src/vga.c
@${REINPLACE_CMD} 's,machine/console.h>,sys/consio.h>@#include <sys/kbio.h>@,' ${WRKSRC}/${i} | tr '@' '\n' > ${WRKSRC}/${i}.bak && \
${MV} ${WRKSRC}/${i}.bak ${WRKSRC}/${i}
.endfor
.endif
pre-install:
@if [ ! -f ${PREFIX}/lib/fonts/kc16.smf ]; then \

View File

@ -1,37 +0,0 @@
--- src/vc.c.orig Mon Apr 15 09:46:27 1996
+++ src/vc.c Sat Jun 10 19:40:19 2000
@@ -92,28 +92,26 @@
inline void blatch(void *head, int n)
{
- __asm__("\t clc\n"
+ __asm__ volatile("\t clc\n"
"1:\n"
"\t andb %%bl, (%%eax)\n"
"\t incl %%eax\n"
"\t loop 1b\n"
- :
- : "eax" ((long)head), "bl" (0x7F), "c" (n)
- : "bl", "cx" );
+ : "=bl" (head), "=c" (n)
+ : "eax" ((long)head), "0" (0x7F), "1" (n));
}
static
inline void llatch(void *head, int n)
{
- __asm__("\t clc\n"
+ __asm__ volatile ("\t clc\n"
"1:\n"
"\t andl %%ebx, (%%eax)\n"
"\t addl $4, %%eax\n"
"\t loop 1b\n"
- :
- : "eax" ((long)head), "ebx" (0x7F7F7F7F), "c" (n>>2)
- : "ebx", "cx" );
+ : "=ebx" (head), "=c" (n)
+ : "eax" ((long)head), "0" (0x7F7F7F7F), "1" (n>>2));
}
static inline u_int TextAddress(u_int x, u_int y)

View File

@ -1,22 +0,0 @@
--- big5con.cfg.orig Sun Apr 2 18:43:27 2000
+++ big5con.cfg Sun Apr 2 18:43:42 2000
@@ -157,7 +157,7 @@
1200
# Mouse device file name
MouseDev:
- /dev/mouse
+ /dev/sysmouse
# Use hard scroll
HardScroll:
--- big5con.mk.orig Sun Apr 2 18:43:25 2000
+++ big5con.mk Sun Apr 2 18:43:35 2000
@@ -29,7 +29,7 @@
-DXCIN_DIR=\"$(XCIN_DIR)\" $(ALT_META) $(EXTRA_OPTS)
CC = gcc
#CFLAGS = -O2 -m486 $(OPTS)
-CFLAGS += -O2 $(OPTS)
+CFLAGS += $(OPTS)
LD = gcc $(CFLAGS)
RM = rm -f
INSTALL = install -c

View File

@ -1,11 +0,0 @@
--- src/child.c.orig Fri Jun 22 23:14:24 2001
+++ src/child.c Sat Jun 23 00:48:55 2001
@@ -106,7 +106,7 @@
#if defined(linux)
*(ttyname(fileno(errfp))+8));
#elif defined(__FreeBSD__)
- *(ttyname(fileno(errfp))+9));
+ ttyname(fileno(errfp)) ? *(ttyname(fileno(errfp))+9) : '?');
#endif
fflush(stdout);

View File

@ -0,0 +1,11 @@
--- big5con.cfg.orig Thu Oct 8 13:07:27 1998
+++ big5con.cfg Tue Nov 26 11:45:51 2002
@@ -157,7 +157,7 @@
1200
# Mouse device file name
MouseDev:
- /dev/mouse
+ /dev/sysmouse
# Use hard scroll
HardScroll:

View File

@ -0,0 +1,11 @@
--- big5con.mk.orig Thu Oct 8 13:09:50 1998
+++ big5con.mk Tue Nov 26 11:45:51 2002
@@ -29,7 +29,7 @@
-DXCIN_DIR=\"$(XCIN_DIR)\" $(ALT_META) $(EXTRA_OPTS)
CC = gcc
#CFLAGS = -O2 -m486 $(OPTS)
-CFLAGS += -O2 $(OPTS)
+CFLAGS += $(OPTS)
LD = gcc $(CFLAGS)
RM = rm -f
INSTALL = install -c

View File

@ -1,23 +1,5 @@
--- lib/font.c.orig Sun Apr 2 18:56:50 2000
+++ lib/font.c Sun Apr 2 18:57:54 2000
@@ -35,6 +35,7 @@
struct shmid_ds shmseg;
shmkey = ftok(CONFIG_NAME, fnum);
+ shmkey = 5000 + (fnum & 0x7F);
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0)
return;
shmctl(shmid, IPC_STAT, &shmseg);
@@ -50,6 +51,7 @@
int shmid;
shmkey = ftok(CONFIG_NAME, fnum);
+ shmkey = 5000 + (fnum & 0x7F);
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) return(0);
return((u_char*)shmat(shmid, 0, SHM_RDONLY));
}
--- fld/fld.c.orig Sun Apr 2 18:59:37 2000
+++ fld/fld.c Sun Apr 2 19:01:18 2000
--- fld/fld.c.orig Wed May 20 17:49:32 1998
+++ fld/fld.c Tue Nov 26 11:45:51 2002
@@ -55,7 +55,7 @@
int shmid;
struct shmid_ds shmseg;

View File

@ -0,0 +1,18 @@
--- lib/font.c.orig Sun Apr 14 16:40:36 1996
+++ lib/font.c Tue Nov 26 11:45:51 2002
@@ -35,6 +35,7 @@
struct shmid_ds shmseg;
shmkey = ftok(CONFIG_NAME, fnum);
+ shmkey = 5000 + (fnum & 0x7F);
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0)
return;
shmctl(shmid, IPC_STAT, &shmseg);
@@ -50,6 +51,7 @@
int shmid;
shmkey = ftok(CONFIG_NAME, fnum);
+ shmkey = 5000 + (fnum & 0x7F);
if ((shmid = shmget(shmkey, sizeof(struct fontInfo), 0444)) < 0) return(0);
return((u_char*)shmat(shmid, 0, SHM_RDONLY));
}

View File

@ -0,0 +1,42 @@
--- src/child.c.orig Mon Apr 15 09:47:23 1996
+++ src/child.c Tue Nov 26 11:29:49 2002
@@ -22,6 +22,7 @@
#include <unistd.h>
#ifdef __FreeBSD__
#include <errno.h>
+#include <sys/ioctl.h>
#endif
#include <getcap.h>
@@ -77,6 +78,9 @@
{
char *shell, *tail, *tcap;
char buff[80];
+#if defined(__FreeBSD__)
+ struct winsize win;
+#endif
setgid(getgid());
setuid(getuid());
@@ -87,7 +91,11 @@
sprintf(buff, "TERMCAP=:co#%d:li#%d:tc=console:",
dInfo.txmax + 1, dInfo.tymax + 1);
#elif defined(__FreeBSD__)
- sprintf(buff,"TERM=vt100");
+ win.ws_row = dInfo.tymax + 1;
+ win.ws_col = dInfo.txmax + 1;
+ win.ws_xpixel = win.ws_ypixel = 0;
+ ioctl(STDIN_FILENO, TIOCSWINSZ, &win);
+ sprintf(buff,"TERM=vt100");
#endif
tcap = strdup(buff);
putenv(tcap);
@@ -106,7 +114,7 @@
#if defined(linux)
*(ttyname(fileno(errfp))+8));
#elif defined(__FreeBSD__)
- *(ttyname(fileno(errfp))+9));
+ ttyname(fileno(errfp)) ? *(ttyname(fileno(errfp))+9) : '?');
#endif
fflush(stdout);

View File

@ -0,0 +1,12 @@
--- src/mouse.c.orig Sun Apr 14 16:40:40 1996
+++ src/mouse.c Tue Nov 26 11:41:05 2002
@@ -167,7 +167,8 @@
mouseType = MOUSE_NONE;
mInfo.has_mouse = FALSE;
- sscanf(config, "%s", name);
+ strncpy(name, config, MAX_COLS - 1);
+ name[MAX_COLS - 1] = '\0';
for (p = mice; p->name != NULL; p++) {
if (strcasecmp(name, p->name) == 0) {
mouseType = p->type;

View File

@ -0,0 +1,11 @@
--- src/term.c.orig Mon Apr 15 09:46:48 1996
+++ src/term.c Tue Nov 26 11:45:26 2002
@@ -205,7 +205,7 @@
PollCursor(TRUE);
}
if (FD_ISSET(sockFd, &readFds)) SocketInterface(sockFd);
- if (mInfo.has_mouse) {
+ if (mInfo.has_mouse && mouseFd > 0) {
if (FD_ISSET(mouseFd, &readFds) && con.active) {
i = read(mouseFd, buff, BUFSIZ);
if (i > 0) MouseGetPacket(buff, i);

View File

@ -0,0 +1,175 @@
--- src/vc.c.orig Mon Apr 15 09:46:27 1996
+++ src/vc.c Tue Nov 26 12:02:07 2002
@@ -1,8 +1,10 @@
/*
KON - Kanji ON Linux Console -
Copyright (C) 1992, 1993
- MAEDA Atusi (mad@math.keio.ac.jp)
- Takashi MANABE (manabe@tut.ac.jp)
+ MAEDA Atusi (mad
+math.keio.ac.jp)
+ Takashi MANABE (manabe
+tut.ac.jp)
KON is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -19,7 +21,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
- modified for Big5Con by Hung-Chi Chu <hcchu@r350.ee.ntu.edu.tw>
+ modified for Big5Con by Hung-Chi Chu <hcchu
+r350.ee.ntu.edu.tw>
*/
#include <stdio.h>
@@ -35,7 +38,16 @@
#include <termio.h>
#elif defined(__FreeBSD__)
#include <termios.h>
-#include <machine/console.h>
+#include <osreldate.h>
+#if __FreeBSD_version >= 410000
+#include <sys/consio.h>
+#include <sys/kbio.h>
+#else
+#include <sys/consio.h>
+#include <sys/kbio.h>
+
+#endif
+
#endif
#include <sys/ioctl.h>
#ifdef linux
@@ -92,28 +104,26 @@
inline void blatch(void *head, int n)
{
- __asm__("\t clc\n"
+ __asm__ volatile("\t clc\n"
"1:\n"
"\t andb %%bl, (%%eax)\n"
"\t incl %%eax\n"
"\t loop 1b\n"
- :
- : "eax" ((long)head), "bl" (0x7F), "c" (n)
- : "bl", "cx" );
+ : "=bl" (head), "=c" (n)
+ : "eax" ((long)head), "0" (0x7F), "1" (n));
}
static
inline void llatch(void *head, int n)
{
- __asm__("\t clc\n"
+ __asm__ volatile ("\t clc\n"
"1:\n"
"\t andl %%ebx, (%%eax)\n"
"\t addl $4, %%eax\n"
"\t loop 1b\n"
- :
- : "eax" ((long)head), "ebx" (0x7F7F7F7F), "c" (n>>2)
- : "ebx", "cx" );
+ : "=ebx" (head), "=c" (n)
+ : "eax" ((long)head), "0" (0x7F7F7F7F), "1" (n>>2));
}
static inline u_int TextAddress(u_int x, u_int y)
@@ -254,13 +264,23 @@
struct vt_mode vtm;
ioctl(0,KDSKBMODE,K_XLATE);
+#if defined(__FreeBSD__)
+ signal(SIGUSR1, SIG_IGN);
+ signal(SIGUSR2, SIG_IGN);
+#else /* linux */
signal(SIGUSR1, SIG_DFL);
signal(SIGUSR2, SIG_DFL);
+#endif
vtm.mode = VT_AUTO;
vtm.waitv = 0;
+#if defined(__FreeBSD__)
+ vtm.relsig = SIGUSR1;
+ vtm.acqsig = SIGUSR2;
+ vtm.frsig = SIGUSR1;
+#else /* linux */
vtm.relsig = 0;
vtm.acqsig = 0;
- vtm.frsig = 0;
+#endif
ioctl(0, VT_SETMODE, &vtm);
#if defined(__FreeBSD__)
ioctl(0, VT_RELDISP, 1);
@@ -287,13 +307,15 @@
vtm.waitv = 0;
vtm.relsig = SIGUSR1;
vtm.acqsig = SIGUSR2;
- vtm.frsig = SIGUSR1; /* not implemented, just a hack */
+#if defined(__FreeBSD__)
+ vtm.frsig = SIGUSR1;
+#endif
ioctl(0, VT_SETMODE, &vtm);
vInfo.graph_mode();
if (useHardScroll)
vInfo.set_start_address();
- win.ws_row = dInfo.tymax; /* Note: con.ymax may be changed by application */
+ win.ws_row = dInfo.tymax + 1; /* Note: con.ymax may be changed by application */
win.ws_col = dInfo.txmax + 1;
win.ws_xpixel = win.ws_ypixel = 0;
ioctl(masterPty, TIOCSWINSZ, &win);
@@ -821,44 +843,30 @@
static int ConfigBeep(const char *confstr)
{
- beepCount = atoi(confstr) * 10000;
#if defined(linux)
+ beepCount = atoi(confstr) * 10000;
ioperm(COUNTER_ADDR, 1, TRUE);
#endif
+#if defined(__FreeBSD__)
+ beepCount = atoi(confstr) * 10;
+#endif
return SUCCESS;
}
-/*
- * Sound() added by woju.bbs@freebsd.ee.ntu.edu.tw
- */
-static void Sound(int freq, int ms)
-{
- PortOutb(182, 0x43);
- PortOutb((100000 / freq) & 0xff, 0x42);
- PortOutb((100000 / freq) >> 8, 0x42);
- PortOutb(PortInb(0x61) | 3, 0x61);
- usleep(ms * 1000);
- PortOutb(PortInb(0x61) &0xfc, 0x61);
-}
-
-static void Bell()
-{
- int i;
-
- for (i = 1; i <= 5; i++)
- Sound(i * 100, 10);
-}
+#define BELL_PITCH 800
void Beep(void)
{
- if (!con.active) return;
#ifdef linux
+ if (!con.active) return;
PortOutb(PortInb(COUNTER_ADDR)|3, COUNTER_ADDR);
usleep(beepCount);
PortOutb(PortInb(COUNTER_ADDR)&0xFC, COUNTER_ADDR);
#endif
#ifdef __FreeBSD__
- Bell();
+ if(beepCount <= 0) return;
+ ioctl(fileno(stdout), KDMKTONE, (BELL_PITCH & 0xffff) |
+ ((beepCount & 0xffff) << 16));
#endif
}

View File

@ -1,6 +1,40 @@
--- src/vga.c.orig Sun Apr 14 16:40:40 1996
+++ src/vga.c Sun Apr 2 19:03:41 2000
@@ -205,7 +205,8 @@
+++ src/vga.c Tue Nov 26 11:38:34 2002
@@ -1,6 +1,7 @@
/*
KON - Kanji ON Linux Console -
- Copyright (C) 1992, 1993, 1994 Takashi MANABE (manabe@tut.ac.jp)
+ Copyright (C) 1992, 1993, 1994 Takashi MANABE (manabe
+tut.ac.jp)
KON is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -20,7 +21,8 @@
/*
This code is based on vgalib.
- Thanks to frandsen@diku.dk (Tommy Frandsen).
+ Thanks to frandsen
+diku.dk (Tommy Frandsen).
*/
#include <stdio.h>
@@ -35,7 +37,14 @@
#elif defined(__FreeBSD__)
#include <vm/vm_param.h>
#include <sys/ioctl.h>
+#include <osreldate.h>
+#if __FreeBSD_version > 410000
+#include <sys/consio.h>
+#include <sys/kbio.h>
+#else
#include <machine/console.h>
+#endif
+
vm_size_t page_size;
#endif
#undef free
@@ -205,7 +214,8 @@
regText.seq[i] = PortInb(VGASEQ_DATA);
}
regText.mis = PortInb(VGAMISC_IN);
@ -10,7 +44,7 @@
VgaSetRegisters(&regGraph);
/* save font data in plane 2 */
@@ -369,7 +370,7 @@
@@ -369,7 +379,7 @@
/* if (!code) return;*/
VgaSetColor(fc);
if (bc & 0x8) *(vcls - dInfo.glineByte) = 0;
@ -19,7 +53,7 @@
if (*code) {
VgaOutByte(*code);
*gram = *gram;
@@ -437,7 +438,7 @@
@@ -437,7 +447,7 @@
void VgaCursor(struct cursorInfo *ci)
{
@ -28,7 +62,7 @@
u_char x;
int bottom = cursorBtm + 1 <= dInfo.glineChar ?
cursorBtm + 1 : dInfo.glineChar;
@@ -607,7 +608,11 @@
@@ -607,7 +617,11 @@
Perror("ioctl CONSOLE_IO_ENABLE");
return FAILURE;
}