Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Coudoin <bruno.coudoin@free.fr>2009-07-18 11:37:01 (GMT)
committer Bruno Coudoin <bruno.coudoin@free.fr>2009-07-19 21:54:25 (GMT)
commit1af78740eab098e64a57d99d4e507a22c20c3cb3 (patch)
tree2d244d4613a1b3bc72169198755adfe71103aa80
parent256b602fe90d68f54bbd2ede0c028b04350cd7f2 (diff)
Synced windows port with files from the GCOMPRIS_8_3 branch.
-rw-r--r--Makefile.mingw.in112
-rw-r--r--README.mingw36
-rw-r--r--config.h.mingw.in2
-rw-r--r--gcompris-installer.nsi.in10
-rw-r--r--global_win32.mak62
-rw-r--r--src/boards/Makefile.mingw19
-rw-r--r--src/boards/chess_windows.c1158
-rw-r--r--src/gcompris/Makefile.mingw49
-rw-r--r--src/libart_lgpl/Makefile.mingw103
-rw-r--r--src/libgnomecanvas/Makefile.mingw93
10 files changed, 1458 insertions, 186 deletions
diff --git a/Makefile.mingw.in b/Makefile.mingw.in
index b9a12fcb4..865ae96 100644
--- a/Makefile.mingw.in
+++ b/Makefile.mingw.in
@@ -12,78 +12,71 @@ GCOMPRIS_SRC = ./src/gcompris
GCOMPRIS_BOARDS = ./src/boards
GCOMPRIS_INSTALL_DIR = ./win32-install-dir
-GTK_TOP := /gtk
-GNUWIN32_TOP := /gnuwin32
-LIBXML2_TOP := /libxml2
-SDL_TOP := /sdl
-CANVAS_TOP := /gnomecanvas
-GNUCHESS_TOP := /gnuchess
-PYTHON_DLL := /c/WINDOWS/system32/python24.dll
-PYTHON_TOP := /c/Python24
-GNUCAP_TOP := /gnucap
-SQLITE_TOP := /sqlite
-
-MAKENSIS := "/c/Program Files/NSIS/makensis.exe"
+include global_win32.mak
# These will be copied in the win32-install-dir ready to be packaged.
-NEEDED_DLLS = $(GNUCHESS_TOP)/bin/pthreadGC.dll \
+NEEDED_DLLS = $(GNUCHESS_TOP)/bin/pthreadGC2.dll \
$(GNUCHESS_TOP)/bin/libreadline.dll \
- $(PYTHON_DLL) \
+ $(GNUCHESS_TOP)/bin/gnuchess.exe \
+ $(FONTCONFIG_TOP)/bin/libfontconfig-1.dll \
+ $(FREETYPE_TOP)/bin/freetype6.dll \
$(GNUCAP_TOP)/src/MSW/gnucap.exe \
$(GTK_TOP)/bin/gspawn-win32-helper.exe \
- $(GNUCHESS_TOP)/bin/gnuchess.exe \
- $(GNUWIN32_TOP)/bin/libintl-2.dll \
- $(GNUWIN32_TOP)/bin/libiconv-2.dll \
- $(CANVAS_TOP)/bin/libgnomecanvas-2-0.dll \
- $(SDL_TOP)/bin/SDL.dll \
- $(SDL_TOP)/bin/SDL_mixer.dll \
- $(LIBXML2_TOP)/bin/libxml2.dll \
- $(GTK_TOP)/bin/freetype6.dll \
$(GTK_TOP)/bin/intl.dll \
+ $(GTK_TOP)/bin/jpeg62.dll \
+ $(GTK_TOP)/bin/libatk-1.0-0.dll \
$(GTK_TOP)/bin/libcairo-2.dll \
- $(GTK_TOP)/bin/libpangocairo-1.0-0.dll \
- $(GTK_TOP)/bin/libart_lgpl_2-2.dll \
- $(GTK_TOP)/bin/freetype6.dll \
- $(GTK_TOP)/bin/libart_lgpl_2-2.dll \
+ $(GTK_TOP)/bin/libexpat.dll \
$(GTK_TOP)/bin/libgdk-win32-2.0-0.dll \
$(GTK_TOP)/bin/libgdk_pixbuf-2.0-0.dll \
$(GTK_TOP)/bin/libglib-2.0-0.dll \
$(GTK_TOP)/bin/libgmodule-2.0-0.dll \
$(GTK_TOP)/bin/libgobject-2.0-0.dll \
+ $(GTK_TOP)/bin/libgthread-2.0-0.dll \
+ $(GTK_TOP)/bin/libgtk-win32-2.0-0.dll \
$(GTK_TOP)/bin/libpango-1.0-0.dll \
- $(GTK_TOP)/bin/libpangowin32-1.0-0.dll \
+ $(GTK_TOP)/bin/libpangocairo-1.0-0.dll \
$(GTK_TOP)/bin/libpangoft2-1.0-0.dll \
- $(GTK_TOP)/bin/libgtk-win32-2.0-0.dll \
- $(GTK_TOP)/bin/libatk-1.0-0.dll \
- $(GTK_TOP)/bin/libfontconfig-1.dll \
+ $(GTK_TOP)/bin/libpangowin32-1.0-0.dll \
+ $(GTK_TOP)/bin/libgio-2.0-0.dll \
+ $(GTK_TOP)/bin/libpng12-0.dll \
$(GTK_TOP)/bin/zlib1.dll \
- $(GTK_TOP)/bin/libgthread-2.0-0.dll \
- $(GTK_TOP)/expat/bin/xmlparse.dll \
- $(GTK_TOP)/expat/bin/xmltok.dll \
- $(GTK_TOP)/bin/iconv.dll \
- $(GTK_TOP)/bin/intl.dll \
- $(GTK_TOP)/bin/libpng13.dll \
- $(GTK_TOP)/bin/jpeg62.dll \
- $(SQLITE_TOP)/sqlite3.dll \
- /c/WINDOWS/system32/msvcr71.dll
+ $(ICONV_TOP)/bin/iconv.dll \
+ $(LIBXML2_TOP)/bin/libxml2.dll \
+ $(MSVCR71_DLL) \
+ $(SDL_TOP)/bin/SDL.dll \
+ $(SDL_TOP)/bin/SDL_mixer.dll \
+ $(SDL_TOP)/bin/libogg-0.dll \
+ $(SDL_TOP)/bin/libvorbis-0.dll \
+ $(SDL_TOP)/bin/libvorbisfile-3.dll \
+ $(SQLITE_TOP)/sqlite3.dll
NEEDED_FILES = README \
README.mingw \
COPYING \
- Changelog
+ ChangeLog
##
##
-all:
- cp config.h.mingw config.h
+all: Makefile.mingw config.h
+ $(MAKE) -C ./src/libart_lgpl -f Makefile.mingw
+ $(MAKE) -C ./src/libgnomecanvas -f Makefile.mingw
$(MAKE) -C $(GCOMPRIS_BOARDS) -f Makefile.mingw
$(MAKE) -C $(GCOMPRIS_SRC) -f Makefile.mingw
+Makefile.mingw: Makefile.mingw.in
+ ./config.status Makefile.mingw
+
+config.h: config.h.mingw.in
+ ./config.status config.h.mingw
+ cp config.h.mingw config.h
+
+gcompris-installer.nsi: gcompris-installer.nsi.in
+ ./config.status gcompris-installer.nsi
-install: all
+install: all Makefile.mingw
mkdir -p $(GCOMPRIS_INSTALL_DIR)/share
- $(MAKE) -C $(GCOMPRIS_BOARDS) -f Makefile.mingw install
$(MAKE) -C $(GCOMPRIS_SRC) -f Makefile.mingw install
cp -r $(GCOMPRIS_BOARDS)/python $(GCOMPRIS_INSTALL_DIR)/share/gcompris
rm -f $(GCOMPRIS_INSTALL_DIR)/share/gcompris/python/Makefile*
@@ -96,7 +89,7 @@ install: all
# Copy mandratory files for the package in the package directory
-prepack:
+prepack: Makefile.mingw
mkdir -p $(GCOMPRIS_INSTALL_DIR)/GTK
cp $(NEEDED_DLLS) $(GCOMPRIS_INSTALL_DIR)
cp $(NEEDED_FILES) $(GCOMPRIS_INSTALL_DIR)
@@ -104,23 +97,25 @@ prepack:
mkdir -p $(GCOMPRIS_INSTALL_DIR)/GTK/share
cp -r $(GTK_TOP)/share/themes $(GCOMPRIS_INSTALL_DIR)/share
mkdir -p $(GCOMPRIS_INSTALL_DIR)/lib
- cp -r $(GTK_TOP)/lib/locale $(GCOMPRIS_INSTALL_DIR)/lib
+ cp -r $(GTK_TOP)/share/locale $(GCOMPRIS_INSTALL_DIR)/lib
cp -r $(GTK_TOP)/lib/gtk-2.0 $(GCOMPRIS_INSTALL_DIR)/lib
- cp -r $(GTK_TOP)/lib/pango $(GCOMPRIS_INSTALL_DIR)/lib
-python:
+python: Makefile.mingw
cp $(PYTHON_TOP)/DLLs/tcl84.dll $(GCOMPRIS_INSTALL_DIR)
cp $(PYTHON_TOP)/DLLs/tk84.dll $(GCOMPRIS_INSTALL_DIR)
+ cp $(PYTHON_TOP)/python24.dll $(GCOMPRIS_INSTALL_DIR)
cp tools/py2exe/gcompris.py $(GCOMPRIS_INSTALL_DIR)
cp tools/py2exe/setup.py $(GCOMPRIS_INSTALL_DIR)
cd $(GCOMPRIS_INSTALL_DIR);$(PYTHON_TOP)/python.exe setup.py py2exe;cp dist/library.zip python24.zip;cp dist/*.pyd .;rm -rf dist build;rm -f gcompris.py*;cd ..
rm -f $(GCOMPRIS_INSTALL_DIR)/tcl84.dll
rm -f $(GCOMPRIS_INSTALL_DIR)/tk84.dll
-installer:
+installer: Makefile.mingw gcompris-installer.nsi
$(MAKENSIS) gcompris-installer.nsi
-clean:
+clean: Makefile.mingw
+ $(MAKE) -C ./src/libart_lgpl -f Makefile.mingw clean
+ $(MAKE) -C ./src/libgnomecanvas -f Makefile.mingw clean
$(MAKE) -C $(GCOMPRIS_SRC) -f Makefile.mingw clean
$(MAKE) -C $(GCOMPRIS_BOARDS) -f Makefile.mingw clean
rm -rf config.h
@@ -129,11 +124,10 @@ clean:
#
# Run this on Linux to prepare datadir for windows
#
-prep:
- mkdir $(GCOMPRIS_INSTALL_DIR)
-
+prep: Makefile.mingw
+ mkdir -p $(GCOMPRIS_INSTALL_DIR)
mkdir -p $(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards
- cd boards ; tar cf - --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude .svn --exclude .xvpics * | ( cd ../$(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards ; tar xf -) ; cd .. ;
+ cd boards ; tar cf - --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude .svn * | ( cd ../$(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards ; tar xf -) ; cd .. ;
@echo "-------------------------------------------------------------------------------"
@echo " WARNING: MAKE SURE TO HAVE RUN A MAKE INSTALL OF GCOMPRIS IN /USR/LOCAL FIRST"
@echo "-------------------------------------------------------------------------------"
@@ -142,9 +136,13 @@ prep:
@echo "Remove other .mo file not from gcompris"
find ./win32-install-dir/share/locale/ -name \*.mo | grep -v gcompris.mo | xargs rm -f
@echo "Copy pixmap"
- mkdir $(GCOMPRIS_INSTALL_DIR)/share/pixmaps
+ mkdir -p $(GCOMPRIS_INSTALL_DIR)/share/pixmaps
cp gcompris.png $(GCOMPRIS_INSTALL_DIR)/share/pixmaps
@echo remove tuxpaint activity
rm -f $(GCOMPRIS_INSTALL_DIR)/share/$(pkgdatadir)/boards/tuxpaint.xml
- @echo "Create the file gcompris-win-prepack.tar.gz"
- tar --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude "Makefile" --exclude "Makefile.am" --exclude .svn --exclude .xvpics -czf gcompris-win-prepack.tar.gz win32-install-dir nsis tools Makefile.mingw config.h.mingw
+ find $(GCOMPRIS_INSTALL_DIR) -name "Makefile*" -exec rm -f {} \;
+ find $(GCOMPRIS_INSTALL_DIR) -name "*.in" -exec rm -f {} \;
+ find $(GCOMPRIS_INSTALL_DIR) -name "*~" -exec rm -f {} \;
+ cp -r nsis tools Makefile.mingw config.h.mingw $(GCOMPRIS_INSTALL_DIR)
+ mkdir -p $(GCOMPRIS_INSTALL_DIR)/nsis/translations
+ cp "/usr/share/nsis/Contrib/Language files"/* $(GCOMPRIS_INSTALL_DIR)/nsis/translations
diff --git a/README.mingw b/README.mingw
index ebc0861..550862c 100644
--- a/README.mingw
+++ b/README.mingw
@@ -55,36 +55,28 @@ Look at the NEEDED_DLLS section in the Makefile.mingw and make sure you have all
2.6 PREREQUISITE SUMMARY
========================
-* At this point, you must have the following subdirectories:
-GTK_TOP := /gtk
-GNUWIN32_TOP := /gnuwin32
-LIBXML2_TOP := /libxml2
-SDL_TOP := /sdl
-CANVAS_TOP := /gnomecanvas
-GNUCHESS_TOP := /gnuchess
-
+Check the file global_win32.mak to know which dependancies must
+be provided and where.
3: BUILDING GCOMPRIS.EXE
========================
-* On a GNU/Linux system, install gcompris in /usr/local to generate the translations
-* On a GNU/Linux system, create gcompris-win-prepack.tar.gz with:
- make -f Makefile.mingw prep
+* On GNU/Linux run make install to install the translations.
+ make -f Makefile.mingw prep - create the win32-install-dir
+ make -f Makefile.mingw - compilation step
+ make -f Makefile.mingw prepack - include all necessary libraries in the installer directory
+ make -f Makefile.mingw install - include the generated code in the installer directory
+
* Now on the windows system:
-* Get a tarball or CVS snapshot of gcompris.
-* untar the gcompris-win-prepack.tar.gz in it
-* Manual fix, replace chess.c by chess.c.windows
-* run: make -f Makefile.mingw from gcompris's top-level directory. This will take a long time.
-* run: make -f Makefile.mingw prepack to include all necessary libraries in the installer directory
-* run: make -f Makefile.mingw install to include the generated code in the installer directory
-* run: make -f Makefile.mingw python to created an embedded python interpreter
+ make -f Makefile.mingw python - create an embedded python interpreter
-the win32-install-dir should contain anything needed to run and package GCompris.
+* the win32-install-dir contains anything needed to run and package GCompris.
+ Back to GNU/Linux, create the installer:
+ make -f Makefile.mingw installer
-* run make -f Makefile.mingw installer to create the installer
The installer used is NSIS get it there:
http://nsis.sourceforge.net/Main_Page
- And install it in it's default /c/Program Files/NSIS/makensis.exe
-The GCompris package is created, double click on it from your file manager to test it.
+The GCompris package is created, double click on it from your file manager
+to test it.
diff --git a/config.h.mingw.in b/config.h.mingw.in
index c8251f3..9b941e2 100644
--- a/config.h.mingw.in
+++ b/config.h.mingw.in
@@ -139,3 +139,5 @@
/* Activation code is disabled */
/* #define DISABLE_ACTIVATION_CODE 1 */
+/* sdl mixer is enabled */
+#define USE_SDLMIXER
diff --git a/gcompris-installer.nsi.in b/gcompris-installer.nsi.in
index f0d5d3f..a8902a5 100644
--- a/gcompris-installer.nsi.in
+++ b/gcompris-installer.nsi.in
@@ -57,8 +57,8 @@ SetDateSave on
!define MUI_HEADERIMAGE_BITMAP ".\nsis\gcompris-header.bmp"
; Alter License section
- !define MUI_LICENSEPAGE_BUTTON $(GcomprisLicenseButton)
- !define MUI_LICENSEPAGE_TEXT_BOTTOM $(GcomprisLicenseBottomText)
+ !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
+ !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(^LicenseText)"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_ABORTWARNING
@@ -232,7 +232,7 @@ Section "GCompris" SecGcompris
WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R1\bin"
WriteRegStr HKLM ${GCOMPRIS_REG_KEY} "" "$INSTDIR"
WriteRegStr HKLM ${GCOMPRIS_REG_KEY} "Version" "${GCOMPRIS_VERSION}"
- WriteRegStr HKLM "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" $(GcomprisUninstallDesc)
+ WriteRegStr HKLM "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" "GCompris Uninstall"
WriteRegStr HKLM "${GCOMPRIS_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GCOMPRIS_UNINST_EXE}"
; Sets scope of the desktop and Start Menu entries for all users.
SetShellVarContext "all"
@@ -241,7 +241,7 @@ Section "GCompris" SecGcompris
gcompris_hkcu:
WriteRegStr HKCU ${GCOMPRIS_REG_KEY} "" "$INSTDIR"
WriteRegStr HKCU ${GCOMPRIS_REG_KEY} "Version" "${GCOMPRIS_VERSION}"
- WriteRegStr HKCU "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" $(GcomprisUninstallDesc)
+ WriteRegStr HKCU "${GCOMPRIS_UNINSTALL_KEY}" "DisplayName" "GCompris Uninstall"
WriteRegStr HKCU "${GCOMPRIS_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${GCOMPRIS_UNINST_EXE}"
Goto gcompris_install_files
@@ -422,7 +422,7 @@ SectionEnd ; end of uninstall section
;Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecGcompris} \
- $(GcomprisSectionDescription)
+ "Core GCompris files and dlls"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
diff --git a/global_win32.mak b/global_win32.mak
index 804ac8f..8d642bc 100644
--- a/global_win32.mak
+++ b/global_win32.mak
@@ -5,27 +5,24 @@
# wide definitions.
#
-#
-# PATHS
-#
+OS:=$(OS)
+
+ifeq ($(OS),)
+ CROSSCOMPILER=i586-mingw32msvc-
+else
+ CROSSCOMPILER=
+endif
-INCLUDE_DIR := .
-GTK_TOP := /gtk
-GLIB_TOP := /gtk
-GNUWIN32_TOP := /gtk
-LIBXML2_TOP := /libxml2
-GSTREAMER_TOP := /gtk
-PYTHON_TOP := /Python24
-CAIRO_TOP := /gtk
-CANVAS_TOP := /gnomecanvas
-GCOMPRIS_INSTALL_DIR := $(GCOMPRIS_TOP)/win32-install-dir
-SQLITE_TOP := /sqlite
-GNUCHESS_TOP := /gnuchess
-PYTHON_DLL := /c/WINDOWS/system32/python24.dll
-GNUCAP_TOP := /gnucap
-MAKENSIS := "/c/Program Files/NSIS/makensis.exe"
-
-CC = gcc.exe
+CC = $(CROSSCOMPILER)gcc
+AR = $(CROSSCOMPILER)ar
+RANLIB = $(CROSSCOMPILER)ranlib
+WINDRES = $(CROSSCOMPILER)windres
+
+ifneq ($(CROSSCOMPILER),)
+ GLIB_GENMARSHAL := glib-genmarshal
+else
+ GLIB_GENMARSHAL := $(GTK_TOP)/bin/glib-genmarshal.exe
+endif
# Use -g flag when building debug version of Gcompris (including plugins).
# Use -fnative-struct instead of -mms-bitfields when using mingw 1.1
@@ -41,3 +38,28 @@ CFLAGS += -g -Wall -mno-cygwin -mms-bitfields
DLL_LD_FLAGS += -Wl,--enable-auto-image-base
DEFINES += -DHAVE_CONFIG_H
+
+ifneq ($(CROSSCOMPILER),)
+ # CROSS COMPILATION
+ LOCAL_PREFIX:=/home/bruno/Projets/gcompris/windows
+ MSVCR71_DLL:=$(LOCAL_PREFIX)/msvcr71.dll
+ MAKENSIS:=makensis
+else
+ # MSYS CASE
+ LOCAL_PREFIX:=
+ MSVCR71_DLL:=/c/WINDOWS/system32/msvcr71.dll
+ MAKENSIS:="/c/Program Files/NSIS/makensis.exe"
+endif
+
+GTK_TOP := $(LOCAL_PREFIX)/gtk
+GLIB_TOP := $(LOCAL_PREFIX)/gtk
+CAIRO_TOP := $(LOCAL_PREFIX)/gtk
+LIBXML2_TOP := $(LOCAL_PREFIX)/libxml2
+SDL_TOP := $(LOCAL_PREFIX)/sdl
+GNUCHESS_TOP := $(LOCAL_PREFIX)/gnuchess
+PYTHON_TOP := $(LOCAL_PREFIX)/Python24
+GNUCAP_TOP := $(LOCAL_PREFIX)/gnucap
+SQLITE_TOP := $(LOCAL_PREFIX)/sqlite
+FONTCONFIG_TOP := $(LOCAL_PREFIX)/fontconfig
+ICONV_TOP := $(LOCAL_PREFIX)/iconv
+FREETYPE_TOP := $(LOCAL_PREFIX)/freetype
diff --git a/src/boards/Makefile.mingw b/src/boards/Makefile.mingw
index eff818b..ffa65cd 100644
--- a/src/boards/Makefile.mingw
+++ b/src/boards/Makefile.mingw
@@ -10,6 +10,9 @@
GCOMPRIS_PLUGINS := .
GCOMPRIS_TOP := ../..
+CANVAS_TOP := $(GCOMPRIS_TOP)/src/libgnomecanvas
+LIBART_TOP := $(GCOMPRIS_TOP)/src/libart_lgpl
+GCOMPRIS_INSTALL_DIR := $(GCOMPRIS_TOP)/win32-install-dir
##
## VARIABLE DEFINITIONS
@@ -39,27 +42,25 @@ INCLUDE_PATHS += -I$(GCOMPRIS_PLUGINS) \
-I$(GTK_TOP)/include/gtk-2.0 \
-I$(GLIB_TOP)/include/glib-2.0 \
-I$(GTK_TOP)/include/pango-1.0 \
- -I$(GTK_TOP)/include/atk-1.0 \
-I$(GLIB_TOP)/lib/glib-2.0/include \
-I$(GTK_TOP)/lib/gtk-2.0/include \
+ -I$(CANVAS_TOP) \
-I$(GTK_TOP)/include/atk-1.0 \
+ -I$(LIBART_TOP) \
-I$(GTK_TOP)/include/freetype2 \
-I$(LIBXML2_TOP)/include \
- -I$(GNUWIN32_TOP)/include \
-I$(GCOMPRIS_TOP) \
-I$(GCOMPRIS_TOP)/src \
-I$(CAIRO_TOP)/include/cairo \
-I$(PYTHON_TOP)/include \
-I$(PYTHON_TOP)/include/pygtk-2.0 \
-I$(SQLITE_TOP) \
- -I$(CANVAS_TOP)/include/libgnomecanvas-2.0 \
- -I$(CANVAS_TOP)/include/libart-2.0
+ -I$(ICONV_TOP)/include
LIB_PATHS = -L$(GTK_TOP)/lib \
-L$(LIBXML2_TOP)/lib \
- -L$(GNUWIN32_TOP)/lib \
-L$(SDL_TOP)/lib \
-L$(GCOMPRIS_TOP)/src/gcompris \
-L$(PYTHON_TOP)/lib
@@ -76,6 +77,8 @@ LIBS = -lgtk-win32-2.0 \
-lgmodule-2.0 \
-lgdk_pixbuf-2.0 \
-lpango-1.0 \
+ -lgnomecanvas-2 \
+ -lart_lgpl_2 \
-lpangoft2-1.0 \
-latk-1.0 \
-lpangowin32-1.0 \
@@ -108,6 +111,7 @@ PYTHON_C_SRC = \
canvas.c \
canvasmodule.c \
py-gcompris-board.c \
+ py-gcompris-boardconfig.c \
py-gcompris-properties.c \
py-gcompris-profile.c \
py-gcompris-wordlist.c \
@@ -130,7 +134,7 @@ BOARDS_C_SRC = \
algebra_guesscount.c \
awele.c awele_utils.c awele_alphaBeta.c \
canal_lock.c \
- chess.c chess_position.c chess_notation.c \
+ chess_windows.c chess_position.c chess_notation.c \
click_on_letter.c \
clickgame.c \
clockgame.c \
@@ -151,6 +155,7 @@ BOARDS_C_SRC = \
memory.c \
menu2.c \
missingletter.c \
+ missingletter_config.c \
money.c \
money_widget.c \
paratrooper.c \
@@ -194,7 +199,7 @@ libboards: \
libboards.a: $(BOARDS_OBJECTS)
-rm -f libboards.a
$(AR) cru libboards.a $(BOARDS_OBJECTS)
- ranlib libboards.a
+ $(RANLIB) libboards.a
##
## CLEAN RULES
diff --git a/src/boards/chess_windows.c b/src/boards/chess_windows.c
new file mode 100644
index 0000000..6570da0
--- /dev/null
+++ b/src/boards/chess_windows.c
@@ -0,0 +1,1158 @@
+/* gcompris - chess.c
+ *
+ * Copyright (C) 2002 Bruno Coudoin
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ctype.h>
+#include <math.h>
+#include <assert.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include "chess_notation.h"
+
+#include "gcompris/gcompris.h"
+
+#if defined _WIN32 || defined __WIN32__
+# undef WIN32 /* avoid warning on mingw32 */
+# define WIN32
+#endif
+
+#define SOUNDLISTFILE PACKAGE
+
+static GcomprisBoard *gcomprisBoard = NULL;
+static gboolean board_paused = TRUE;
+
+static GPid gnuchess_pid;
+static void start_board (GcomprisBoard *agcomprisBoard);
+static void pause_board (gboolean pause);
+static void end_board (void);
+static gboolean is_our_board (GcomprisBoard *gcomprisBoard);
+static void set_level (guint level);
+static int gamewon;
+static void game_won(void);
+
+static void engine_local_destroy (GPid gnuchess_pid);
+
+static gboolean engine_local_cb (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data);
+static gboolean engine_local_err_cb (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data);
+static void display_white_turn (gboolean whiteturn);
+static void display_info (gchar *info);
+static int get_square (double x, double y);
+static int get_square_from_coord (double x, double y);
+
+#define CHESSBOARD_X 50
+#define CHESSBOARD_Y 20
+#define SQUARE_WIDTH 60
+#define SQUARE_HEIGHT 60
+#define WHITE_COLOR 0xFFFF99FF
+#define BLACK_COLOR 0x9999FFFF
+#define WHITE_COLOR_H 0x99FF99FF
+#define BLACK_COLOR_H 0x99FF99FF
+
+#define TURN_X (BOARDWIDTH-(BOARDWIDTH-(CHESSBOARD_X+(SQUARE_WIDTH*8)))/2)
+#define TURN_Y (CHESSBOARD_Y+15)
+
+#define INFO_X TURN_X
+#define INFO_Y (TURN_Y+40)
+
+/* Game Type */
+#define COMPUTER 1
+#define PARTYEND 2
+#define MOVELEARN 3
+
+static char gameType = COMPUTER;
+
+static GnomeCanvasGroup *boardRootItem = NULL;
+
+static GIOChannel *read_chan;
+static GIOChannel *write_chan;
+
+static gint read_cb;
+static gint err_cb;
+
+static Position *position;
+
+/*
+ * Contains the squares structure
+ */
+typedef struct {
+ GnomeCanvasItem *square_item;
+ GnomeCanvasItem *piece_item;
+ Square square;
+} GSquare;
+
+static GSquare *currentHighlightedGsquare;
+
+static GnomeCanvasItem *turn_item = NULL;
+static GnomeCanvasItem *info_item = NULL;
+
+/* Need more space to fit notation.h definition */
+static GSquare *chessboard[100];
+
+static GnomeCanvasItem *chess_create_item(GnomeCanvasGroup *parent);
+static void chess_destroy_all_items(void);
+static void chess_next_level(void);
+static gint item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data);
+static gint item_event_black(GnomeCanvasItem *item, GdkEvent *event, gpointer data);
+static gboolean start_child (char *cmd,
+ GIOChannel **read_chan,
+ GIOChannel **write_chan,
+ GPid *gnuchess_pid);
+
+static void write_child (GIOChannel *write_chan,
+ char *format,
+ ...);
+
+
+/* Description of this plugin */
+static BoardPlugin menu_bp =
+ {
+ NULL,
+ NULL,
+ "Learning Chess",
+ "Play chess against tux in a learning mode",
+ "Bruno Coudoin <bruno.coudoin@free.fr>",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ start_board,
+ pause_board,
+ end_board,
+ is_our_board,
+ NULL,
+ NULL,
+ set_level,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+
+/*
+ * Main entry point mandatory for each Gcompris's game
+ * ---------------------------------------------------
+ *
+ */
+
+GET_BPLUGIN_INFO(chess)
+
+/*
+ * in : boolean TRUE = PAUSE : FALSE = CONTINUE
+ *
+ */
+static void pause_board (gboolean pause)
+{
+ if(gcomprisBoard==NULL)
+ return;
+
+ if(gamewon == TRUE && pause == FALSE) /* the game is won */
+ {
+ game_won();
+ }
+
+ board_paused = pause;
+}
+
+/*
+ */
+static void start_board (GcomprisBoard *agcomprisBoard)
+{
+
+#ifndef WIN32
+ if (!g_file_test (GNUCHESS, G_FILE_TEST_EXISTS)) {
+
+ gc_dialog(_("Error: The external program gnuchess is mandatory\nto play chess in gcompris.\nFind this program on http://www.rpmfind.net or in your\nGNU/Linux distribution\nAnd check it is located here: "GNUCHESS), gc_board_end);
+
+ return;
+ }
+#endif
+
+ if(agcomprisBoard!=NULL)
+ {
+
+ gcomprisBoard=agcomprisBoard;
+
+ /* Default mode */
+ if(!gcomprisBoard->mode)
+ gameType=COMPUTER;
+ else if(g_strncasecmp(gcomprisBoard->mode, "computer", 1)==0)
+ gameType=COMPUTER;
+ else if(g_strncasecmp(gcomprisBoard->mode, "partyend", 1)==0)
+ gameType=PARTYEND;
+ else if(g_strncasecmp(gcomprisBoard->mode, "movelearn", 1)==0)
+ gameType=MOVELEARN;
+
+ gcomprisBoard->level=1;
+ gcomprisBoard->maxlevel=1;
+ gcomprisBoard->sublevel=1;
+ gcomprisBoard->number_of_sublevel=1; /* Go to next level after this number of 'play' */
+
+ switch(gameType)
+ {
+ case PARTYEND:
+ case MOVELEARN:
+ gcomprisBoard->maxlevel=9;
+ gc_bar_set(GC_BAR_LEVEL);
+ break;
+ default:
+ gc_bar_set(0);
+ }
+
+ if(start_child (GNUCHESS, &read_chan,
+ &write_chan, &gnuchess_pid)==FALSE) {
+ gc_dialog(_("Error: The external program gnuchess is mandatory\nto play chess in gcompris.\nFind this program on http://www.rpmfind.net or in your\nGNU/Linux distribution\nAnd check it is in "GNUCHESS), gc_board_end);
+ return;
+ }
+
+ read_cb = g_io_add_watch (read_chan, G_IO_IN,
+ engine_local_cb, NULL);
+ err_cb = g_io_add_watch (read_chan, G_IO_HUP,
+ engine_local_err_cb, NULL);
+
+ write_child (write_chan, "xboard\n");
+ write_child (write_chan, "protover 2\n");
+ write_child (write_chan, "post\n");
+ write_child (write_chan, "easy\n");
+ write_child (write_chan, "level 100 1 0\n");
+ write_child (write_chan, "depth 1\n");
+
+ chess_next_level();
+
+ gamewon = FALSE;
+ pause_board(FALSE);
+ }
+}
+
+/* ======================================= */
+static void end_board ()
+{
+ if(gcomprisBoard!=NULL)
+ {
+ pause_board(TRUE);
+ chess_destroy_all_items();
+ }
+ gcomprisBoard = NULL;
+
+ turn_item = NULL;
+ info_item = NULL;
+
+
+ engine_local_destroy(gnuchess_pid);
+}
+
+/* ======================================= */
+static void set_level (guint level)
+{
+
+ if(gcomprisBoard!=NULL)
+ {
+ gcomprisBoard->level=level;
+ gcomprisBoard->sublevel=1;
+ chess_next_level();
+ }
+}
+/* ======================================= */
+static gboolean is_our_board (GcomprisBoard *gcomprisBoard)
+{
+ if (gcomprisBoard)
+ {
+ if(g_strcasecmp(gcomprisBoard->type, "chess")==0)
+ {
+ /* Set the plugin entry */
+ gcomprisBoard->plugin=&menu_bp;
+
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*-------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------*/
+/* set initial values for the next level */
+static void chess_next_level()
+{
+ register Square square;
+ register gshort rank;
+
+ gc_set_background(gnome_canvas_root(gcomprisBoard->canvas),
+ gc_skin_image_get("gcompris-bg.jpg"));
+
+ gc_bar_set_level(gcomprisBoard);
+
+ chess_destroy_all_items();
+ gamewon = FALSE;
+
+ /* Initial position */
+ position = POSITION (position_new_initial ());
+
+ switch(gameType)
+ {
+ case PARTYEND:
+ position_set_initial_partyend(position, gcomprisBoard->level);
+ break;
+ case MOVELEARN:
+ position_set_initial_movelearn(position, gcomprisBoard->level);
+ break;
+ }
+ /* Init our internal chessboard */
+ for (rank = 1; rank <= 8; rank++) {
+ for (square = A1 + ((rank - 1) * 10);
+ square <= H1 + ((rank - 1) * 10);
+ square++) {
+
+ GSquare *gsquare;
+
+ gsquare = g_malloc(sizeof(GSquare));
+
+ chessboard[square] = gsquare;
+ chessboard[square]->piece_item = NULL;
+ chessboard[square]->square = square;
+
+ }
+ }
+
+ /* Try the next level */
+ chess_create_item(gnome_canvas_root(gcomprisBoard->canvas));
+}
+
+/* ==================================== */
+/* Destroy all the items */
+static void chess_destroy_all_items()
+{
+ register Square square;
+ register gshort rank;
+
+ if(boardRootItem!=NULL)
+ gtk_object_destroy (GTK_OBJECT(boardRootItem));
+
+ boardRootItem = NULL;
+ turn_item = NULL;
+ info_item = NULL;
+
+ if(position!=NULL)
+ gtk_object_destroy (GTK_OBJECT (position));
+
+ position = NULL;
+
+ for (rank = 1; rank <= 8; rank++) {
+ for (square = A1 + ((rank - 1) * 10);
+ square <= H1 + ((rank - 1) * 10);
+ square++) {
+
+ if(chessboard[square]!=NULL)
+ {
+ g_free(chessboard[square]);
+ chessboard[square]=NULL;
+ }
+ }
+ }
+}
+
+/* ==================================== */
+static GnomeCanvasItem *chess_create_item(GnomeCanvasGroup *parent)
+{
+ guint color;
+ GnomeCanvasItem *item = NULL;
+ Square square;
+ Piece piece;
+ gshort rank;
+ gboolean white_side = TRUE;
+ guint empty_case = 0;
+ gboolean need_slash = TRUE;
+
+ boardRootItem = GNOME_CANVAS_GROUP(
+ gnome_canvas_item_new (gnome_canvas_root(gcomprisBoard->canvas),
+ gnome_canvas_group_get_type (),
+ "x", (double) 0,
+ "y", (double) 0,
+
+ NULL));
+
+ for (rank = 1; rank <= 8; rank++) {
+ for (square = A1 + ((rank - 1) * 10);
+ square <= H1 + ((rank - 1) * 10);
+ square++) {
+ int x,y;
+
+ x = square % 10 - 1;
+ y = square / 10 - 2;
+
+ color=((x+y)%2?BLACK_COLOR:WHITE_COLOR);
+
+ item = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_rect_get_type (),
+ "x1", (double) CHESSBOARD_X + (x * SQUARE_WIDTH),
+ "y1", (double) CHESSBOARD_Y + ((7-y) * SQUARE_HEIGHT),
+ "x2", (double) CHESSBOARD_X + (x * SQUARE_WIDTH) + SQUARE_WIDTH -1,
+ "y2", (double) CHESSBOARD_Y + ((7-y) * SQUARE_HEIGHT) + SQUARE_HEIGHT -1,
+ "fill_color_rgba", color,
+ "outline_color", "black",
+ "width_units", (double)2,
+ NULL);
+ chessboard[square]->square_item = item;
+ }
+ }
+
+ /* Enter the gnuchess edit mode */
+ write_child (write_chan, "force\n");
+ write_child (write_chan, "new\n");
+ write_child (write_chan, "setboard ");
+
+ empty_case = 0;
+ need_slash = FALSE;
+
+ /* Display the pieces */
+ for (rank = 8; rank >= 1; rank--) {
+ for (square = A1 + ((rank - 1) * 10);
+ square <= H1 + ((rank - 1) * 10);
+ square++)
+ {
+ GdkPixbuf *pixmap = NULL;
+ char *str;
+ gint x, y;
+ char *temp;
+ char *san;
+
+ piece = position->square[square];
+
+ x = square % 10 - 1;
+ y = square / 10 - 2;
+
+ /* Destination square */
+ san = g_new0 (char, 12);
+ temp = san;
+ square_to_ascii (&temp, square);
+ // printf ( "%c%s\n", piece_to_ascii(piece), san);
+
+ if(need_slash)
+ {
+ write_child (write_chan, "/");
+ need_slash = FALSE;
+ }
+
+ if(piece!=NONE)
+ {
+
+ if( (white_side && BPIECE(piece)) ||
+ (!white_side && WPIECE(piece)) )
+ {
+ white_side = !white_side;
+ // write_child (write_chan, "c\n");
+ }
+ if(empty_case>0)
+ write_child (write_chan, "%d", empty_case);
+
+ empty_case=0;
+
+ write_child (write_chan, "%c", piece_to_ascii(piece));
+ }
+ else
+ {
+ empty_case++;
+ }
+
+ if(x==7)
+ {
+ if(empty_case>0)
+ write_child (write_chan, "%d", empty_case);
+
+ empty_case=0;
+
+ need_slash = TRUE;
+ }
+
+ temp = san;
+ san = g_strdup (temp);
+ g_free (temp);
+
+ // printf("square=%d piece=%d x=%d y=%d\n", square, piece, x, y);
+ if(piece != EMPTY)
+ {
+ if(BPIECE(piece))
+ str = g_strdup_printf("chess/B%c.png", piece_to_ascii(piece));
+ else
+ str = g_strdup_printf("chess/W%c.png", piece_to_ascii(piece));
+
+ pixmap = gc_pixmap_load(str);
+ // g_warning("loading piece %s\n", str);
+ g_free(str);
+ item = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_pixbuf_get_type (),
+ "pixbuf", pixmap,
+ "x", (double)CHESSBOARD_X + (x * SQUARE_WIDTH) +
+ (guint)((SQUARE_WIDTH-gdk_pixbuf_get_width(pixmap))/2),
+ "y", (double) CHESSBOARD_Y + ((7-y) * SQUARE_HEIGHT) +
+ (guint)((SQUARE_HEIGHT-gdk_pixbuf_get_height(pixmap))/2),
+ NULL);
+
+ chessboard[square]->piece_item = item;
+ if(WPIECE(piece))
+ gtk_signal_connect(GTK_OBJECT(item), "event",
+ (GtkSignalFunc) item_event, NULL);
+ else
+ gtk_signal_connect(GTK_OBJECT(item), "event",
+ (GtkSignalFunc) item_event_black, NULL);
+
+ gdk_pixbuf_unref(pixmap);
+ }
+ }
+ }
+
+ /* Quit the gnuchess edit mode */
+ write_child (write_chan, " w KQkq\n");
+
+ display_white_turn(TRUE);
+
+ return NULL;
+}
+/* ==================================== */
+static void game_won()
+{
+ gcomprisBoard->sublevel++;
+
+ if(gcomprisBoard->sublevel>gcomprisBoard->number_of_sublevel) {
+ /* Try the next level */
+ gcomprisBoard->sublevel=1;
+ gcomprisBoard->level++;
+ if(gcomprisBoard->level>gcomprisBoard->maxlevel) { // the current board is finished : bail out
+ gc_bonus_end_display(GC_BOARD_FINISHED_RANDOM);
+ return;
+ }
+ gc_sound_play_ogg ("sounds/bonus.ogg", NULL);
+ }
+ chess_next_level();
+}
+
+static void display_white_turn(gboolean whiteturn)
+{
+
+ if(turn_item == NULL)
+ {
+
+ turn_item = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", " ",
+ "font", gc_skin_font_board_big,
+ "x", (double) TURN_X,
+ "y", (double) TURN_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color_rgba", gc_skin_color_content,
+ NULL);
+ }
+
+ gnome_canvas_item_set(turn_item, "text", (whiteturn ? _("White's Turn") : _("Black's Turn")),
+ NULL);
+}
+
+
+static void display_info(gchar *info)
+{
+
+ if(info_item == NULL)
+ {
+ info_item = gnome_canvas_item_new (boardRootItem,
+ gnome_canvas_text_get_type (),
+ "text", " ",
+ "font", gc_skin_font_board_big,
+ "x", (double) INFO_X,
+ "y", (double) INFO_Y,
+ "anchor", GTK_ANCHOR_CENTER,
+ "fill_color_rgba", gc_skin_color_subtitle,
+ NULL);
+ }
+
+ gnome_canvas_item_set(info_item, "text", info,
+ NULL);
+}
+
+
+/*
+ * Move a piece to the given position using chess_notation notation
+ *
+ */
+static void move_piece_to(Square from, Square to)
+{
+ GSquare *source_square, *dest_square;
+ GnomeCanvasItem *item;
+ guint x, y;
+ double ofset_x, ofset_y;
+ double x1, y1, x2, y2;
+ Piece piece = NONE;
+
+
+ g_warning("move_piece_to from=%d to=%d\n", from, to);
+
+ source_square = chessboard[from];
+ item = source_square->piece_item;
+ source_square->piece_item = NULL;
+
+ if(item == NULL)
+ {
+ g_warning("Warning: Problem in chess.c, bad move request in move_piece_to\n");
+ return;
+ }
+
+ /* If we are promoting a pawn */
+ if(position_get_color_to_move(position)==BLACK)
+ {
+ if (to & 128) {
+ piece = ((to & 127) >> 3 ) + WP - 1;
+ to = (to & 7) + A8;
+ printf(" Promoting white piece to %d\n", piece);
+ }
+ }
+ else
+ {
+ if (to & 128) {
+ piece = ((to & 127) >> 3) + BP - 1;
+ to = (to & 7) + A1;
+ printf(" Promoting black piece to %d\n", piece);
+ }
+ }
+
+ /* Show the moved piece */
+ gnome_canvas_item_set(source_square->square_item,
+ "outline_color",
+ (BPIECE(position->square[to])?"red":"blue"),
+ NULL);
+
+ display_white_turn(BPIECE(position->square[to]));
+
+ x = to % 10;
+ y = to / 10 -1;
+
+ g_warning(" move_piece_to to x=%d y=%d\n", x, y);
+
+ dest_square = chessboard[to];
+
+ /* Show the moved piece */
+ gnome_canvas_item_set(dest_square->square_item,
+ "outline_color",
+ (BPIECE(position->square[to])?"red":"blue"),
+ NULL);
+
+ if(dest_square->piece_item != NULL)
+ /* Oups I loose a piece */
+ gtk_object_destroy (GTK_OBJECT(dest_square->piece_item));
+
+ dest_square->piece_item = item;
+
+ /* Find the ofset to move the piece */
+ gnome_canvas_item_get_bounds (item,
+ &x1,
+ &y1,
+ &x2,
+ &y2);
+
+
+ ofset_x = (CHESSBOARD_X + SQUARE_WIDTH * (x-1)) - x1 + (SQUARE_WIDTH - (x2-x1))/2;
+ ofset_y = (CHESSBOARD_Y + SQUARE_HEIGHT * (8-y)) - y1 + (SQUARE_HEIGHT - (y2-y1))/2;
+
+ gnome_canvas_item_move(item, ofset_x, ofset_y);
+
+ /* Manage rock */
+ if(position->square[to]==WK && from==E1 && to==C1)
+ move_piece_to(A1, D1);
+ else if(position->square[to]==WK && from==E1 && to==G1)
+ move_piece_to(H1, F1);
+ else if(position->square[to]==BK && from==E8 && to==C8)
+ move_piece_to(A8, D8);
+ else if(position->square[to]==BK && from==E8 && to==G8)
+ move_piece_to(H8, F8);
+
+ /* Manage promotion */
+ if(piece != NONE)
+ {
+ GdkPixbuf *pixmap = NULL;
+ char *str;
+ g_warning(" WARNING promoting a pawn from=%d to=%d piece=%d\n", from, to, piece);
+ g_warning(" piece_to_ascii returns %c\n", piece_to_ascii(piece));
+
+ if(BPIECE(piece))
+ str = g_strdup_printf("chess/B%c.png", piece_to_ascii(piece));
+ else
+ str = g_strdup_printf("chess/W%c.png", piece_to_ascii(piece));
+
+ pixmap = gc_pixmap_load(str);
+ g_free(str);
+ g_warning("loading piece %c\n", piece_to_ascii(piece));
+ gnome_canvas_item_set (dest_square->piece_item,
+ "pixbuf", pixmap,
+ NULL);
+
+ }
+
+ /* Display check info */
+ if(position_white_king_attack(position))
+ display_info(_("White checks"));
+ else if(position_black_king_attack(position))
+ display_info(_("Black checks"));
+ else
+ display_info(" ");
+
+}
+
+/*
+ * Return a square suitable for position functions
+ */
+static int
+get_square (double x, double y)
+{
+
+ return (A1 + (Square) (x-1)
+ + 10 * (Square)(y-1));
+
+}
+
+/*
+ * Return a square suitable for position functions
+ */
+static int
+get_square_from_coord (double x, double y)
+{
+
+ return (A1 + (Square) ((x - CHESSBOARD_X) / SQUARE_WIDTH)
+ + 10 * (7 - (Square)((y - CHESSBOARD_Y) / SQUARE_HEIGHT)));
+
+}
+
+void hightlight_possible_moves(GSquare *gsquare)
+{
+ Square square_test;
+ guint color;
+ register Square square;
+ register gshort rank;
+ short current_color;
+
+ if(currentHighlightedGsquare == gsquare)
+ return;
+
+ /* Remember the current color to move */
+ current_color = position_get_color_to_move(position);
+
+ if(WPIECE(position->square[gsquare->square]))
+ position_set_color_to_move(position, WHITE);
+ else
+ position_set_color_to_move(position, BLACK);
+
+ for (rank = 1; rank <= 8; rank++) {
+ for (square = A1 + ((rank - 1) * 10);
+ square <= H1 + ((rank - 1) * 10);
+ square++) {
+
+
+ square_test = position_move_normalize (position, gsquare->square, chessboard[square]->square);
+
+ if (square_test)
+ {
+ color=((rank+square)%2?BLACK_COLOR_H:WHITE_COLOR_H);
+
+ gnome_canvas_item_set(chessboard[square]->square_item,
+ "fill_color_rgba", color,
+ "outline_color", "black",
+ NULL);
+ }
+ else
+ {
+ color=((rank+square)%2?BLACK_COLOR:WHITE_COLOR);
+
+ gnome_canvas_item_set(chessboard[square]->square_item,
+ "fill_color_rgba", color,
+ "outline_color", "black",
+ NULL);
+ }
+ }
+ }
+
+ /* Set back the current color to move */
+ position_set_color_to_move(position, current_color);
+
+ /* Show the current piece */
+ gnome_canvas_item_set(gsquare->square_item,
+ "outline_color",
+ (BPIECE(position->square[gsquare->square])?"red":"blue"),
+ NULL);
+
+}
+
+/* ==================================== */
+static gint
+item_event(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
+{
+ static double x, y;
+ static GSquare *gsquare;
+ double new_x, new_y;
+ GdkCursor *fleur;
+ static int dragging;
+ double item_x, item_y;
+
+ if(board_paused)
+ return FALSE;
+
+ item_x = event->button.x;
+ item_y = event->button.y;
+ gnome_canvas_item_w2i(item->parent, &item_x, &item_y);
+
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ {
+ guint x1, y1;
+ Square square;
+
+ square = get_square_from_coord(event->button.x, event->button.y);
+ x1 = square % 10;
+ y1 = square / 10 -1;
+ gsquare = chessboard[square];
+
+ x = item_x;
+ y = item_y;
+
+ fleur = gdk_cursor_new(GDK_FLEUR);
+ gnome_canvas_item_raise_to_top(item);
+ gnome_canvas_item_grab(item,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ fleur,
+ event->button.time);
+ gdk_cursor_destroy(fleur);
+ dragging = TRUE;
+
+ hightlight_possible_moves(gsquare);
+ }
+ break;
+ case GDK_MOTION_NOTIFY:
+ if (dragging && (event->motion.state & GDK_BUTTON1_MASK))
+ {
+ new_x = item_x;
+ new_y = item_y;
+
+ gnome_canvas_item_move(item, new_x - x, new_y - y);
+ x = new_x;
+ y = new_y;
+ }
+ break;
+
+ case GDK_BUTTON_RELEASE:
+ if(dragging)
+ {
+ guint x, y;
+ double ofset_x, ofset_y;
+ double x1, y1, x2, y2;
+ char pos[6];
+ Square to;
+
+ to = get_square_from_coord(event->button.x, event->button.y);
+ g_warning("===== Source square = %d Destination square = %d\n", gsquare->square,
+ to);
+
+ to = position_move_normalize (position, gsquare->square, to);
+ if (to) {
+ position_move (position, gsquare->square, to);
+
+ x = 1 + (event->button.x - CHESSBOARD_X) / SQUARE_WIDTH;
+ y = 1 + (event->button.y - CHESSBOARD_Y) / SQUARE_HEIGHT;
+ move_to_ascii((char *)&pos, gsquare->square, to);
+
+ /* Tell gnuchess what our move is */
+ write_child (write_chan, (char *)&pos);
+ write_child (write_chan, "\n");
+ move_piece_to(gsquare->square, to);
+ }
+ else
+ {
+ g_warning("====== MOVE from %d REFUSED\n", gsquare->square);
+
+ /* Find the ofset to move the piece back to where it was*/
+ gnome_canvas_item_get_bounds (item,
+ &x1,
+ &y1,
+ &x2,
+ &y2);
+
+ x = gsquare->square % 10;
+ y = gsquare->square / 10 -1;
+
+ ofset_x = (CHESSBOARD_X + SQUARE_WIDTH * (x-1)) - x1 + (SQUARE_WIDTH - (x2-x1))/2;
+ ofset_y = (CHESSBOARD_Y + SQUARE_HEIGHT * (8-y)) - y1 + (SQUARE_HEIGHT - (y2-y1))/2;
+ g_warning("ofset = x=%f y=%f\n", ofset_x, ofset_y);
+
+ gnome_canvas_item_move(item, ofset_x, ofset_y);
+ }
+
+ gnome_canvas_item_ungrab(item, event->button.time);
+ dragging = FALSE;
+
+ position_display(position);
+
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+/* ==================================== */
+/* The user clicked on a black piece */
+static gint
+item_event_black(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
+{
+ static GSquare *gsquare;
+
+ if(board_paused)
+ return FALSE;
+
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ {
+ Square square;
+
+ square = get_square_from_coord(event->button.x, event->button.y);
+ gsquare = chessboard[square];
+
+ hightlight_possible_moves(gsquare);
+ }
+ break;
+ default:
+ break;
+ }
+ return(FALSE);
+}
+
+/*======================================================================*/
+/*======================================================================*/
+/*======================================================================*/
+/*======================================================================*/
+static void
+engine_local_destroy (GPid gnuchess_pid)
+{
+
+ g_warning("engine_local_destroy () \n");
+ write_child (write_chan, "quit\n");
+
+ g_source_remove(read_cb);
+ g_source_remove(err_cb);
+
+ g_io_channel_close (read_chan);
+ g_io_channel_unref (read_chan);
+
+ g_io_channel_close (write_chan);
+ g_io_channel_unref (write_chan);
+
+ if(gnuchess_pid)
+ g_spawn_close_pid(gnuchess_pid);
+}
+
+static gboolean
+engine_local_cb (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ static char buf[1024];
+ static char *b=buf;
+
+ char *p,*q;
+ ssize_t len;
+
+ g_io_channel_read (read_chan, b, sizeof (buf) - 1 - (b - buf), &len);
+
+ if (len > 0) {
+ b[len] = 0;
+ b += len;
+ }
+
+ while (1) {
+ char tmp;
+
+ q = strchr (buf,'\n');
+ if (q == NULL) break;
+ tmp = *(q+1);
+ *(q+1) = '\0';
+
+ *q='\0';
+ *(q+1) = tmp;
+
+ g_warning("engine_local_cb read=%s\n", buf);
+
+ /* parse for NUMBER ... MOVE */
+ if (isdigit (*buf))
+ {
+ if ((p = strstr (buf, "...")))
+ {
+ Square from, to;
+
+ g_warning("computer number moves to %s\n", p+4);
+
+ if (san_to_move (position, p+4, &from, &to))
+ ascii_to_move (position, p+4, &from, &to);
+
+ position_move (position, from, to);
+ move_piece_to(from , to);
+ }
+ else if ((p = strstr (buf, " ")))
+ {
+ /* It's a legal move case */
+ g_warning("Legal move to %s\n", p+1);
+ }
+ }
+
+ /* parse for move MOVE */
+ if (!strncmp ("My move is : ",buf,13))
+ {
+ Square from, to;
+
+ p = strstr (buf, ":");
+ printf("computer moves to %s\n", p+1);
+
+ if (san_to_move (position, p+1, &from, &to))
+ ascii_to_move (position, p+1, &from, &to);
+
+ position_move (position, from, to);
+ move_piece_to(from , to);
+ }
+
+ /* parse for illegal move */
+ if (!strncmp ("Illegal move",buf,12))
+ {
+ g_warning("Illegal move to %s : SHOULD NOT HAPPEN", buf+31);
+ }
+
+ if (!strncmp ("0-1",buf,3))
+ {
+ display_info(_("Black mates"));
+ }
+
+ if (!strncmp ("1-0",buf,3))
+ {
+ display_info(_("White mates"));
+ }
+
+ if (!strncmp ("1/2-1/2",buf,7))
+ {
+ display_info(_("Drawn game"));
+ }
+
+ /* parse for feature */
+ if (!strncmp ("feature",buf,7))
+ {
+ write_child(write_chan, "accepted setboard\n");
+ write_child(write_chan, "accepted analyze\n");
+ write_child(write_chan, "accepted ping\n");
+ write_child(write_chan, "accepted draw\n");
+ write_child(write_chan, "accepted variants\n");
+ write_child(write_chan, "accepted myname\n");
+ write_child(write_chan, "accepted done\n");
+ }
+
+ memmove (buf, q+1, sizeof(buf) - ( q + 1 - buf));
+ b -= (q + 1 - buf);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+engine_local_err_cb (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ g_error ("Local Engine connection died");
+
+ return FALSE;
+}
+
+/*----------------------------------------
+ * Subprocess creation
+ * Return TRUE if gnuchess is started, false instead
+ *----------------------------------------*/
+
+static gboolean
+start_child (char *cmd,
+ GIOChannel **read_chan,
+ GIOChannel **write_chan,
+ GPid *Child_Process)
+{
+ gint Child_In, Child_Out, Child_Err;
+ GError *gerror = NULL;
+
+ gchar *Child_Argv[]={ cmd, NULL };
+
+ g_warning("Ready to start child");
+
+ if (!g_spawn_async_with_pipes(NULL, Child_Argv, NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL, NULL, Child_Process, &Child_In, &Child_Out,
+ &Child_Err, &gerror)) {
+
+ g_warning("Error message '%s'", gerror->message);
+ g_warning("Error code '%d'", gerror->code);
+ g_error_free (gerror);
+ g_warning("In order to play chess, you need to have gnuchess installed as " GNUCHESS);
+ return(FALSE);
+
+ }
+
+ g_warning("gnuchess subprocess is started");
+
+ *read_chan = g_io_channel_unix_new (Child_Out);
+ *write_chan = g_io_channel_unix_new (Child_In);
+
+ return(TRUE);
+}
+
+
+static void
+write_child (GIOChannel *write_chan, char *format, ...)
+{
+ GIOError err;
+ va_list ap;
+ char *buf;
+ int len;
+
+ va_start (ap, format);
+
+ buf = g_strdup_vprintf (format, ap);
+
+ err = g_io_channel_write (write_chan, buf, strlen (buf), &len);
+ if (err != G_IO_ERROR_NONE)
+ g_warning ("Writing to child process failed");
+
+ g_warning ("%s", buf);
+
+ va_end (ap);
+
+ g_free (buf);
+}
+
+
+
diff --git a/src/gcompris/Makefile.mingw b/src/gcompris/Makefile.mingw
index b29d5c9..f9d8d55 100644
--- a/src/gcompris/Makefile.mingw
+++ b/src/gcompris/Makefile.mingw
@@ -4,6 +4,17 @@
# Description: Makefile for win32 (mingw) version of GCompris
#
+#
+# PATHS
+#
+
+GCOMPRIS_TOP := ../..
+INCLUDE_DIR := .
+CANVAS_TOP := $(GCOMPRIS_TOP)/src
+LIBART_TOP := $(GCOMPRIS_TOP)/src/libart_lgpl
+GCOMPRIS_SRC := .
+GCOMPRIS_INSTALL_DIR := $(GCOMPRIS_TOP)/win32-install-dir
+
##
## VARIABLE DEFINITIONS
##
@@ -25,7 +36,6 @@ LDFLAGS = -mwindows -mno-cygwin -mms-bitfields
## INCLUDE MAKEFILES
##
-GCOMPRIS_TOP := ../..
include $(GCOMPRIS_TOP)/global_win32.mak
##
@@ -40,27 +50,27 @@ INCLUDE_PATHS += -I$(INCLUDE_DIR) \
-I$(GTK_TOP)/include/atk-1.0 \
-I$(GLIB_TOP)/lib/glib-2.0/include \
-I$(GTK_TOP)/lib/gtk-2.0/include \
- -I.. \
+ -I$(CANVAS_TOP) \
-I$(GTK_TOP)/include/atk-1.0 \
+ -I$(LIBART_TOP) \
-I$(GTK_TOP)/include/freetype2 \
- -I$(GSTREAMER_TOP)/include/gstreamer-0.10 \
+ -I$(SDL_TOP)/include/SDL \
-I$(LIBXML2_TOP)/include \
- -I$(GNUWIN32_TOP)/include \
-I$(CAIRO_TOP)/include/cairo \
-I$(SQLITE_TOP) \
- -L$(GSTREAMER_TOP) \
-I$(GCOMPRIS_TOP) \
- -I$(GCOMPRIS_TOP)/src/boards
+ -I$(GCOMPRIS_TOP)/src/boards \
+ -I$(ICONV_TOP)/include
LIB_PATHS = -L$(GTK_TOP)/lib \
-L$(GLIB_TOP)/lib \
- -L$(LIBXML2_TOP)/bin \
- -L$(GNUWIN32_TOP)/lib \
- -L$(GSTREAMER_TOP)/bin \
- -L$(CANVAS_TOP)/lib \
+ -L$(LIBXML2_TOP)/lib \
+ -L$(SDL_TOP)/lib \
+ -L$(CANVAS_TOP) \
-L$(PYTHON_TOP)/libs \
-L$(SQLITE_TOP) \
+ -L$(ICONV_TOP)/lib \
-L$(GCOMPRIS_TOP)/src/gcompris
@@ -75,8 +85,12 @@ EXE_C_SRC = \
binreloc.c \
board.c \
board_config.c \
+ board_config_combo.c \
+ board_config_common.c \
+ board_config_radio.c \
+ board_config_textview.c \
+ board_config_wordlist.c \
bonus.c \
- cache.c \
config.c \
dialog.c \
drag.c \
@@ -98,6 +112,8 @@ EXE_C_SRC = \
score.c \
skin.c \
soundutil.c \
+ soundutil_sdl.c \
+ sdlplayer.c \
timer.c \
wordlist.c
@@ -110,10 +126,13 @@ EXE_OBJECTS = $(EXE_C_SRC:%.c=%.o) $(RC_SRC:%.rc=%.o)
##
EXE_LIBS = ../boards/libboards.a \
+ ../libgnomecanvas/libgnomecanvas.a \
+ ../libart_lgpl/libart_lgpl.a \
-lgtk-win32-2.0 \
-latk-1.0 \
-lpango-1.0 \
-lglib-2.0 \
+ -lgthread-2.0 \
-lgdk-win32-2.0 \
-lgobject-2.0 \
-lintl \
@@ -121,9 +140,7 @@ EXE_LIBS = ../boards/libboards.a \
-lgdk_pixbuf-2.0 \
-lws2_32 \
-lxml2 \
- -lgnomecanvas-2 \
- -lart_lgpl_2 \
- -lgstreamer-0.10 \
+ -lSDLmain -lSDL -lSDL_mixer \
-lpangoft2-1.0 \
-liconv \
-lpython24 \
@@ -141,7 +158,7 @@ EXE_LIBS = ../boards/libboards.a \
# How to make an RC file
%.o: %.rc
- windres -i $< -o $@
+ $(WINDRES) -i $< -o $@
##
## TARGET DEFINITIONS
@@ -152,7 +169,7 @@ EXE_LIBS = ../boards/libboards.a \
all: $(TARGET).exe
install: all
- cp gcompris.exe $(GCOMPRIS_INSTALL_DIR)
+ cp $(GCOMPRIS_SRC)/gcompris.exe $(GCOMPRIS_INSTALL_DIR)
#
# BUILD EXE
diff --git a/src/libart_lgpl/Makefile.mingw b/src/libart_lgpl/Makefile.mingw
index 978cdc7..47b413e 100644
--- a/src/libart_lgpl/Makefile.mingw
+++ b/src/libart_lgpl/Makefile.mingw
@@ -1,22 +1,21 @@
#
# Makefile.mingw
#
+# Description: Makefile for win32 (mingw) version of GCompris
+#
#
# PATHS
#
-GCOMPRIS_PLUGINS := .
+INCLUDE_DIR := .
GCOMPRIS_TOP := ../..
-GTK_TOP := /gtk
-GLIB_TOP := /glib
-GNUWIN32_TOP := /gnuwin32
##
## VARIABLE DEFINITIONS
##
-# Compiler Options
+# Compiler and Linker Options
CFLAGS =
@@ -25,6 +24,8 @@ DEFINES =
.SUFFIXES:
.SUFFIXES: .c .a
+LDFLAGS = -mwindows -mno-cygwin -mms-bitfields
+
##
## INCLUDE MAKEFILES
##
@@ -42,18 +43,14 @@ INCLUDE_PATHS += -I$(GTK_TOP)/include \
-I$(GTK_TOP)/include/atk-1.0 \
-I$(GLIB_TOP)/lib/glib-2.0/include \
-I$(GTK_TOP)/lib/gtk-2.0/include \
- -I$(GTK_TOP)/include/atk-1.0 \
+ -I$(LIBART_TOP) \
-I$(GTK_TOP)/include/freetype2 \
- -I$(GNUWIN32_TOP)/include \
+ -I$(LIBXML2_TOP)/include \
-I$(GCOMPRIS_TOP) \
- -I$(GCOMPRIS_TOP)/src
-
-
-
-
-LIB_PATHS = -L$(GTK_TOP)/lib \
- -L$(GNUWIN32_TOP)/lib
+ -I$(GCOMPRIS_TOP)/src \
+ -I$(CAIRO_TOP)/include/cairo
+LIB_PATHS = -L$(GTK_TOP)/lib
##
## LIBRARIES
@@ -66,6 +63,7 @@ LIBS = -lgtk-win32-2.0 \
-lgmodule-2.0 \
-lgdk_pixbuf-2.0 \
-lpango-1.0 \
+ -lpangoft2-1.0 \
-latk-1.0 \
-lpangowin32-1.0 \
-lgdi32 -lgthread-2.0 \
@@ -73,23 +71,68 @@ LIBS = -lgtk-win32-2.0 \
-lws2_32
##
-## RULES
-##
-
-##
## TARGET DEFINITIONS
##
.PHONY: all clean
-all: libart_lgpl
+all: art_config.h libart_lgpl
install:
-##
-## SOURCES, OBJECTS
-##
-LIBART_C_SRC = \
+gen_art_config.exe: gen_art_config.c
+ $(CC) $(LDFLAGS) gen_art_config.c -I$(GCOMPRIS_TOP) $(LIB_PATHS) -o gen_art_config.exe
+
+art_config.h: gen_art_config.exe
+ ./gen_art_config.exe > art_config.h
+
+libart_lgpl_2_a_headers = \
+ art_affine.h \
+ art_alphagamma.h \
+ art_bpath.h \
+ art_config.h \
+ art_filterlevel.h \
+ art_gray_svp.h \
+ art_misc.h \
+ art_pathcode.h \
+ art_pixbuf.h \
+ art_point.h \
+ art_rect.h \
+ art_rect_svp.h \
+ art_rect_uta.h \
+ art_render.h \
+ art_render_gradient.h \
+ art_render_mask.h \
+ art_render_svp.h \
+ art_rgb.h \
+ art_rgb_affine.h \
+ art_rgb_bitmap_affine.h \
+ art_rgb_pixbuf_affine.h \
+ art_rgb_rgba_affine.h \
+ art_rgb_a_affine.h \
+ art_rgb_svp.h \
+ art_rgba.h \
+ art_svp.h \
+ art_svp_intersect.h \
+ art_svp_ops.h \
+ art_svp_point.h \
+ art_svp_render_aa.h \
+ art_svp_vpath.h \
+ art_svp_vpath_stroke.h \
+ art_svp_wind.h \
+ art_uta.h \
+ art_uta_ops.h \
+ art_uta_rect.h \
+ art_uta_vpath.h \
+ art_uta_svp.h \
+ art_vpath.h \
+ art_vpath_bpath.h \
+ art_vpath_dash.h \
+ art_vpath_svp.h \
+ libart.h \
+ libart-features.h
+
+libart_lgpl_2_a_SOURCES = \
art_affine.c \
art_alphagamma.c \
art_bpath.c \
@@ -130,12 +173,12 @@ LIBART_C_SRC = \
art_vpath_bpath.c \
art_vpath_dash.c \
art_vpath_svp.c \
+ libart-features.c
-LIBART_OBJECTS = $(LIBART_C_SRC:%.c=%.o)
-
+OBJECTS = $(libart_lgpl_2_a_SOURCES:%.c=%.o)
#
-# BUILD staticlibrary
+# BUILD Boards staticlibrary
#
# How to make a C file
@@ -149,10 +192,10 @@ LIBART_OBJECTS = $(LIBART_C_SRC:%.c=%.o)
libart_lgpl: \
libart_lgpl.a
-libart_lgpl.a: $(LIBART_OBJECTS)
+libart_lgpl.a: $(OBJECTS)
-rm -f libart_lgpl.a
- $(AR) cru libart_lgpl.a $(LIBART_OBJECTS)
- ranlib libart_lgpl.a
+ $(AR) cru libart_lgpl.a $(OBJECTS)
+ $(RANLIB) libart_lgpl.a
##
## CLEAN RULES
@@ -161,3 +204,5 @@ libart_lgpl.a: $(LIBART_OBJECTS)
clean:
rm -rf *.o
rm -rf *.a
+
+
diff --git a/src/libgnomecanvas/Makefile.mingw b/src/libgnomecanvas/Makefile.mingw
index fb180b0..e0d9055 100644
--- a/src/libgnomecanvas/Makefile.mingw
+++ b/src/libgnomecanvas/Makefile.mingw
@@ -1,23 +1,28 @@
+
+CLEANFILES = $(marshal_sources)
+
+
#
# Makefile.mingw
#
+# Description: Makefile for win32 (mingw) version of GCompris
+#
#
# PATHS
#
-GCOMPRIS_PLUGINS := .
+INCLUDE_DIR := .
+LIBART_TOP := $(GCOMPRIS_TOP)/libart_lgpl
GCOMPRIS_TOP := ../..
-GTK_TOP := /gtk
-GLIB_TOP := /glib
-GNUWIN32_TOP := /gnuwin32
-CAIRO_TOP := /cairo
+GCOMPRIS_SRC := .
+GCOMPRIS_INSTALL_DIR := $(GCOMPRIS_TOP)/win32-install-dir
##
## VARIABLE DEFINITIONS
##
-# Compiler Options
+# Compiler and Linker Options
CFLAGS =
@@ -26,6 +31,8 @@ DEFINES =
.SUFFIXES:
.SUFFIXES: .c .a
+LDFLAGS = -mwindows -mno-cygwin -mms-bitfields
+
##
## INCLUDE MAKEFILES
##
@@ -43,19 +50,19 @@ INCLUDE_PATHS += -I$(GTK_TOP)/include \
-I$(GTK_TOP)/include/atk-1.0 \
-I$(GLIB_TOP)/lib/glib-2.0/include \
-I$(GTK_TOP)/lib/gtk-2.0/include \
- -I$(GTK_TOP)/include/atk-1.0 \
+ -I$(LIBART_TOP) \
-I$(GTK_TOP)/include/freetype2 \
- -I$(GNUWIN32_TOP)/include \
- -I$(CAIRO_TOP)/include/cairo \
+ -I$(LIBXML2_TOP)/include \
-I$(GCOMPRIS_TOP) \
- -I$(GCOMPRIS_TOP)/src
-
-
+ -I$(GCOMPRIS_TOP)/src \
+ -I$(CAIRO_TOP)/include/cairo \
+ -I$(FONTCONFIG_TOP) \
+ -I$(FREETYPE_TOP)/include \
+ -I$(FREETYPE_TOP)/include/freetype2/
LIB_PATHS = -L$(GTK_TOP)/lib \
- -L$(GNUWIN32_TOP)/lib
-
+ -L$(FREETYPE_TOP)/lib
##
## LIBRARIES
@@ -68,6 +75,7 @@ LIBS = -lgtk-win32-2.0 \
-lgmodule-2.0 \
-lgdk_pixbuf-2.0 \
-lpango-1.0 \
+ -lpangoft2-1.0 \
-latk-1.0 \
-lpangowin32-1.0 \
-lgdi32 -lgthread-2.0 \
@@ -75,23 +83,47 @@ LIBS = -lgtk-win32-2.0 \
-lws2_32
##
-## RULES
-##
-
-##
## TARGET DEFINITIONS
##
.PHONY: all clean
-all: libgnomecanvas
+all: libgnomecanvas
install:
-##
-## SOURCES, OBJECTS
-##
-LIBGNOMECANVAS_C_SRC = \
+marshal_sources = \
+ gnome-canvas-marshal.c \
+ gnome-canvas-marshal.h
+
+libgnomecanvas: $(marshal_sources)
+
+BUILT_SOURCES = \
+ $(marshal_sources)
+
+gnome-canvas-marshal.h: gnome-canvas-marshal.list
+ $(GLIB_GENMARSHAL) $< --header --prefix=gnome_canvas_marshal > $@
+gnome-canvas-marshal.c: gnome-canvas-marshal.list
+ $(GLIB_GENMARSHAL) $< --body --prefix=gnome_canvas_marshal > $@
+
+
+libgnomecanvasinclude_headers = \
+ gnome-canvas-shape.h \
+ gnome-canvas-bpath.h \
+ gnome-canvas-clipgroup.h \
+ gnome-canvas-line.h \
+ gnome-canvas-pixbuf.h \
+ gnome-canvas-polygon.h \
+ gnome-canvas-rect-ellipse.h \
+ gnome-canvas-text.h \
+ gnome-canvas-rich-text.h \
+ gnome-canvas-util.h \
+ gnome-canvas-widget.h \
+ gnome-canvas-path-def.h \
+ gnome-canvas.h \
+ libgnomecanvas.h
+
+libgnomecanvas_2_a_SOURCES = \
gnome-canvas-shape.c \
gnome-canvas-shape-private.h \
gnome-canvas-bpath.c \
@@ -107,14 +139,14 @@ LIBGNOMECANVAS_C_SRC = \
gnome-canvas-util.c \
gnome-canvas-widget.c \
gnome-canvas.c \
- libgnomecanvastypes.c \
- gnome-canvas-marshal.c
+ libgnomecanvastypes.c
+
-LIBGNOMECANVAS_OBJECTS = $(LIBGNOMECANVAS_C_SRC:%.c=%.o)
+OBJECTS = $(libgnomecanvas_2_a_SOURCES:%.c=%.o)
#
-# BUILD staticlibrary
+# BUILD Boards staticlibrary
#
# How to make a C file
@@ -128,10 +160,10 @@ LIBGNOMECANVAS_OBJECTS = $(LIBGNOMECANVAS_C_SRC:%.c=%.o)
libgnomecanvas: \
libgnomecanvas.a
-libgnomecanvas.a: $(LIBGNOMECANVAS_OBJECTS)
+libgnomecanvas.a: $(OBJECTS)
-rm -f libgnomecanvas.a
- $(AR) cru libgnomecanvas.a $(LIBGNOMECANVAS_OBJECTS)
- ranlib libgnomecanvas.a
+ $(AR) cru libgnomecanvas.a $(OBJECTS)
+ $(RANLIB) libgnomecanvas.a
##
## CLEAN RULES
@@ -140,3 +172,4 @@ libgnomecanvas.a: $(LIBGNOMECANVAS_OBJECTS)
clean:
rm -rf *.o
rm -rf *.a
+ rm -rf $(marshal_sources)