Hello,
Debian's gnubg package uses this patch to put the bearoff database in /var
rather than /usr. I don't see why this patch can't be included in upstream
gnubg, as /var does seem to be the right place to put this.

I wanted to open a discussion on this though, since I am not so familiar
with how the bearoff database is used exactly.

--

From: Russ Allbery <[email protected]>
Date: Sun, 26 Apr 2015 19:21:42 -0700
Subject: Support finding databases in /var as well as /usr

The bearoff database is built (optionally) at installation time
instead of included in the package, and the Debian package recommends
downloading additional packages into /var instead of /usr, since
modifying /usr or encouraging users to store files in it seems wrong
from an FHS perspective.  Patch gnubg to support finding databases in
/var as well as /usr.
---
 eval.c | 10 ++++++----
 util.h |  3 +++
 2 files changed, 9 insertions(+), 4 deletions(-)

--- gnubg.orig/eval.c
+++ gnubg/eval.c
@@ -651,7 +651,9 @@
             pbc1 = BearoffInit(NULL, BO_HEURISTIC, pfProgress);
 
         /* read two-sided db from gnubg.bd */
-        gnubg_bearoff = BuildFilename("gnubg_ts0.bd");
+        /* For Debian, load dynamic databases from /var/lib/gnubg
+           instead.  -- rra, 2008-02-16 */
+        gnubg_bearoff = BuildVarFilename("gnubg_ts0.bd");
         pbc2 = BearoffInit(gnubg_bearoff, BO_IN_MEMORY | BO_MUST_BE_TWO_SIDED, 
NULL);
         g_free(gnubg_bearoff);
 
@@ -664,12 +666,12 @@
                     "with the command: makebearoff -t 6x6 -f gnubg_ts0.bd\n"
                     "You can also generate other bearoff databases; see\n" 
"README for more details\n\n"));
 
-        gnubg_bearoff_os = BuildFilename("gnubg_os.bd");
+        gnubg_bearoff_os = BuildVarFilename("gnubg_os.bd");
         /* init one-sided db */
         pbcOS = BearoffInit(gnubg_bearoff_os, BO_IN_MEMORY | 
BO_MUST_BE_ONE_SIDED, NULL);
         g_free(gnubg_bearoff_os);
 
-        gnubg_bearoff = BuildFilename("gnubg_ts.bd");
+        gnubg_bearoff = BuildVarFilename("gnubg_ts.bd");
         /* init two-sided db */
         pbcTS = BearoffInit(gnubg_bearoff, BO_IN_MEMORY | 
BO_MUST_BE_TWO_SIDED, NULL);
         g_free(gnubg_bearoff);
@@ -680,7 +682,7 @@
             char *fn;
             char sz[10];
             sprintf(sz, "hyper%c.bd", i + '1');
-            fn = BuildFilename(sz);
+            fn = BuildVarFilename(sz);
             apbcHyper[i] = BearoffInit(fn, BO_IN_MEMORY, NULL);
             g_free(fn);
         }
--- gnubg.orig/util.h
+++ gnubg/util.h
@@ -35,6 +35,9 @@
 #define BuildFilename(file) g_build_filename(getPkgDataDir(), file, NULL)
 #define BuildFilename2(file1, file2) g_build_filename(getPkgDataDir(), file1, 
file2, NULL)
 
+/* Added for Debian -- rra, 2008-02-16 */
+#define BuildVarFilename(file) g_build_filename("/var/lib/gnubg", file, NULL)
+
 extern void PrintSystemError(const char *message);
 extern void PrintError(const char *message);
 extern FILE *GetTemporaryFile(const char *nameTemplate, char **retName);

Reply via email to