Hello,

I don't plan to write any wiki doc, so here are the minimal stuff for cross-compiling wormux:
1) cfg-gcc will help create a cross compiler
2) cross.sh will help run wormux' configure so as to use the cross-compiler; I haven't been able to have it properly use my cross-compiler, so I had to force it 3) Makefile uses windres while the cross-compiling tool is called ${prefix}windres. Therefore when the make error occurs, just type the windres command with the proper windres binary. 4) I have updated the cross_setup.sh so as to use it within a cross-compilation environment. The cross-compiler name-prefix and path are editable in it.

From 3) and 4), some autotools voodoo should improve considerably things.

As for what needs what and where, which is the longest yet most trivial matter, I leave it up as an exercise to the reader that is really intent on using a cross-compiler, all the more since I have already provided a build guide and dev- packages on my wormux webpage.

btw it compiles with cross gcc 4.1.1. I hadn't the gettext tools (links against several libintl) set up right so I haven't updated the win32 setup on my page.

Best regards,
Kurosu
Index: tools/win32_setup/create_setup.sh
===================================================================
--- tools/win32_setup/create_setup.sh   (revision 934)
+++ tools/win32_setup/create_setup.sh   (working copy)
@@ -4,12 +4,12 @@
 PKG_CONFIG=pkg-config
 MAKE_NSIS=makensis
 
+# For cross-compiler
+CROSSDIR="/usr/local/i386-mingw32"
+
 # Path to which all others are relative
 WORMUXDIR="../.."
 
-# Path of MinGW installation
-MINGWDIR=/mingw
-
 # Windows registry software path
 HKLM_PATH="SOFTWARE\Games\Wormux"
 
@@ -25,13 +25,22 @@
 rm -rf $NSIS $DEST
 
 # Prepare stuff
-WIN_WORMUXDIR=$(cd "$WORMUXDIR" && cmd /c cd)
-LOCAL_PATH=$(cmd /c cd)
+if [ "$OSTYPE" == "linux-gnu" ]; then
+  WIN_WORMUXDIR="../.."
+  LOCAL_PATH=$PWD
+  SEP='/'
+else
+  WIN_WORMUXDIR=$(cd "$WORMUXDIR" && cmd /c cd)
+  LOCAL_PATH=$(cmd /c cd)
+  SEP='\\'
+fi
+
 mkdir -p $DEST
 
 function pkg_path
 {
-  if [ -z "$1" ]; then return ""; fi
+  if [ "$OSTYPE" == "linux-gnu" ]; then echo $CROSSDIR; return; fi
+  if [ -z "$1" ]; then echo ""; return; fi
   var=$($PKG_CONFIG --variable=prefix $1 2>/dev/null)
   if [ -z "$var" ]; then echo "Couldn't find $1, aborting..." 1>&2; exit 1; fi
   echo "Found $1 in $var" 1>&2
@@ -53,8 +62,8 @@
 # Create head
 cat > $NSIS <<EOF
 ;based on MUI Welcome/Finish Page Example Script written by Joost Verburg
-!define MUI_ICON  "${WIN_WORMUXDIR}\src\wormux.ico"
-!define MUI_UNICON  ${LOCAL_PATH}\uninstall.ico
+!define MUI_ICON  "${WIN_WORMUXDIR}${SEP}src${SEP}wormux.ico"
+!define MUI_UNICON  ${LOCAL_PATH}${SEP}uninstall.ico
 !define MUI_COMPONENTSPAGE_SMALLDESC
 !define MUI_LANGDLL_ALWAYSSHOW
 !include "MUI.nsh"
@@ -65,7 +74,7 @@
 Name "Wormux"
 
 ;General
-OutFile "${LOCAL_PATH}\Wormux-Setup-${WORMUX_VERSION}.exe"
+OutFile "${LOCAL_PATH}${SEP}Wormux-Setup-${WORMUX_VERSION}.exe"
 SetCompressor $COMPRESSION
 
 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM" 
@@ -89,42 +98,42 @@
 
 ;Languages
 !insertmacro MUI_LANGUAGE "English"
-LicenseLangString WormuxLicense "English" 
"${WIN_WORMUXDIR}\doc\license\COPYING.en.txt"
+LicenseLangString WormuxLicense "English" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.en.txt"
 LangString TITLE_Wormux "English" "Wormux"
 LangString DESC_Wormux  "English" "Installs the game Wormux, version 
${WORMUX_VERSION}"
 
 !insertmacro MUI_LANGUAGE "French"
-LicenseLangString WormuxLicense "French" 
"${WIN_WORMUXDIR}\doc\license\COPYING.fr.txt"
+LicenseLangString WormuxLicense "French" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.fr.txt"
 LangString TITLE_Wormux "French" "Wormux"
 LangString DESC_Wormux  "French" "Installe le jeu Wormux, en version 
${WORMUX_VERSION}"
 
 !insertmacro MUI_LANGUAGE "German"
-LicenseLangString WormuxLicense "German" 
"${WIN_WORMUXDIR}\doc\license\COPYING.de.txt"
+LicenseLangString WormuxLicense "German" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.de.txt"
 LangString TITLE_Wormux "German" "Wormux"
 LangString DESC_Wormux  "German" "Das Spiel Wormux, Version ${WORMUX_VERSION} 
anbringen"
 
 !insertmacro MUI_LANGUAGE "Spanish"
-LicenseLangString WormuxLicense "Spanish" 
"${WIN_WORMUXDIR}\doc\license\COPYING.es.txt"
+LicenseLangString WormuxLicense "Spanish" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.es.txt"
 LangString TITLE_Wormux "Spanish" "Wormux"
 LangString DESC_Wormux  "Spanish" "Instala el juego Wormux, versin 
${WORMUX_VERSION}"
 
 !insertmacro MUI_LANGUAGE "Dutch"
-LicenseLangString WormuxLicense "Dutch" 
"${WIN_WORMUXDIR}\doc\license\COPYING.nl.txt"
+LicenseLangString WormuxLicense "Dutch" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.nl.txt"
 LangString TITLE_Wormux "Dutch" "Wormux"
 LangString DESC_Wormux  "Dutch" "Wormux ${WORMUX_VERSION}"
 
 !insertmacro MUI_LANGUAGE "Polish"
-LicenseLangString WormuxLicense "Polish" 
"${WIN_WORMUXDIR}\doc\license\COPYING.pl.txt"
+LicenseLangString WormuxLicense "Polish" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.pl.txt"
 LangString TITLE_Wormux "Polish" "Wormux"
 LangString DESC_Wormux  "Polish" "Wormux ${WORMUX_VERSION}"
 
 !insertmacro MUI_LANGUAGE "Russian"
-LicenseLangString WormuxLicense "Russian" 
"${WIN_WORMUXDIR}\doc\license\COPYING.ru.txt"
+LicenseLangString WormuxLicense "Russian" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.ru.txt"
 LangString TITLE_Wormux "Russian" "Wormux"
 LangString DESC_Wormux  "Russian" "Wormux ${WORMUX_VERSION}"
 
 !insertmacro MUI_LANGUAGE "Slovenian"
-LicenseLangString WormuxLicense "Slovenian" 
"${WIN_WORMUXDIR}\doc\license\COPYING.sk.txt"
+LicenseLangString WormuxLicense "Slovenian" 
"${WIN_WORMUXDIR}${SEP}doc${SEP}license${SEP}COPYING.sk.txt"
 LangString TITLE_Wormux "Slovenian" "Wormux"
 LangString DESC_Wormux  "Slovenian" "Wormux ${WORMUX_VERSION}"
 
@@ -142,10 +151,10 @@
 Section \$(TITLE_Wormux) Sec_Wormux
   ; Set output path to the installation directory.
   SetOutPath \$INSTDIR
-  File "${WIN_WORMUXDIR}\src\wormux.ico"
+  File "${WIN_WORMUXDIR}${SEP}src${SEP}wormux.ico"
   ; Executing in tmpdir, looking for file in folder below
-  File "${LOCAL_PATH}\uninstall.ico"
-  File "${WIN_WORMUXDIR}\src\wormux.exe"
+  File "${LOCAL_PATH}${SEP}uninstall.ico"
+  File "${WIN_WORMUXDIR}${SEP}src${SEP}wormux.exe"
 EOF
 
 # Glib (gobject, gthread, glib & gmodule)
@@ -167,10 +176,13 @@
 
 # Clean up before non-strippable files
 # WARNING Stripping some dlls corrupts them beyond use
-strip "$DEST/"*.dll "$WORMUXDIR/src/"*.exe
+if [ "$OSTYPE" == "linux-gnu" ]; then STRIP=i386-mingw32-strip
+else STRIP=strip; fi
+$STRIP "$DEST/"*.dll "$WORMUXDIR/src/"*.exe
 
 # Files that must not be stripped (all of SDL)
-SDL_PATH=$(sdl-config --prefix)
+if [ "$OSTYPE" == "linux-gnu" ]; then SDL_PATH=$CROSSDIR
+else SDL_PATH=$(sdl-config --prefix); fi
 cp "$SDL_PATH/bin/SDL_mixer.dll" "$SDL_PATH/bin/SDL_ttf.dll"   \
    "$SDL_PATH/bin/SDL_image.dll" "$SDL_PATH/bin/SDL.dll"       \
    "$SDL_PATH/bin/SDL_net.dll" "$GLIB_PATH/bin/intl.dll"       \
@@ -180,7 +192,7 @@
 # Continue producing installer
 cat >> $NSIS <<EOF
   ; Dlls and co
-  File "*.dll"
+  File "$DEST${SEP}*.dll"
 EOF
 
 ## Locale
@@ -189,20 +201,20 @@
   lg=${gmo%%.gmo}
   lg=${lg//.*\//}
   echo "  SetOutPath \$INSTDIR\\locale\\$lg\\LC_MESSAGES" >> $NSIS
-  echo "  File /oname=wormux.mo \"$WIN_WORMUXDIR\\po\\$lg.gmo\"" >> $NSIS
+  echo "  File /oname=wormux.mo \"$WIN_WORMUXDIR${SEP}po${SEP}$lg.gmo\"" >> 
$NSIS
 done
 
 ## Data - I love this syntax
 cat >> $NSIS <<EOF
   ; Data
   SetOutPath \$INSTDIR
-  File /r /x .svn /x Makefile* /x Makefile.* "${WIN_WORMUXDIR}\\data"
+  File /r /x .svn /x Makefile* /x Makefile.* "${WIN_WORMUXDIR}${SEP}data"
 EOF
 
 ## License
 cat >> $NSIS <<EOF
   ; Licenses
-  File /r /x .svn "${WIN_WORMUXDIR}\\doc\\license"
+  File /r /x .svn "${WIN_WORMUXDIR}${SEP}doc${SEP}license"
 EOF
 
 # End
@@ -266,8 +278,10 @@
 FunctionEnd
 EOF
 
+exit 1
+
 ## Compile installer
-if ! $MAKE_NSIS $NSIS; then
+if ! $MAKE_NSIS -NOCD $NSIS; then
   echo "makensis failed, aborting..."
   exit 1
 fi
gcc-4.0.2/configure --enable-languages=c,c++ --prefix=/usr/local 
--target=i386-mingw32
WINDRES=i386-mingw32-windres AS=i386-mingw32-as AR=i386-mingw32-ar \
LD=i386-mingw32-ld CXX=i386-mingw32-g++ CC=i386-mingw32-gcc \
STRIP=i386-mingw32-strip ./configure --target=mingw32 --host=i386-mingw32 \
  --with-sdl-prefix=/usr/local/i386-mingw32 --disable-sdltest
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à