pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ztrack: misc improvement and cosmetic changes



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Thu Jul 28 12:51:04 2016 +0200
Changeset:	977ce0e169f462c8a3f0d202b3656cca0d9483b8

Modified Files:
	ztrack/Makefile
	ztrack/distinfo
	ztrack/patches/patch-Makefile
Added Files:
	ztrack/patches/patch-ztrack.c

Log Message:
ztrack: misc improvement and cosmetic changes

- Simplify a bit package Makefile delegating some change to
  patches/patch-Makefile and to SUBST framework
- patches/patch-Makefile honors user's CC {C,LD}FLAGS
- Add patches/patch-ztrack.c to fix a warning pointed out by the -Wall CC flag

ok'd by <kamil>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=977ce0e169f462c8a3f0d202b3656cca0d9483b8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 ztrack/Makefile               | 14 +++++++-------
 ztrack/distinfo               |  3 ++-
 ztrack/patches/patch-Makefile | 36 +++++++++++++++++++++++++++++++-----
 ztrack/patches/patch-ztrack.c | 21 +++++++++++++++++++++
 4 files changed, 61 insertions(+), 13 deletions(-)

diffs:
diff --git a/ztrack/Makefile b/ztrack/Makefile
index 13c0ab4..2512e43 100644
--- a/ztrack/Makefile
+++ b/ztrack/Makefile
@@ -10,16 +10,16 @@ HOMEPAGE=	${MASTER_SITE_SUNSITE:=games/arcade/}
 COMMENT=	Simple curses-based pseudo-3D driving game
 LICENSE=	public-domain
 
-WRKSRC=	${WRKDIR}/ztrack
+WRKSRC=		${WRKDIR}/${PKGBASE}
 
-MAKE_FLAGS+=	CC=${CC:Q}
-MAKE_FLAGS+=	CFLAGS="-DHAVE_RANDOM \
-			-I${BUILDLINK_PREFIX.curses}/${BUILDLINK_INCDIRS.curses}"
-MAKE_FLAGS+=	LIBS="-lcurses \
-			-L${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses} \
-			${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses}"
 MAKE_FLAGS+=	BINDIR=${PREFIX}/bin
 MAKE_FLAGS+=	MANDIR=${PREFIX}/${PKGMANDIR}/man6
 
+SUBST_CLASSES+=		makefile
+SUBST_STAGE.makefile=	pre-configure
+SUBST_MESSAGE.makefile=	Link with the proper curses type
+SUBST_FILES.makefile=	Makefile
+SUBST_SED.makefile=	-e '/LIBS/ s,-lncurses,-l${BUILDLINK_LIBNAME.curses},'
+
 .include "../../mk/curses.buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/ztrack/distinfo b/ztrack/distinfo
index 87fb2fe..02e800b 100644
--- a/ztrack/distinfo
+++ b/ztrack/distinfo
@@ -4,4 +4,5 @@ SHA1 (ztrack-1.0.tar.gz) = 1cc31c82d78b87efa18623edf72eaa02859b38f0
 RMD160 (ztrack-1.0.tar.gz) = ff3deaf1a31e048350cb94f1d9fed87e84a99fde
 SHA512 (ztrack-1.0.tar.gz) = 10efc72b593f6068ebf515ebd5be8d4c0451f37e798161dca5addbfcc468b6ee1d2bfc6b92701c6024ae4cb4fd3b1053a7891c2e7a023855aa2821420e6bb62c
 Size (ztrack-1.0.tar.gz) = 10186 bytes
-SHA1 (patch-Makefile) = 7c4b61351c77708c5965c50218c0b1ad1fe7ccbf
+SHA1 (patch-Makefile) = cb68993430fa3286ebb1c5828c3e5209adf844f9
+SHA1 (patch-ztrack.c) = f47973334a3baa59e8ac675fc43280a6f9bb6881
diff --git a/ztrack/patches/patch-Makefile b/ztrack/patches/patch-Makefile
index 98c5249..082f37c 100644
--- a/ztrack/patches/patch-Makefile
+++ b/ztrack/patches/patch-Makefile
@@ -1,9 +1,31 @@
 $NetBSD$
 
-Adapt for pkgsrc
+- Accept user defined CC, CFLAGS and LDFLAGS.
+- Add DESTDIR support
+- Fix permissions of installed files
 
 --- Makefile.orig	1996-09-30 03:34:20.000000000 +0000
 +++ Makefile
+@@ -2,16 +2,16 @@
+ #
+ # note that you need an ANSI C compiler;
+ # gcc is easiest if you've got it or can get it
+-CC=gcc
++CC?=gcc
+ 
+ # flags for Linux/gcc, hack as required
+ # remove '-DHAVE_RANDOM' if your libc doesn't have 'random' and 'srandom'.
+ # add '-DNO_COLOUR' if you don't want colour or the colour support
+ # causes problems.
+-CFLAGS=-O2 -Wall -DHAVE_RANDOM -I/usr/include/ncurses #-DDEBUG
++CFLAGS+= -Wall -DHAVE_RANDOM
+ 
+ # if using ncurses:
+-LIBS=-lncurses
++LIBS=-lcurses
+ 
+ # bsd-derived is usually:
+ #LIBS=-lcurses -ltermcap
 @@ -20,6 +20,7 @@ LIBS=-lncurses
  #LIBS=-lcurses -lterminfo
  
@@ -12,16 +34,20 @@ Adapt for pkgsrc
  BINDIR=/usr/games
  MANDIR=/usr/man/man6
  
-@@ -34,8 +35,10 @@ ztrack: $(OBJS)
- 	$(CC) $(CFLAGS) -o ztrack $(OBJS) $(LIBS)
+@@ -31,11 +32,13 @@ OBJS=ztrack.o
+ all: ztrack
+ 
+ ztrack: $(OBJS)
+-	$(CC) $(CFLAGS) -o ztrack $(OBJS) $(LIBS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o ztrack $(OBJS) $(LIBS)
  
  install: ztrack
 -	install -s -m 511 ztrack $(BINDIR)
 -	install -m 444 ztrack.6 $(MANDIR)
 +	install -d $(DESTDIR)$(BINDIR)
-+	install -s -m 511 ztrack $(DESTDIR)$(BINDIR)
++	install -s -m 755 ztrack $(DESTDIR)$(BINDIR)
 +	install -d $(DESTDIR)$(MANDIR)
-+	install -m 444 ztrack.6 $(DESTDIR)$(MANDIR)
++	install -m 644 ztrack.6 $(DESTDIR)$(MANDIR)
  
  clean:
  	$(RM) *.o *~ ztrack
diff --git a/ztrack/patches/patch-ztrack.c b/ztrack/patches/patch-ztrack.c
new file mode 100644
index 0000000..ea5e156
--- /dev/null
+++ b/ztrack/patches/patch-ztrack.c
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Add explicit braces to avoid ambiguous 'else' (pointed out by -Wall)
+
+--- ztrack.c.orig	1995-12-01 02:34:36.000000000 +0000
++++ ztrack.c
+@@ -553,12 +553,13 @@ int f,l=0,r=0;
+ 
+ for(f=0;f<MAX_ENEMY;f++)
+   if(enemy[f].active)
+-    if(FIX_DOWN(enemy[f].ypos)==0)
++    if(FIX_DOWN(enemy[f].ypos)==0) {
+       if(enemy[f].lane==lane-1)
+         l=1;
+       else
+         if(enemy[f].lane==lane+1)
+           r=1;
++    }
+ 
+ use_colour(COLOR_YELLOW,A_BOLD);
+ 


Home | Main Index | Thread Index | Old Index