- Fix build with Ruby 1.9

PR:		ports/159198
Approved by:	Nikos Ntarmos <ntarmos@cs.uoi.gr> (maintainer)
This commit is contained in:
Steve Wills 2011-07-29 01:50:34 +00:00
parent b548d73185
commit 03280f5b5d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=278510
2 changed files with 35 additions and 3 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= usbhotkey
PORTVERSION= 0.3.1
PORTREVISION= 5
PORTREVISION= 5
CATEGORIES= sysutils
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
@ -26,10 +26,12 @@ HAS_CONFIGURE= yes
.include <bsd.port.pre.mk>
.if !defined(WITHOUT_PTHREADS)
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS} -I${LOCALBASE}/include" \
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS} -I${LOCALBASE}/include \
-I${LOCALBASE}/include/ruby-${RUBY_VER} -I${LOCALBASE}/include/ruby-${RUBY_VER}/${RUBY_ARCH}" \
LDFLAGS="${LDFLAGS} ${PTHREAD_LIBS} -L${LOCALBASE}/lib"
.else
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include \
-I${LOCALBASE}/include/ruby-${RUBY_VER} -I${LOCALBASE}/include/ruby-${RUBY_VER}/${RUBY_ARCH}" \
LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib"
.endif
@ -39,4 +41,8 @@ LIB_DEPENDS+= Imlib.5:${PORTSDIR}/graphics/imlib
CONFIGURE_ARGS+= --without-Imlib
.endif
.if ${RUBY_VER} == 1.9
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-main.c
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,26 @@
--- main.c.orig 2011-07-26 02:17:43.000000000 +0000
+++ main.c 2011-07-26 02:20:01.000000000 +0000
@@ -167,18 +167,18 @@
unsigned c;
VALUE lasterr = rb_gv_get("$!");
VALUE message = rb_obj_as_string(lasterr);
- VALUE ary = rb_funcall( ruby_errinfo, rb_intern("backtrace"), 0);
+ VALUE ary = rb_funcall( rb_errinfo, rb_intern("backtrace"), 0);
- if( ! strcmp(RSTRING(message)->ptr, "exit"))
+ if( ! strcmp(RSTRING_PTR(message), "exit"))
{
quitMe(1);
return;
}
- printf( "usbhotkey: %s\n", RSTRING(message)->ptr);
+ printf( "usbhotkey: %s\n", RSTRING_PTR(message));
printf( "usbhotkey: Backtrace:\n");
- for( c=0; c<RARRAY(ary)->len; c++)
- printf( "usbhotkey: \tfrom %s\n", RSTRING(RARRAY(ary)->ptr[c])->ptr);
+ for( c=0; c<RARRAY_LEN(ary); c++)
+ printf( "usbhotkey: \tfrom %s\n", RSTRING_PTR(RARRAY_PTR(ary)[c]));
errorHelp( "Error executing start script\n");
}
}