coreboot-kgpe-d16/payloads/external/tint/libpayload_tint.patch
Nicola Corna 33f1273f9f tint: Use the current time as random seed
Previously the random seed was fixed, which led to the same sequence of
blocks for each run.

Now that libpayload has time(), no change is needed in the function
rand_init() of tint.

Change-Id: I2e482bbb9d33cdbbf3c15916458329f99fbc4450
Signed-off-by: Nicola Corna <nicola@corna.info>
Reviewed-on: https://review.coreboot.org/20980
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-09-06 11:53:57 +00:00

965 lines
27 KiB
Diff

diff -rupN tint-0.03b/config.h tint/config.h
--- tint-0.03b/config.h 2001-12-08 00:03:24.000000000 +0100
+++ tint/config.h 2016-05-27 14:47:15.797402090 +0200
@@ -29,7 +29,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <libpayload.h>
+#include <curses.h>
+
+#define curs_set(x)
+#define USE_RAND
+
/* Score file */
+#if 0
const char scorefile[] = SCOREFILE;
+#endif
#endif /* #ifndef CONFIG_H */
diff -rupN tint-0.03b/debian/changelog tint/debian/changelog
--- tint-0.03b/debian/changelog 2005-07-17 13:32:20.000000000 +0200
+++ tint/debian/changelog 1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-tint (0.03b) unstable; urgency=low
-
- * Added breaks at end of switch statements to keep gcc 3+ happy
- (Closes: #316022)
- * Added missing includes to engine.c
- * Fixed spelling mistake in NOTES
- * Updated debian policy version
-
- -- Abraham van der Merwe <abz@debian.org> Sun, 17 Jul 2005 13:32:17 +0200
-
-tint (0.03a) unstable; urgency=low
-
- * Applied patch with some minor tweaks from Marcello Mamino which
- adds a dotted background.
- * Applied patches from Robert Lemmen which add support for user logins as
- default name and an interactive mode for specifying the start level.
- * Show player statistics.
-
- -- Abraham van der Merwe <abz@debian.org> Mon, 16 Jun 2003 23:07:37 +0200
-
-tint (0.02d) unstable; urgency=low
-
- * Install man page in correct directory (Closes: #128923)
- * Created a postinst program that checks for old score files
- before installing the default score file (Closes: #136466)
- * Added a menu control file (Closes: #128924)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tint (0.02c) unstable; urgency=low
-
- * Removed common-sense suggests from control file *g* (Closes: #123204)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tint (0.02b) unstable; urgency=low
-
- * Changed the name from tclassic to tint (as in TINT Is Not Tetris(tm))
- * Added a build dependancy on libncurses5-dev (Closes: #124241)
- * Changed the location for the score file to /var/games (Closes: #124236)
- * Made score file sgid games (Closes: #123595)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tclassic (0.02a) unstable; urgency=low
-
- * Initial Release. (Closes: #122839)
-
- -- Abraham van der Merwe <abz@debian.org> Fri, 7 Dec 2001 17:59:25 +0200
-
-Local variables:
-mode: debian-changelog
-End:
diff -rupN tint-0.03b/debian/control tint/debian/control
--- tint-0.03b/debian/control 2005-07-17 13:31:13.000000000 +0200
+++ tint/debian/control 1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-Source: tint
-Section: games
-Priority: optional
-Maintainer: Abraham van der Merwe <abz@debian.org>
-Build-Depends: debhelper (>> 3.0.0), libncurses5-dev
-Standards-Version: 3.6.1
-
-Package: tint
-Architecture: any
-Depends: ${shlibs:Depends}
-Replaces: tclassic
-Conflicts: tclassic
-Description: TINT Is Not Tetris(tm) ...at least the name isn't
- As the title suggests, this is a clone of the original tetris game
- written by Alexey Pajitnov, Dmitry Pavlovsky, and Vadim Gerasimov.
- .
- I've tried to keep the game as close to the original as possible, but
- there is a few differences. Nevertheless, it's probably the closest to
- the original that you'll ever find in the UNIX world...
diff -rupN tint-0.03b/debian/copyright tint/debian/copyright
--- tint-0.03b/debian/copyright 2001-12-19 17:08:42.000000000 +0100
+++ tint/debian/copyright 1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-This is the Debian GNU/Linux prepackaged version of tint. These
-files were written and packaged by Abraham van der Merwe <abz@debian.org>
-
-The games is released under a derivative of the BSD license. For more
-information see http://www.opensource.org/licenses/bsd-license.html
-
-The original source can be found at: http://oasis.frogfoot.net
-
-Copyright:
-
- Copyright (c) Abraham vd Merwe <abz@blio.net>
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of the author nor the names of other contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff -rupN tint-0.03b/debian/.depends tint/debian/.depends
--- tint-0.03b/debian/.depends 2002-03-16 17:26:42.000000000 +0100
+++ tint/debian/.depends 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-tint.postinst.o: tint.postinst.c
diff -rupN tint-0.03b/debian/dirs tint/debian/dirs
--- tint-0.03b/debian/dirs 2002-03-16 17:58:42.000000000 +0100
+++ tint/debian/dirs 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-usr/games
-usr/share/man/man6
diff -rupN tint-0.03b/debian/docs tint/debian/docs
--- tint-0.03b/debian/docs 2001-12-07 17:25:17.000000000 +0100
+++ tint/debian/docs 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-NOTES
-CREDITS
diff -rupN tint-0.03b/debian/Makefile tint/debian/Makefile
--- tint-0.03b/debian/Makefile 2002-03-16 18:41:18.000000000 +0100
+++ tint/debian/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-
-# -*- sh -*-
-
-# Written by Abraham van der Merwe <abz@blio.net>
-# Last updated: 2002-03-26
-
-CC = gcc
-CFLAGS = -Wall -Os -pipe
-LDFLAGS = -s
-
-STRIP = strip
-STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
-
-OBJ =
-SRC = $(OBJ:%.o=%.c)
-PRG =
-
-all: #$(PRG)
-
-$(PRG): $(OBJ)
- $(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
-
-clean:
- rm -rf tint
- rm -f *~ $(OBJ) $(PRG) *.substvars *.debhelper
-
-.PHONY: all clean
-
diff -rupN tint-0.03b/debian/menu tint/debian/menu
--- tint-0.03b/debian/menu 2002-03-16 18:31:13.000000000 +0100
+++ tint/debian/menu 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-?package(tint):needs="text" section="Games/Tetris-like" \
- title="TINT Is Not Tetris(tm)" \
- command="sh -c '/usr/games/tint -l 5;echo;echo PRESS ENTER;read line'" \
- hints="Text"
diff -rupN tint-0.03b/debian/postinst tint/debian/postinst
--- tint-0.03b/debian/postinst 2002-03-16 18:44:34.000000000 +0100
+++ tint/debian/postinst 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-#!/bin/sh -e
-
-scorefile="/var/games/tint.scores"
-
-if [ ! -e $scorefile ]
-then
- touch $scorefile
- chmod 0664 $scorefile
- chown root:games $scorefile
-fi
-
-#DEBHELPER#
-
diff -rupN tint-0.03b/debian/postinst.c tint/debian/postinst.c
--- tint-0.03b/debian/postinst.c 2002-03-16 18:15:32.000000000 +0100
+++ tint/debian/postinst.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,143 +0,0 @@
-
-/*
- * Hacked up postinst program to install the default score file. We have to do it this
- * way, since the old score file is overwritten if the score file already exists in the
- * package - abz
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <grp.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/* location of score file */
-static const char filename[] = "/var/games/tint.scores";
-
-/* user name of default score file */
-static const char user[] = "root";
-
-/* group name of default score file */
-static const char group[] = "games";
-
-/* contents of default score file */
-static const uint8_t contents[] =
-{
- 0x54, 0x69, 0x6e, 0x74, 0x20, 0x30, 0x2e, 0x30,
- 0x32, 0x62, 0x20, 0x28, 0x63, 0x29, 0x20, 0x41,
- 0x62, 0x72, 0x61, 0x68, 0x61, 0x6d, 0x20, 0x76,
- 0x64, 0x20, 0x4d, 0x65, 0x72, 0x77, 0x65, 0x20,
- 0x2d, 0x20, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73,
- 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
- 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
- 0x74, 0x00, 0x10, 0x5f, 0x00, 0x00, 0xb7, 0xc8,
- 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00, 0x80, 0x3a,
- 0x00, 0x00, 0x94, 0xc5, 0x20, 0x3c, 0x52, 0x69,
- 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65,
- 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68, 0x74, 0x00,
- 0x66, 0x21, 0x00, 0x00, 0x31, 0xc9, 0x20, 0x3c,
- 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
- 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
- 0x74, 0x00, 0xdc, 0x1a, 0x00, 0x00, 0x79, 0xc6,
- 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20,
- 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65,
- 0x63, 0x68, 0x74, 0x00, 0x2f, 0x16, 0x00, 0x00,
- 0xf9, 0xc5, 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61,
- 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62,
- 0x72, 0x65, 0x63, 0x68, 0x74, 0x00, 0x8b, 0x11,
- 0x00, 0x00, 0x82, 0xc7, 0x20, 0x3c, 0x41, 0x62,
- 0x7a, 0x00, 0x23, 0x10, 0x00, 0x00, 0xa9, 0xc9,
- 0x20, 0x3c, 0x44, 0x6f, 0x70, 0x70, 0x65, 0x6c,
- 0x67, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x00, 0x13,
- 0x0b, 0x00, 0x00, 0x21, 0xc7, 0x20, 0x3c, 0x4a,
- 0x6f, 0x68, 0x61, 0x6e, 0x6e, 0x20, 0x42, 0x6f,
- 0x74, 0x68, 0x61, 0x00, 0x5a, 0x09, 0x00, 0x00,
- 0xef, 0xc6, 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00,
- 0xd7, 0x07, 0x00, 0x00, 0xad, 0xc6, 0x20, 0x3c
-};
-
-static void debhelper_stuff()
-{
- /* dh_installdocs */
- system ("if [ -d /usr/doc -a ! -e /usr/doc/tint -a -d /usr/share/doc/tint ]; then\n"
- " ln -sf ../share/doc/tint /usr/doc/tint\n"
- "fi\n");
-
- /* dh_installmenu */
- system ("if [ -x /usr/bin/update-menus ]; then update-menus ; fi");
-}
-
-int main (int argc,char *argv[])
-{
- struct stat sb;
-
- /* we only do something if we're called as <program> configure ... */
- if (argc < 2 || strcmp (argv[1],"configure")) exit (EXIT_SUCCESS);
-
- /* if the score file doesn't exist, create it */
- if (stat (filename,&sb) < 0)
- {
- int fd,result;
- struct passwd *u;
- struct group *g;
- uid_t uid;
- gid_t gid;
-
- /* get uid */
- if ((u = getpwnam (user)) == NULL)
- {
- fprintf (stderr,"Couldn't obtain uid for %s: %m\n",user);
- exit (EXIT_FAILURE);
- }
- uid = u->pw_uid;
-
- /* get gid */
- if ((g = getgrnam (group)) == NULL)
- {
- fprintf (stderr,"Couldn't obtain gid for %s: %m\n",group);
- exit (EXIT_FAILURE);
- }
- gid = g->gr_gid;
-
- /* create default score file */
- if ((fd = creat (filename,0664)) < 0)
- {
- fprintf (stderr,"Couldn't create score file %s: %m\n",filename);
- exit (EXIT_FAILURE);
- }
- result = write (fd,contents,sizeof (contents));
- if (result < 0)
- {
- fprintf (stderr,"Unable to write to %s: %m\n",filename);
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- if (result < sizeof (contents))
- {
- fprintf (stderr,"Short write count. %d/%d bytes written to %s\n",result,sizeof (contents),filename);
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- close (fd);
-
- /* change ownership of score file */
- if (chown (filename,uid,gid) < 0)
- {
- fprintf (stderr,"Couldn't change ownership of %s to %s:%s: %m\n",filename,user,group);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- }
-
- debhelper_stuff ();
-
- exit (EXIT_SUCCESS);
-}
-
diff -rupN tint-0.03b/debian/rules tint/debian/rules
--- tint-0.03b/debian/rules 2002-03-16 18:00:11.000000000 +0100
+++ tint/debian/rules 1970-01-01 01:00:00.000000000 +0100
@@ -1,82 +0,0 @@
-#!/usr/bin/make -f
-
-# -*- sh -*-
-
-# Uncomment this to turn on verbose mode.
-export DH_VERBOSE=1
-
-# This is the debhelper compatability version to use.
-export DH_COMPAT=3
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- # Add here commands to configure the package.
-
-
- touch configure-stamp
-
-build: configure-stamp build-stamp
-build-stamp:
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
-
- # Add here commands to clean up after the build process.
- -$(MAKE) clean
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/tint.
- $(MAKE) install DESTDIR=$(CURDIR)/debian/tint
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
-# dh_installdebconf
- dh_installdocs
-# dh_installexamples
- dh_installmenu
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_installinit
-# dh_installcron
- dh_installman
-# dh_installinfo
-# dh_undocumented
- dh_installchangelogs
- dh_link
- dh_strip
- dh_compress
-# dh_fixperms --exclude /usr/games/tint
-# dh_makeshlibs
- dh_installdeb
-# dh_perl
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
diff -rupN tint-0.03b/engine.c tint/engine.c
--- tint-0.03b/engine.c 2005-07-17 13:26:22.000000000 +0200
+++ tint/engine.c 2016-05-27 19:05:21.681035752 +0200
@@ -27,10 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
+#if 0
#include <stdlib.h>
#include <string.h>
+#endif
-#include "typedefs.h"
#include "utils.h"
#include "io.h"
#include "engine.h"
diff -rupN tint-0.03b/engine.h tint/engine.h
--- tint-0.03b/engine.h 2001-12-07 16:48:08.000000000 +0100
+++ tint/engine.h 2016-05-27 19:04:32.456828081 +0200
@@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "typedefs.h" /* bool */
+#include "curses.h" /* bool */
/*
* Macros
diff -rupN tint-0.03b/io.c tint/io.c
--- tint-0.03b/io.c 2001-12-07 16:48:20.000000000 +0100
+++ tint/io.c 2016-05-27 14:47:15.798402053 +0200
@@ -27,9 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
+#if 0
#include <stdarg.h> /* va_list(), va_start(), va_end() */
#include <sys/time.h> /* gettimeofday() */
#include <unistd.h> /* gettimeofday() */
+#endif
#include <curses.h>
@@ -70,7 +74,11 @@ static int in_timeleft;
/* Initialize screen */
void io_init ()
{
+ curses_enable_serial(0);
+ curses_enable_vga(1);
initscr ();
+ halfdelay(1);
+ timeout(1);
start_color ();
curs_set (CURSOR_INVISIBLE);
out_attr = A_NORMAL;
@@ -176,11 +184,17 @@ void out_beep ()
/* Read a character. Please note that you MUST call in_timeout() before in_getch() */
int in_getch ()
{
+#if 0
struct timeval starttv,endtv;
+#endif
int ch;
+#if 0
timeout (in_timeleft / 1000);
gettimeofday (&starttv,NULL);
+#endif
ch = getch ();
+ mdelay(150);
+#if 0
gettimeofday (&endtv,NULL);
/* Timeout? */
if (ch == ERR)
@@ -198,6 +212,7 @@ int in_getch ()
in_timeleft -= endtv.tv_usec;
if (in_timeleft <= 0) in_timeleft = in_timetotal;
}
+#endif
return ch;
}
diff -rupN tint-0.03b/Makefile tint/Makefile
--- tint-0.03b/Makefile 2005-07-17 13:30:54.000000000 +0200
+++ tint/Makefile 2016-05-27 21:04:02.374391088 +0200
@@ -28,85 +28,79 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#CROSS = arm-linux-
-
-bindir = $(DESTDIR)/usr/games
-mandir = $(DESTDIR)/usr/share/man
-localstatedir = $(DESTDIR)/var/games
-
-ifeq ($(CC),)
-CC = gcc
-else
-ifeq ($(CC),colorgcc)
- ifneq ($(CROSS),)
- CC = gcc
- endif
+# in addition to the dependency below, create the file if it doesn't exist
+# to silence warnings about a file that would be generated anyway.
+$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
+.xcompile: ../../../../util/xcompile/xcompile
+
+CONFIG_COMPILER_GCC := y
+ARCH-y := x86_32
+
+include .xcompile
+
+src := $(CURDIR)
+srctree := $(src)
+tint_obj := $(src)/build
+
+LIBCONFIG_PATH := $(realpath ../../../libpayload)
+LIBPAYLOAD_DIR := $(tint_obj)/libpayload
+HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/lib/libpayload.a)
+LIB_CONFIG ?= configs/defconfig-tinycurses
+
+# CFLAGS := -Wall -Werror -Os
+CFLAGS := -Wall -g -Os
+TARGET := tint
+OBJS := $(TARGET).o engine.o io.o utils.o
+
+ARCH-y := x86_32
+
+CC := $(CC_$(ARCH-y))
+AS := $(AS_$(ARCH-y))
+OBJCOPY := $(OBJCOPY_$(ARCH-y))
+
+LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/bin/lpgcc
+LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/bin/lpas
+
+# Make is silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
endif
-endif
-
-CFLAGS = -Wall -Os -pipe
-CPPFLAGS = -DSCOREFILE=\"$(localstatedir)/$(PRG).scores\" #-DUSE_RAND
-LDFLAGS = -s
-LDLIBS = -lncurses
-
-STRIP = strip
-STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
-
-INSTALL = install
-
-OBJ = engine.o utils.o io.o tint.o
-SRC = $(OBJ:%.o=%.c)
-PRG = tint
-
- ########### NOTHING TO EDIT BELOW THIS ###########
-
-.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
-
-all: do-it-all postinst
-ifeq (.depends,$(wildcard .depends))
-include .depends
-do-it-all: with-depends
+all: $(TARGET).elf
+# printf" CC $(CC)\n"
+
+$(TARGET).elf: $(OBJS) libpayload
+ $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LPCC) -o $@ $(OBJS)
+ $(Q)$(OBJCOPY) --only-keep-debug $@ tint.debug
+ $(Q)$(OBJCOPY) --strip-debug $@
+ $(Q)$(OBJCOPY) --add-gnu-debuglink=tint.debug $@
+
+%.o: %.c libpayload
+ $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LPCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+%.S.o: %.S libpayload
+ $(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
+ $(Q)$(LPAS) $(ASFLAGS) --32 -o $@ $<
+
+ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
+libpayload:
+ $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
else
-do-it-all: without-depends
-endif
-
-without-depends: depend with-depends
-
-depend:
- rm -f .depends
- set -e; for F in $(SRC); do $(CC) -MM $(CFLAGS) $(CPPFLAGS) $$F >> .depends; done
-
-with-depends: $(PRG)
-
-$(PRG): $(OBJ)
- $(CROSS)$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
- $(CROSS)$(STRIP) $(STRIPFLAGS) $@
-
-ifneq ($(DESTDIR),)
-install: $(PRG)
- $(INSTALL) -d $(bindir) $(mandir) $(localstatedir)
- $(INSTALL) -s -g games -o root -m 2755 $(PRG) $(bindir)
- $(INSTALL) -g games -o root -m 0644 $(PRG).6 $(mandir)/man6
-# cp tint.scores $(localstatedir)/$(PRG).scores
-# chown root.games $(localstatedir)/$(PRG).scores
-# chmod 0664 $(localstatedir)/$(PRG).scores
-
-uninstall:
- rm -f $(bindir)/$(PRG) $(mandir)/man6/$(PRG).6 $(localstatedir)/$(PRG).scores
+libpayload:
+ $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
+ $(Q)make -C $(LIBCONFIG_PATH) distclean
+ $(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG)
+ $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install
endif
-postinst:
- $(MAKE) -C debian
-
-debian:
- dpkg-buildpackage -rfakeroot -k2B555AEE
-
clean:
- rm -f .depends *~ $(OBJ) $(PRG) {configure,build}-stamp gmon.out a.out
- rm -rf debian/$(PRG)
- rm -f debian/*.{debhelper,substvars} debian/files debian/*~
+ $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o
+ $(Q)rm .xcompile
distclean: clean
- $(MAKE) -C debian clean
+ $(Q)rm -rf $(tint_obj)
+
+.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
Binary files tint-0.03b/.Makefile.swp and tint/.Makefile.swp differ
diff -rupN tint-0.03b/tint.c tint/tint.c
--- tint-0.03b/tint.c 2005-07-17 13:26:43.000000000 +0200
+++ tint/tint.c 2016-05-27 18:59:53.838346317 +0200
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) Abraham vd Merwe <abz@blio.net>
* All rights reserved.
@@ -27,6 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if 0
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -34,8 +34,8 @@
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
+#endif
-#include "typedefs.h"
#include "utils.h"
#include "io.h"
#include "config.h"
@@ -321,6 +321,7 @@ typedef struct
time_t timestamp;
} score_t;
+#if 0
static void getname (char *name)
{
struct passwd *pw = getpwuid (geteuid ());
@@ -337,7 +338,9 @@ static void getname (char *name)
name[NAMELEN - 1] = '\0';
}
}
+#endif
+#if 0
static void err1 ()
{
fprintf (stderr,"Error creating %s\n",scorefile);
@@ -349,10 +352,11 @@ static void err2 ()
fprintf (stderr,"Error writing to %s\n",scorefile);
exit (EXIT_FAILURE);
}
+#endif
void showplayerstats (engine_t *engine)
{
- fprintf (stderr,
+ printf (
"\n\t PLAYER STATISTICS\n\n\t"
"Score %11d\n\t"
"Efficiency %11d\n\t"
@@ -360,6 +364,7 @@ void showplayerstats (engine_t *engine)
GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
}
+#if 0
static void createscores (int score)
{
FILE *handle;
@@ -394,7 +399,9 @@ static void createscores (int score)
fprintf (stderr,"%s",scoretitle);
fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name);
}
+#endif
+#if 0
static int cmpscores (const void *a,const void *b)
{
int result;
@@ -412,7 +419,9 @@ static int cmpscores (const void *a,cons
/* timestamps is equal */
return 0;
}
+#endif
+#if 0
static void savescores (int score)
{
FILE *handle;
@@ -490,11 +499,13 @@ static void savescores (int score)
}
fprintf (stderr,"\n");
}
+#endif
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
+#if 0
static void showhelp ()
{
fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n");
@@ -504,9 +515,11 @@ static void showhelp ()
fprintf (stderr," -d Draw vertical dotted lines\n");
exit (EXIT_FAILURE);
}
+#endif
static void parse_options (int argc,char *argv[])
{
+#if 0
int i = 1;
while (i < argc)
{
@@ -536,10 +549,12 @@ static void parse_options (int argc,char
}
i++;
}
+#endif
}
static void choose_level ()
{
+#if 0
char buf[NAMELEN];
do
@@ -549,6 +564,8 @@ static void choose_level ()
buf[strlen (buf) - 1] = '\0';
}
while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
+#endif
+ level = 1;
}
/***************************************************************************/
@@ -561,6 +578,8 @@ int main (int argc,char *argv[])
int ch;
engine_t engine;
/* Initialize */
+ if (IS_ENABLED(CONFIG_LP_USB))
+ usb_initialize();
rand_init (); /* must be called before engine_init () */
engine_init (&engine,score_function); /* must be called before using engine.curshape */
finished = shownext = FALSE;
@@ -663,8 +682,15 @@
if (ch != 'q')
{
showplayerstats (&engine);
+#if 0
savescores (GETSCORE (engine.score));
+#endif
}
+ printf("Bye.\n");
+ refresh();
+ for(;;); //halt();
+#if 0
exit (EXIT_SUCCESS);
+#endif
}
diff -rupN tint-0.03b/typedefs.h tint/typedefs.h
--- tint-0.03b/typedefs.h 2001-12-07 16:49:06.000000000 +0100
+++ tint/typedefs.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,68 +0,0 @@
-#ifndef TYPEDEFS_H
-#define TYPEDEFS_H
-
-/*
- * Copyright (c) Abraham vd Merwe <abz@blio.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of other contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Boolean definitions
- */
-
-#ifndef bool
-#define bool int
-#endif
-
-#if !defined(false) || (false != 0)
-#define false 0
-#endif
-
-#if !defined(true) || (true != 0)
-#define true 1
-#endif
-
-#if !defined(FALSE) || (FALSE != false)
-#define FALSE false
-#endif
-
-#if !defined(TRUE) || (TRUE != true)
-#define TRUE true
-#endif
-
-/*
- * Error flags
- */
-
-#if !defined(ERR) || (ERR != -1)
-#define ERR -1
-#endif
-
-#if !defined(OK) || (OK != 0)
-#define OK 0
-#endif
-
-#endif /* #ifndef TYPEDEFS_H */
diff -rupN tint-0.03b/utils.c tint/utils.c
--- tint-0.03b/utils.c 2001-12-07 16:49:19.000000000 +0100
+++ tint/utils.c 2016-05-27 19:05:40.313351887 +0200
@@ -27,11 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+
+#if 0
#include <stdlib.h>
#include <time.h>
#include <limits.h>
-
-#include "typedefs.h"
+#endif
/*
* Initialize random number generator
@@ -61,6 +63,7 @@ int rand_value (int range)
* Convert an str to long. Returns TRUE if successful,
* FALSE otherwise.
*/
+#if 0
bool str2int (int *i,const char *str)
{
char *endptr;
@@ -69,3 +72,4 @@ bool str2int (int *i,const char *str)
return TRUE;
}
+#endif
diff -rupN tint-0.03b/utils.h tint/utils.h
--- tint-0.03b/utils.h 2001-12-07 16:49:35.000000000 +0100
+++ tint/utils.h 2016-05-27 19:00:34.120754123 +0200
@@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "typedefs.h"
+#include <curses.h>
/*
* Initialize random number generator