Subject: Re: 915resolution works on amd64 with a simple change
To: Blair Sadewitz <blair.sadewitz@gmail.com>
From: OBATA Akio <obata@lins.jp>
List: pkgsrc-users
Date: 11/13/2006 11:51:39
This is a multi-part message in MIME format.

--Multipart=_Mon__13_Nov_2006_11_51_39_+0900_q=JeRog9nT5FYue6
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi!

On Sun, 12 Nov 2006 20:11:36 -0500
"Blair Sadewitz" <blair.sadewitz@gmail.com> wrote:

> Glad I took a look at this before switching to NetBSD/i386!
> 
> 1) In the makefile, tell ld to use -lx86_64 instead of -li386.
> 2) In 915resolution.c, change definition for iopl to use x86_64_iopl().
> 
> That's it!

Please try to apply attached patch.

--
"Of course I love NetBSD":-)
OBATA Akio / obata@lins.jp

--Multipart=_Mon__13_Nov_2006_11_51_39_+0900_q=JeRog9nT5FYue6
Content-Type: text/plain;
 name="patch.txt"
Content-Disposition: attachment;
 filename="patch.txt"
Content-Transfer-Encoding: 7bit

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/915resolution/Makefile,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- Makefile	11 Jun 2006 14:03:58 -0000	1.1.1.1
+++ Makefile	13 Nov 2006 02:45:23 -0000
@@ -9,10 +9,16 @@
 HOMEPAGE=	http://www.geocities.com/stomljen/
 COMMENT=	BIOS VESA resolution utility for 8XX/9XX Intel chips
 
-ONLY_FOR_PLATFORM=	NetBSD-*-i386
+ONLY_FOR_PLATFORM=	NetBSD-*-i386 NetBSD-*-x86_64 Linux-*-i386
 
 USE_TOOLS+=	gmake
 
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "NetBSD"
+MAKE_ENV+=	LDLIBS=-l${MACHINE_ARCH}
+.endif
+
 post-install:
 	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/915resolution
 	${INSTALL_DATA} ${WRKSRC}/README.txt ${PREFIX}/share/doc/915resolution
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/915resolution/distinfo,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 distinfo
--- distinfo	11 Jun 2006 14:03:58 -0000	1.1.1.1
+++ distinfo	13 Nov 2006 02:45:23 -0000
@@ -3,5 +3,5 @@
 SHA1 (915resolution-0.5.2.tar.gz) = 9f26eb1b728ca0b2d28c948207b034a49b477089
 RMD160 (915resolution-0.5.2.tar.gz) = 722b352a83f41f0e9822ed4e096e8064f239dcc1
 Size (915resolution-0.5.2.tar.gz) = 21183 bytes
-SHA1 (patch-aa) = 00223a909139f74713aeb66d20ec5079f5afbfc0
-SHA1 (patch-ab) = 9bd666c93dcaa54ae01e140ed00c3f08874d694b
+SHA1 (patch-aa) = 8556275046ccc2a9ebabe03b422b2b764bacbc9d
+SHA1 (patch-ab) = b65a38c9c7edd95f295619c9cdedc26449b3f177
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/915resolution/patches/patch-aa,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-aa
--- patches/patch-aa	11 Jun 2006 14:03:58 -0000	1.1.1.1
+++ patches/patch-aa	13 Nov 2006 02:45:23 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-aa,v 1.1.1.1 2006/06/11 14:03:58 markd Exp $
 
---- 915resolution.c.orig	2006-06-06 22:55:58.000000000 +1200
+--- 915resolution.c.orig	2006-02-02 23:28:34.000000000 +0900
 +++ 915resolution.c
-@@ -22,7 +22,18 @@
+@@ -22,7 +22,22 @@
  #include <string.h>
  #include <sys/mman.h>
  #include <fcntl.h>
@@ -14,14 +14,18 @@
 +#ifdef __NetBSD__
 +#include <machine/pio.h>
 +#include <machine/sysarch.h>
++# if defined(__i386__)
 +#define iopl(a) i386_iopl(a)
++# elif defined(__x86_64__)
++#define iopl(a) x86_64_iopl(a)
++# endif
 +#define OUTL(a, b)     outl(b, a)
 +#define OUTB(a, b)     outb(b, a)
 +#endif
  #include <unistd.h>
  #include <assert.h>
  
-@@ -169,7 +180,7 @@ void initialize_system(char * filename) 
+@@ -169,7 +184,7 @@ void initialize_system(char * filename) 
  }
  
  cardinal get_chipset_id(void) {
@@ -30,7 +34,7 @@
      return inl(0xcfc);
  }
  
-@@ -476,11 +487,11 @@ void unlock_vbios(vbios_map * map) {
+@@ -476,11 +491,11 @@ void unlock_vbios(vbios_map * map) {
          case CT_UNKWN:
              break;
          case CT_855GM:
@@ -45,7 +49,7 @@
              break;
          case CT_845G:
          case CT_865G:
-@@ -488,13 +499,13 @@ void unlock_vbios(vbios_map * map) {
+@@ -488,13 +503,13 @@ void unlock_vbios(vbios_map * map) {
          case CT_915GM:
          case CT_945G:
          case CT_945GM:
@@ -63,7 +67,7 @@
              break;
          }
      }
-@@ -526,8 +537,8 @@ void relock_vbios(vbios_map * map) {
+@@ -526,8 +541,8 @@ void relock_vbios(vbios_map * map) {
          case CT_UNKWN:
              break;
          case CT_855GM:
@@ -74,7 +78,7 @@
              break;
          case CT_845G:
          case CT_865G:
-@@ -535,9 +546,9 @@ void relock_vbios(vbios_map * map) {
+@@ -535,9 +550,9 @@ void relock_vbios(vbios_map * map) {
          case CT_915GM:
          case CT_945G:
          case CT_945GM:
Index: patches/patch-ab
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/915resolution/patches/patch-ab,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-ab
--- patches/patch-ab	11 Jun 2006 14:03:58 -0000	1.1.1.1
+++ patches/patch-ab	13 Nov 2006 02:45:23 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-ab,v 1.1.1.1 2006/06/11 14:03:58 markd Exp $
 
---- Makefile.orig	2006-02-03 03:01:38.000000000 +1300
+--- Makefile.orig	2006-02-02 23:01:38.000000000 +0900
 +++ Makefile
-@@ -1,9 +1,13 @@
+@@ -1,9 +1,10 @@
  PRG=915resolution
  
 +PREFIX?=/usr
@@ -10,17 +10,14 @@
  OBJS=${SRCS:.c=.o}
  
 -CFLAGS:=-s -Wall -ggdb 
-+#CFLAGS:=-s -Wall -ggdb 
-+LDLIBS=-li386
-+
 +all: ${PRG}
  
  ${PRG}: ${OBJS}
  
-@@ -11,5 +15,5 @@ clean:
+@@ -11,5 +12,5 @@ clean:
  	rm -f ${OBJS} ${PRG} *~ 
  
  install: ${PRG}
 -	cp ${PRG} /usr/sbin
-+	install -m 555 ${PRG} ${PREFIX}/sbin
++	${BSD_INSTALL_PROGRAM} ${PRG} ${PREFIX}/sbin
  

--Multipart=_Mon__13_Nov_2006_11_51_39_+0900_q=JeRog9nT5FYue6--