]> git.pld-linux.org Git - packages/crafty.git/commitdiff
- adjusted for 20.1 + new ones
authorPaweł Gołaszewski <blues@pld-linux.org>
Sun, 18 Nov 2007 12:13:11 +0000 (12:13 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    crafty-MDK.patch -> 1.1
    crafty-Makefile.patch -> 1.2
    crafty-paths.patch -> 1.4

crafty-MDK.patch [new file with mode: 0644]
crafty-Makefile.patch
crafty-paths.patch

diff --git a/crafty-MDK.patch b/crafty-MDK.patch
new file mode 100644 (file)
index 0000000..f7d2540
--- /dev/null
@@ -0,0 +1,410 @@
+--- annotate.c
++++ annotate.c
+@@ -554,7 +554,7 @@
+ void AnnotatePositionHTML(TREE * RESTRICT tree, int wtm, FILE * annotate_out)
+ {
+-  char filename[32], html_piece;
++  char filename[64], html_piece;
+   char alt[32];
+   char xlate[15] =
+       { 'q', 'r', 'b', 0, 'k', 'n', 'p', 0, 'P', 'N', 'K', 0, 'B', 'R', 'Q' };
+@@ -566,7 +566,7 @@
+   for (rank = RANK8; rank >= RANK1; rank--) {
+     fprintf(annotate_out, "<TR>\n");
+     for (file = FILEA; file <= FILEH; file++) {
+-      (void) strcpy(filename, "bitmaps/");
++      (void) strcpy(filename, "/usr/share/crafty/bitmaps/");
+       if ((rank + file) % 2)
+         (void) strcat(filename, "w");
+       else
+@@ -665,7 +665,7 @@
+   fprintf(annotate_out, "\\usepackage{times}\n");
+   fprintf(annotate_out, "\\usepackage{a4wide}\n");
+   fprintf(annotate_out, "\\usepackage{chess}\n");
+-  fprintf(annotate_out, "\\usepackage{bdfchess}\n");
++  fprintf(annotate_out, "%% \\usepackage{bdfchess}\n");
+   fprintf(annotate_out, "\\usepackage[T1]{fontenc}\n");
+   fprintf(annotate_out, "\n");
+   fprintf(annotate_out, "\\setlength{\\columnsep}{7mm}\n");
+--- egtb.cpp
++++ egtb.cpp
+@@ -4490,7 +4490,8 @@
+ #if defined (SMP)
+   static    lock_t  lockDecode;
+ #endif
+-extern "C" int TB_CRC_CHECK = 0;
++extern "C" int TB_CRC_CHECK;
++int TB_CRC_CHECK = 0;
+ static int cCompressed = 0;
+ static decode_block *rgpdbDecodeBlocks[CPUS];
+--- lock.h
++++ lock.h
+@@ -64,7 +64,7 @@
+  *******************************************************************************
+  */
+-#if defined(ALPHA)
++#if defined(__alpha__)
+ #  include <machine/builtins.h>
+--- main.c
++++ main.c
+@@ -1,6 +1,10 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <fcntl.h>
++#include <unistd.h>
+ #include "chess.h"
+ #include "data.h"
+ #if defined(UNIX) || defined(AMIGA)
+@@ -3230,8 +3234,58 @@
+ #if !defined(UNIX)
+   char crafty_rc_file_spec[FILENAME_MAX];
+ #endif
+-/* Collect environmental variables */
+-  char *directory_spec = getenv("CRAFTY_BOOK_PATH");
++
++  char *directory_spec;
++
++/*
++ set log_path & rc_path to some reasonable value
++ create default .craftyrc
++*/
++ {
++   char l[128], *h = getenv("HOME");
++   struct stat st;
++   FILE *f;
++   
++   if(!h || strlen(h) > 100) h = "/tmp";
++   strcpy(rc_path, h);
++   sprintf(log_path, "%s/%s", h, ".crafty");
++
++   if(stat(log_path, &st) || !S_ISDIR(st.st_mode)) {
++     mkdir(log_path, 0755);
++   }
++
++   sprintf(l, "%s/.craftyrc", rc_path);
++   if(lstat(l, &st)) {
++     if((f = fopen(l, "w"))) {
++       fprintf(f, "egtb\n");
++       fclose(f);
++     }
++   }
++ }
++
++/*
++ set book_path to some reasonable value
++*/
++ {
++   char l[128], *h = getenv("HOME");
++   struct stat st;
++   
++   if(!h || strlen(h) > 100) h = "/tmp";
++   sprintf(book_path, "%s/%s", h, ".crafty");
++
++   if(stat(book_path, &st) || !S_ISDIR(st.st_mode)) {
++     mkdir(book_path, 0755);
++   }
++
++   sprintf(l, "%s/book.bin", book_path);
++   if(lstat(l, &st)) symlink("/usr/share/crafty/book.bin", l);
++
++   sprintf(l, "%s/books.bin", book_path);
++   if(lstat(l, &st)) symlink("/usr/share/crafty/books.bin", l);
++ }
++
++  /* Collect environmental variables */
++  directory_spec=getenv("CRAFTY_BOOK_PATH");
+ #if defined(NUMA) && defined(LINUX)
+   if (numa_available() >= 0) {
+--- Makefile
++++ Makefile
+@@ -72,8 +72,21 @@
+ #                     with the large egtb.cpp code/templates.
+ #   
++ARCH  = $(shell uname -m | sed -e 's/^i./i3/')
++
++opt   = -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS -DFAST -DDGT -DEGTB6
++
++# EGTB code seems to have problems with SMP
++ifneq ($(findstring $(ARCH),i386),)
++  opt += -O2 -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B # -DSMP -DCPUS=4
++  asm = X86-elf.o
++else
++  opt += -O # -DSMP -DCPUS=4 -DMUTEX
++  asm =
++endif
++
+ default:
+-      $(MAKE) -j linux-icc
++      $(MAKE) linux-suse
+ help:
+       @echo "You must specify the system which you want to compile for:"
+       @echo ""
+@@ -173,6 +186,15 @@
+               LDFLAGS='$(LDFLAGS) +O3 +Onolimit $(CFLAGS)' \
+               crafty-make
++linux-suse:
++      $(MAKE) target=LINUX \
++              CC=gcc CXX=g++ \
++              CFLAGS='$(CFLAGS) -Wall -pipe -D_REENTRANT' \
++              CXFLAGS='$(CFLAGS) \
++                      -fforce-mem -fomit-frame-pointer' \
++              LDFLAGS='$(LDFLAGS) -lpthread' \
++              crafty-make
++
+ linux:
+       $(MAKE) target=LINUX \
+               CC=gcc CXX=g++ \
+--- option.c
++++ option.c
+@@ -11,6 +11,8 @@
+ #endif
+ #include "epdglue.h"
++#define safe_strcpy(dst, src) strncpy(dst, src, sizeof dst - 1)[sizeof dst - 1] = 0
++
+ /* last modified 10/10/05 */
+ /*
+  *******************************************************************************
+@@ -843,7 +845,7 @@
+       char filename[256];
+       FILE *file;
+-      strcpy(filename, args[2]);
++      safe_strcpy(filename, args[2]);
+       strcat(filename, ".cpf");
+       file = fopen(filename, "w");
+       if (!file) {
+@@ -1129,7 +1131,7 @@
+     movenum = shared->move_number;
+     if (wtm)
+       movenum--;
+-    strcpy(text, args[1]);
++    safe_strcpy(text, args[1]);
+     sprintf(buffer, "reset %d", movenum);
+     wtm = Flip(wtm);
+     (void) Option(tree);
+@@ -1357,7 +1359,7 @@
+     char *readstat = (char *) -1;
+     int lines = 0;
+-    helpfile = fopen("crafty.hlp", "r");
++    helpfile = fopen("/usr/share/crafty/crafty.hlp", "r");
+     if (!helpfile) {
+       printf("ERROR.  Unable to open \"crafty.hlp\" -- help unavailable\n");
+       return (1);
+@@ -1858,7 +1860,7 @@
+       printf("file does not exist.\n");
+       return (1);
+     }
+-    strcpy(title, args[2]);
++    safe_strcpy(title, args[2]);
+     while (!feof(prob_file)) {
+       readstat = fgets(buffer, 128, prob_file);
+       if (readstat) {
+@@ -2154,10 +2156,10 @@
+       return (1);
+     }
+     if (wtm) {
+-      strcpy(pgn_white, args[1]);
++      safe_strcpy(pgn_white, args[1]);
+       sprintf(pgn_black, "Crafty %s", version);
+     } else {
+-      strcpy(pgn_black, args[1]);
++      safe_strcpy(pgn_black, args[1]);
+       sprintf(pgn_white, "Crafty %s", version);
+     }
+     Print(128, "Crafty %s vs %s\n", version, args[1]);
+@@ -2368,14 +2370,14 @@
+     }
+     if (!strchr(args[1], '(')) {
+       if (strstr(args[0], "bookpath"))
+-        strcpy(book_path, args[1]);
++        safe_strcpy(book_path, args[1]);
+       else if (strstr(args[0], "perspath"))
+-        strcpy(personality_path, args[1]);
++        safe_strcpy(personality_path, args[1]);
+       else if (strstr(args[0], "logpath"))
+-        strcpy(log_path, args[1]);
++        safe_strcpy(log_path, args[1]);
+ #if !defined(NOEGTB)
+       else if (strstr(args[0], "tbpath")) {
+-        strcpy(tb_path, args[1]);
++        safe_strcpy(tb_path, args[1]);
+         EGTBlimit = IInitializeTb(tb_path);
+         Print(128, "%d piece tablebase files found\n", EGTBlimit);
+         if (0 != cbEGTBCompBytes)
+@@ -2398,12 +2400,12 @@
+       if (strchr(args[1], ')')) {
+         *strchr(args[1], ')') = 0;
+         if (strstr(args[0], "bookpath"))
+-          strcpy(book_path, args[1] + 1);
++          safe_strcpy(book_path, args[1] + 1);
+         else if (strstr(args[0], "logpath"))
+-          strcpy(log_path, args[1] + 1);
++          safe_strcpy(log_path, args[1] + 1);
+ #if !defined(NOEGTB)
+         else if (strstr(args[0], "tbpath")) {
+-          strcpy(tb_path, args[1] + 1);
++          safe_strcpy(tb_path, args[1] + 1);
+           EGTBlimit = IInitializeTb(tb_path);
+           Print(128, "%d piece tablebase files found\n", EGTBlimit);
+           if (0 != cbEGTBCompBytes)
+--- speak
++++ speak
+@@ -4,13 +4,13 @@
+ #
+ # The program used for Sound Output
+-my $playprg   = "/usr/bin/esdplay";
++my $playprg   = "/usr/bin/play";
+ # Where the sound files are located
+-my $soundpath = "/opt/chess/sound";
++my $soundpath = "/usr/share/crafty/sound";
+ # Which language to use (each supported language is in a separate
+ # subdir of $soundpath)
+-my $language  = "english";
++my $language  = "en";
+ # The move sent by crafty
+ my $move      = $ARGV[0];
+@@ -18,11 +18,28 @@
+ # Set soundpath to the correct language
+ $soundpath = $soundpath . "/" . $language;
++%piece = (
++  'B' => 'Bishop',
++  'K' => 'King',
++  'N' => 'Knight',
++  'Q' => 'Queen',
++  'R' => 'Rook'
++);
++
++
++%moves = (
++  'O-O'        => '0-0',
++  'O-O-O'      => '0-0-0',
++  'Stalemate'  => 'Stalemate',
++  'Drawaccept' => 'Drawaccept',
++  'Drawoffer'  => 'Drawoffer',
++  'Resign'     => 'Resign'
++);
++
+ # First check some specials
+-if (($move =~ /O-O/) || ($move eq "Stalemate") ||
+-    ($move eq "Drawaccept") || ($move eq "Drawoffer") ||
+-    ($move eq "Resign") || ($move eq "Checkmate")) {
+-  system("$playprg $soundpath/$move.wav");
++
++if($moves{$move}) {
++  system("$playprg $soundpath/$moves{$move}.wav");
+ }
+ # Handle all normal moves. All that needs to be done is announce
+ # each character sent by crafty alone. Set some pause beteween each
+@@ -42,9 +59,14 @@
+ else {
+   for (my $i=0; $i<length($move); $i++) {
+     my $char = substr $move, $i, 1;
++
++    if($i == 0 && $char =~ /[a-h]/) {
++      system("$playprg $soundpath/Pawn.wav");
++    }
++
+     if ($char =~ /[^=]/) {
+       if ($char =~ /x/) {
+-        system("$playprg $soundpath/x.wav");
++        system("$playprg $soundpath/takes.wav");
+         system("usleep 400000");
+       }
+       elsif ($char =~ /#/) {
+@@ -53,9 +75,21 @@
+       elsif ($char =~ /\+/) {
+         system("$playprg $soundpath/Check.wav");
+       }
++      elsif ($char =~ /[1-8]/) {
++        system("$playprg $soundpath/${char}from.wav");
++      }
++      elsif ($char =~ /[a-h]/) {
++        system("$playprg $soundpath/\U${char}\Efrom.wav");
++      }
++      elsif ($char =~ /[QKNBR]/) {
++        system("$playprg $soundpath/$piece{$char}.wav");
++      }
+       else {
+         system("$playprg $soundpath/$char".".wav");
+       }
+     }
+   }
++
++  system("$playprg $soundpath/click.wav");
++
+ }
+--- utility.c
++++ utility.c
+@@ -133,10 +133,12 @@
+ float BookIn32f(unsigned char *ch)
+ {
+   int v1;
+-  float *v2 = (float *) &v1;
++  float v2;
+   v1 = (ch[3] << 24) | (ch[2] << 16) | (ch[1] << 8) | ch[0];
+-  return (*v2);
++  memcpy(&v2, &v1, sizeof v2);
++
++  return v2;
+ }
+ /*
+@@ -201,14 +203,15 @@
+  */
+ unsigned char *BookOut32f(float val)
+ {
+-  float v1;
+-  int *v2 = (int *) &v1;
++  int v2;
++
++  memcpy(&v2, &val, sizeof v2);
++
++  convert_buff[3] = (v2 >> 24) & 0xff;
++  convert_buff[2] = (v2 >> 16) & 0xff;
++  convert_buff[1] = (v2 >> 8) & 0xff;
++  convert_buff[0] = v2 & 0xff;
+-  v1 = val;
+-  convert_buff[3] = (*v2 >> 24) & 0xff;
+-  convert_buff[2] = (*v2 >> 16) & 0xff;
+-  convert_buff[1] = (*v2 >> 8) & 0xff;
+-  convert_buff[0] = *v2 & 0xff;
+   return (convert_buff);
+ }
+@@ -1547,14 +1550,16 @@
+   if (vb & shared->display_options)
+     vprintf(fmt, ap);
+   fflush(stdout);
++  va_end(ap);
++
+   if (shared->time_limit > 99 || shared->tc_time_remaining > 6000 || vb == 4095) {
+     va_start(ap, fmt);
+     if (log_file)
+       vfprintf(log_file, fmt, ap);
+     if (log_file)
+       fflush(log_file);
++    va_end(ap);
+   }
+-  va_end(ap);
+ }
+ char *PrintKM(size_t val, int realK)
index fc3c65369a6f8d7cc25a5298dea5baf01fa9c5d8..a2ac28c1091bab340e782b2116084ed649a3a33b 100644 (file)
@@ -1,12 +1,11 @@
-diff -burN crafty-18.9.orig/Makefile crafty-18.9/Makefile
---- crafty-18.9.orig/Makefile  2003-12-13 22:55:35.000000000 +0000
-+++ crafty-18.9/Makefile       2003-12-13 22:55:57.000000000 +0000
-@@ -368,7 +368,7 @@
-               crafty
+--- ./Makefile.org     2007-11-17 23:27:09.113833335 +0100
++++ ./Makefile 2007-11-17 23:27:53.999426624 +0100
+@@ -432,7 +432,7 @@ crafty-make:
+ crafty.o: *.c *.h
  
  crafty:       $(objects) 
 -      $(CC) $(LDFLAGS) -o crafty $(objects) -lm  $(LIBS)
 +      $(CXX) $(LDFLAGS) -o crafty $(objects) -lm  $(LIBS)
-       @rm -f X86-elf.S
-       @rm -f X86-aout.S
  
+ dgt:    dgtdrv.o
+       @cc -O -o dgt dgtdrv.c
index a531798e0b1437062d32d55a091f222f881d1154..a7026a825a3f6fb871a63a227e6d8083111c96ff 100644 (file)
@@ -1,19 +1,29 @@
-diff -urN crafty.orig/chess.h crafty-18.9/chess.h
---- crafty.orig/chess.h        2001-07-26 16:58:01.000000000 +0200
-+++ crafty-18.9/chess.h        2003-11-20 17:22:36.000000000 +0100
-@@ -190,13 +190,13 @@
- #  endif
+--- ./chess.h.org      2007-11-18 11:40:45.390602131 +0100
++++ ./chess.h  2007-11-18 11:42:18.652054921 +0100
+@@ -131,7 +131,7 @@
+ #  define UNIX          /* system is unix-based                       */
+ #endif
+ #if !defined(BOOKDIR)
+-#  define     BOOKDIR        "."
++#  define     BOOKDIR        "/usr/share/crafty"
+ #endif
+ #if !defined(PERSDIR)
+ #  define     PERSDIR        "."
+@@ -140,7 +140,7 @@
+ #  define      LOGDIR        "."
+ #endif
+ #if !defined(TBDIR)
+-#  define       TBDIR     "./TB"
++#  define       TBDIR     "/usr/share/crafty/TB"
+ #endif
+ #if !defined(RCDIR)
+ #  define       RCDIR        "."
+@@ -1072,7 +1072,7 @@ extern void WinFreeInterleaved(void *, s
+ #  include "inlinex86.h"
+ #endif
+ #if defined(UNIX)
+-#  define SPEAK "./speak "
++#  define SPEAK "/usr/bin/crafty-speak "
  #else
- #  if !defined(BOOKDIR)
--#    define     BOOKDIR        "."
-+#    define     BOOKDIR        "/usr/lib/games/crafty"
- #  endif
- #  if !defined(LOGDIR)
- #    define      LOGDIR        "."
- #  endif
- #  if !defined(TBDIR)
--#    define       TBDIR     "./TB"
-+#    define       TBDIR     "/usr/games/lib/crafty/TB"
- #  endif
- #  if !defined(RCDIR)
- #    define       RCDIR        "."
+ #  define SPEAK ".\\Speak.exe "
+ #endif
This page took 0.107093 seconds and 4 git commands to generate.