From c17ed205d7dbfe3ad08373c53f6f101925cc5dbc Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Thu, 12 Apr 2012 21:19:19 -0400 Subject: [PATCH] Added some framework for building the C libraries we need and running the program with the needed libraries available --- gnugo/configure | 4 +++- gnugo/configure.in | 4 +++- lib/goban.py | 2 +- pygo | 5 +++++ readme.markdown | 16 ++++++++++++++++ so_compile | 21 +++++++++++++++++++++ 6 files changed, 49 insertions(+), 3 deletions(-) create mode 100755 pygo create mode 100755 so_compile diff --git a/gnugo/configure b/gnugo/configure index b630cb9..67f94e1 100755 --- a/gnugo/configure +++ b/gnugo/configure @@ -4938,7 +4938,7 @@ fi if test $ac_cv_prog_glibconfig = yes;then glib_cflags=`glib-config --cflags` glib_libs=`glib-config --libs` - CPPFLAGS="$CPPFLAGS $glib_cflags -fPIC" + CPPFLAGS="$CPPFLAGS $glib_cflags" LIBS="$LIBS $glib_libs" for ac_func in g_vsnprintf do : @@ -5540,6 +5540,8 @@ fi #AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) +CPPFLAGS="$CPPFLAGS -fPIC" + ac_config_files="$ac_config_files Makefile interface/Makefile patterns/Makefile sgf/Makefile utils/Makefile engine/Makefile doc/Makefile regression/Makefile config.vc:config.vcin" cat >confcache <<\_ACEOF diff --git a/gnugo/configure.in b/gnugo/configure.in index 6d1e60a..e7c5e22 100644 --- a/gnugo/configure.in +++ b/gnugo/configure.in @@ -190,7 +190,7 @@ if test $ac_cv_func_vsnprintf = no; then if test $ac_cv_prog_glibconfig = yes;then glib_cflags=`glib-config --cflags` glib_libs=`glib-config --libs` - CPPFLAGS="$CPPFLAGS $glib_cflags -fPIC" + CPPFLAGS="$CPPFLAGS $glib_cflags" LIBS="$LIBS $glib_libs" AC_CHECK_FUNCS(g_vsnprintf) AC_CHECK_HEADERS(glib.h) @@ -586,5 +586,7 @@ dnl FIXME: dnl autoconf 2.50 recommends AC_CONFIG_FILES and AC_OUPUT dnl This however requires automake 1.4p2 or better +CPPFLAGS="$CPPFLAGS -fPIC" + AC_OUTPUT([Makefile interface/Makefile patterns/Makefile sgf/Makefile utils/Makefile engine/Makefile doc/Makefile regression/Makefile config.vc:config.vcin]) diff --git a/lib/goban.py b/lib/goban.py index 31095ed..70524ec 100644 --- a/lib/goban.py +++ b/lib/goban.py @@ -47,7 +47,7 @@ class Goban: def __init__(self): if not Goban.libboard: - Goban.libboard = CDLL('lib/libboard.so.0.0.0') + Goban.libboard = CDLL('lib/libboard.so') self.board = board_state() diff --git a/pygo b/pygo new file mode 100755 index 0000000..709636c --- /dev/null +++ b/pygo @@ -0,0 +1,5 @@ +#!/bin/sh +# +# A shell script for calling pygo with the right libraries + +LD_LIBRARY_PATH=lib/ ./pygo.py diff --git a/readme.markdown b/readme.markdown index b0d3849..aa2cfc6 100644 --- a/readme.markdown +++ b/readme.markdown @@ -11,3 +11,19 @@ You will need the following to run pygo: * pygame * SDL_ttf + + +### Installation + +pygo is currently designed to be run in-place. The only 'installation' we need is to run: + + ./so_compile + +to build the needed C libraries (from gnugo/). + + +### Running the program + +To run the program, use the wrapper script: + +./pygo diff --git a/so_compile b/so_compile new file mode 100755 index 0000000..a109576 --- /dev/null +++ b/so_compile @@ -0,0 +1,21 @@ +cd gnugo + +./configure +make + +cd patterns +gcc -shared -o libpatterns.so conn.o patterns.o apatterns.o dpatterns.o eyes.o influence.o barriers.o endgame.o aa_attackpat.o owl_attackpat.o owl_vital_apat.o owl_defendpat.o fusekipat.o fuseki9.o fuseki13.o fuseki19.o josekidb.o handipat.o oraclepat.o mcpat.o +mv libpatterns.so ../../lib/ +cd .. + +cd sgf +gcc -shared -o libsgf.so sgf_utils.o sgfnode.o sgftree.o +mv libsgf.so ../../lib/ +cd .. + +cd engine +gcc -shared -o libengine.so aftermath.o board.o boardlib.o breakin.o cache.o clock.o combination.o dragon.o endgame.o filllib.o fuseki.o genmove.o globals.o handicap.o hash.o influence.o interface.o matchpat.o montecarlo.o move_reasons.o movelist.o optics.o oracle.o owl.o persistent.o printutils.o readconnect.o reading.o semeai.o sgfdecide.o sgffile.o shapes.o showbord.o surround.o unconditional.o utils.o value_moves.o worm.o +mv libengine.so ../../lib/ +gcc -shared -L../../lib/ -lengine -lpatterns -lsgf -o libboard.so board.o boardlib.o hash.o printutils.o +mv libboard.so ../../lib/ +cd ..