1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 06:43:45 +02:00

bsd-games: tetris, primes

This commit is contained in:
kyak 2010-07-27 10:15:18 +04:00
parent dcc11f77b8
commit 510c7bbfad
3 changed files with 217 additions and 0 deletions

73
bsd-games/Makefile Normal file
View File

@ -0,0 +1,73 @@
#
# kyak@freenode/#qi-hardware
#
# This is free software, licensed under the GNU General Public License v2.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bsd-games
PKG_VERSION:=2.17
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=ftp://metalab.unc.edu/pub/Linux/games/
PKG_MD5SUM:=238a38a3a017ca9b216fc42bde405639
include $(INCLUDE_DIR)/package.mk
define Package/bsd-games
SUBMENU:=bsd-games
SECTION:=games
CATEGORY:=Games
URL:=ftp://metalab.unc.edu/pub/Linux/games/
endef
define Build/Configure
endef
CFLAGS:=
define Build/Compile
#Building tetris
cd $(PKG_BUILD_DIR)/tetris; \
mv pathnames.h.in pathnames.h; \
$(TARGET_CC) -c -O2 -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -I$(STAGING_DIR)/usr/include input.c screen.c shapes.c scores.c tetris.c; \
$(TARGET_CC) -lncurses -L$(STAGING_DIR)/usr/lib -o tetris input.o screen.o shapes.o scores.o tetris.o
#Building primes
cd $(PKG_BUILD_DIR)/primes; \
$(TARGET_CC) -c -O2 -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings pattern.c pr_tbl.c primes.c; \
$(TARGET_CC) -lm -o primes pattern.o pr_tbl.o primes.o
endef
define Package/tetris
$(call Package/bsd-games)
TITLE:=the game of tetris
DEPENDS:=+libncurses
endef
define Package/tetris/install
$(INSTALL_DIR) \
$(1)/usr/bin \
$(1)/var/games
$(INSTALL_BIN) \
$(PKG_BUILD_DIR)/tetris/tetris \
$(1)/usr/bin/tetris
endef
define Package/primes
$(call Package/bsd-games)
TITLE:=generate primes
endef
define Package/primes/install
$(INSTALL_DIR) \
$(1)/usr/bin
$(INSTALL_BIN) \
$(PKG_BUILD_DIR)/primes/primes \
$(1)/usr/bin/primes
endef
$(eval $(call BuildPackage,tetris))
$(eval $(call BuildPackage,primes))

View File

@ -0,0 +1,71 @@
diff -u bsd-games-2.17/tetris/input.c bsd-games-2.17-p/tetris/input.c
--- bsd-games-2.17/tetris/input.c 2003-12-17 05:47:37.000000000 +0300
+++ bsd-games-2.17-p/tetris/input.c 2010-07-26 22:04:34.422302192 +0400
@@ -85,7 +85,7 @@
endtv = *tvp;
timeout = tvp->tv_sec * 1000 + tvp->tv_usec / 1000;
} else
- timeout = INFTIM;
+ timeout = -1;
again:
set[0].fd = STDIN_FILENO;
set[0].events = POLLIN;
Файлы bsd-games-2.17/tetris/input.o и bsd-games-2.17-p/tetris/input.o различаются
diff -u bsd-games-2.17/tetris/screen.c bsd-games-2.17-p/tetris/screen.c
--- bsd-games-2.17/tetris/screen.c 2004-01-27 23:52:07.000000000 +0300
+++ bsd-games-2.17-p/tetris/screen.c 2010-07-26 22:04:34.422151495 +0400
@@ -73,7 +73,7 @@
extern char PC, *BC, *UP; /* tgoto requires globals: ugh! */
static char BCdefault[] = "\b";
#ifndef NCURSES_VERSION
-short ospeed;
+speed_t ospeed;
#endif
static char
@@ -287,6 +287,7 @@
stop("tcgetattr() fails");
newtt = oldtt;
newtt.c_lflag &= ~(ICANON|ECHO);
+#define OXTABS XTABS
newtt.c_oflag &= ~OXTABS;
newtt.c_cc[VMIN] = 1;
newtt.c_cc[VTIME] = 0;
Файлы bsd-games-2.17/tetris/screen.o и bsd-games-2.17-p/tetris/screen.o различаются
diff -u bsd-games-2.17/tetris/shapes.c bsd-games-2.17-p/tetris/shapes.c
--- bsd-games-2.17/tetris/shapes.c 2003-12-17 05:47:37.000000000 +0300
+++ bsd-games-2.17-p/tetris/shapes.c 2010-07-27 09:30:41.267111585 +0400
@@ -83,7 +83,7 @@
const struct shape *shape;
int pos;
{
- int *o = shape->off;
+ const int *o = shape->off;
if (board[pos] || board[pos + *o++] || board[pos + *o++] ||
board[pos + *o])
@@ -100,7 +100,7 @@
const struct shape *shape;
int pos, onoff;
{
- int *o = shape->off;
+ const int *o = shape->off;
board[pos] = onoff;
board[pos + *o++] = onoff;
diff -u bsd-games-2.17/tetris/tetris.c bsd-games-2.17-p/tetris/tetris.c
--- bsd-games-2.17/tetris/tetris.c 2004-01-27 23:52:07.000000000 +0300
+++ bsd-games-2.17-p/tetris/tetris.c 2010-07-26 22:04:34.430557133 +0400
@@ -35,10 +35,10 @@
*/
#include <sys/cdefs.h>
-#ifndef lint
+/*#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n");
-#endif /* not lint */
+#endif*/ /* not lint */
/*
* Tetris (or however it is spelled).

View File

@ -0,0 +1,73 @@
diff -u bsd-games-2.17/primes/pattern.c bsd-games-2.17-p/primes/pattern.c
--- bsd-games-2.17/primes/pattern.c 2003-12-17 05:47:37.000000000 +0300
+++ bsd-games-2.17-p/primes/pattern.c 2010-07-27 09:07:23.122817978 +0400
@@ -33,13 +33,13 @@
*/
#include <sys/cdefs.h>
-#ifndef lint
+/*#ifndef lint
#if 0
static char sccsid[] = "@(#)pattern.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: pattern.c,v 1.6 2003/08/07 09:37:33 agc Exp $");
#endif
-#endif /* not lint */
+#endif */ /* not lint */
/*
* pattern - the Eratosthenes sieve on odd numbers for 3,5,7,11 and 13
diff -u bsd-games-2.17/primes/primes.c bsd-games-2.17-p/primes/primes.c
--- bsd-games-2.17/primes/primes.c 2004-01-27 23:52:07.000000000 +0300
+++ bsd-games-2.17-p/primes/primes.c 2010-07-27 09:07:52.303319233 +0400
@@ -33,18 +33,18 @@
*/
#include <sys/cdefs.h>
-#ifndef lint
+/*#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n");
-#endif /* not lint */
+#endif */ /* not lint */
-#ifndef lint
+/*#ifndef lint
#if 0
static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
#else
__RCSID("$NetBSD: primes.c,v 1.12 2004/01/27 20:30:30 jsm Exp $");
#endif
-#endif /* not lint */
+#endif */ /* not lint */
/*
* primes - generate a table of primes between two values
diff -u bsd-games-2.17/primes/primes.h bsd-games-2.17-p/primes/primes.h
--- bsd-games-2.17/primes/primes.h 2003-12-17 05:47:37.000000000 +0300
+++ bsd-games-2.17-p/primes/primes.h 2010-07-27 10:03:25.333608205 +0400
@@ -48,3 +48,5 @@
/* bytes in sieve table (must be > 3*5*7*11) */
#define TABSIZE 256*1024
+
+int isblank(int c);
diff -u bsd-games-2.17/primes/pr_tbl.c bsd-games-2.17-p/primes/pr_tbl.c
--- bsd-games-2.17/primes/pr_tbl.c 2003-12-17 05:47:37.000000000 +0300
+++ bsd-games-2.17-p/primes/pr_tbl.c 2010-07-27 09:08:15.198301714 +0400
@@ -33,13 +33,13 @@
*/
#include <sys/cdefs.h>
-#ifndef lint
+/* #ifndef lint
#if 0
static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: pr_tbl.c,v 1.7 2003/08/07 09:37:33 agc Exp $");
#endif
-#endif /* not lint */
+#endif */ /* not lint */
/*
* prime - prime table