Table des matières

Cross compilation

Ces informations viennent de Glorf et demandent à être reproduites (il est dispo pour aider). Il est possible que ça ne suffise pas, tel quel.

Installation environnement Mac

Install OSXcross

git clone https://github.com/tpoechtrager/osxcross
cd osxcross

Note : normalement on télécharge depuis le site d'Apple (en étant enregistré et tout, c'est un peu embêtant), j'ai mis un miroir (mais je ne garantis pas la disponibilité à moyen terme)

wget http://pakuh.glorf.fr:8000/Xcode_7.3.1.dmg

La suite se fait en root, y compris le build (sinon ça ne marche pas)

Note : clang 3.5 marche pas, je conseille 3.8

apt-get install clang llvm-dev libxml2-dev uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio libbz2-dev libfuse-dev fuse libicu-dev
./tools/gen_sdk_package_darling_dmg.sh Xcode_7.3.1.dmg
mv MacOSX10.11.sdk.tar.xz tarballs/
./build.sh
./build.sh

Le nom du .tar.xz sera peut-être différent sur votre système.

Oui, on le lance deux fois, mais c'est normal, ça marche pas la première fois normalement.

Pour pouvoir compiler en tant que non-root par la suite

chown -R jenkins:jenkins target/

Installer dépendances ryzomcore

export MACOSX_DEPLOYMENT_TARGET=10.7
export OSXCROSS_GCC_NO_STATIC_RUNTIME=1
export PATH=$PATH:/opt/osx/osxcross/target/bin
osxcross-macports install libxml2 jpeg curl libogg libvorbis freetype boost openssl zlib lua-5.3 giflib

Compiler luabind (qui n'est pas dans macport)

export $RYHOME=/opt/ryzom/ryzomcore/code
#Ou wherever you want
cd ~
hg clone http://hg.kervala.net/luabind
hg clone http://hg.kervala.net/cmake
export CMAKE_MODULE_PATH=$(pwd)/cmake/modules
export LUABIND_MAC_PATH=$(pwd)/luabind
cd luabind
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=/opt/ryzom/ryzomcore/code/CMakeModules/OSXToolChain.cmake -DWITH_SHARED=OFF -DWITH_STATIC=ON -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_INSTALL_PREFIX=/opt/osxcross/target/external
make

Pour outils, mysql + squish à compiler

Note : toujours CMAKE_MODULE_PATH bien défini, et les bonnes variables d'environnement pour compiler

cd ~
hg clone http://hg.kervala.net/squish
cd squish
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=/opt/ryzom/ryzomcore/code/CMakeModules/OSXToolChain.cmake -DWITH_SHARED=OFF -DWITH_STATIC=ON -DCMAKE_INSTALL_PREFIX=/opt/osxcross/target/external
make install

Installation environnement Windows

Un simple script sh (qui va de “début script windows” à “fin script windows”) à installer avant :

dpkg --add-architecture i386

apt install p7zip-full binfmt-support libc6-i386 libncurses5:i386 libfreetype6:i386 bzip2 

Et changer le export BASEDIR vers le répertoire où est installé le script et l'environnement de cross-compilation.

cross_win32.sh
## Début script windows ##
#!/bin/sh
# variables à changer :
export BASEDIR=/opt/wincross # à changer
 
COMPILER=vc12
ARCH=amd64
WINEVERSION=1.9.1
 
URL="http://kervala.net/download/"
URLPREFIX="win32_cross_"
URLSUFFIX=".7z"
 
download()
{
  PACK=$1
 
  if [ ! -e $URLPREFIX$PACK$URLSUFFIX ]
  then
    echo "Downloading $PACK..."
    wget -q $URL$URLPREFIX$PACK$URLSUFFIX
  fi
 
  echo "Extracting $PACK..."
  7z x $URLPREFIX$PACK$URLSUFFIX 1> /dev/null
 
  RET=$?
 
  if [ -d $PACK/bin ]
  then
    chmod +x $PACK/bin/*.exe
  fi
 
  return $RET
}
 
 
 
 
 
if [ "$COMPILER" = "vc8" ]
then
  echo "Using VC++ 2005 compilers"
elif [ "$COMPILER" = "vc9" ]
then
  echo "Using VC++ 2008 compilers"
elif [ "$COMPILER" = "vc10" ]
then
  echo "Using VC++ 2010 compilers"
elif [ "$COMPILER" = "vc11" ]
then
  echo "Using VC++ 2012 compilers"
elif [ "$COMPILER" = "vc12" ]
then
  echo "Using VC++ 2013 compilers"
elif [ "$COMPILER" = "vc14" ]
then
  echo "Using VC++ 2015 compilers"
else
  echo "Bad compiler $COMPILER"
  return 1
fi
 
if [ ! -d "tools" ]
then
  download tools
fi
 
if [ ! -d $COMPILER ]
then
  download $COMPILER
 
  ARCHS="amd64 ia64 x86 x86_amd64 x86_ia64"
 
  for TARCH in $ARCHS
  do
    CDIR=$COMPILER/bin/$TARCH
 
    if [ -d "$CDIR" ]
    then
      chmod +x $CDIR/*.exe
    fi
  done
fi
 
if [ ! -d "winsdk" ]
then
  download winsdk
fi
 
if [ ! -d "dxsdk" ]
then
  download dxsdk
fi
 
if [ ! -d "$COMPILER/external" ]
then
  download $COMPILER"_external"
fi
 
export BASEDIRDOS=Z:$(echo "$BASEDIR" | sed 's/\//\\/g')
 
export TOOLSDIR=$BASEDIR/tools
export TOOLSBINDIR=$TOOLSDIR/bin
 
export VCDIR=$BASEDIR/$COMPILER
export VCBINDIR=$VCDIR/bin
 
export WINSDKDIR=$BASEDIR/winsdk
export WINSDKBINDIR=$WINSDKDIR/bin
 
# wine
if [ ! -z $WINEVERSION ]
then
  export BASEWINEDIR=$BASEDIR/wineversion
  export WINEDIR=$BASEWINEDIR/$WINEVERSION/bin
    if [ ! -d $WINEDIR ]
  then
    echo "Downloading WINE $WINEVERSION..."
    wget -q http://www.playonlinux.com/wine/binaries/linux-amd64/PlayOnLinux-wine-$WINEVERSION-linux-amd64.pol
    echo "Extracting WINE $WINEVERSION..."
    tar xjf PlayOnLinux-wine-$WINEVERSION-linux-amd64.pol
  fi
fi
 
# remove previous win32 pathes af any
export PATH=$(echo $PATH | sed 's|:'$BASEDIR'/[a-z0-9./_-]*||g')
 
 
export PATH=$PATH:$WINEDIR
 
 
# add wine to path
export CURRENT_CPU=x86
export Configuration=Release
export TARGET_PLATFORM=WIN7
export APPVER=6.1
export DEBUGMSG=Release
export INCLUDE=$BASEDIRDOS"\\"$COMPILER"\\include;"$BASEDIRDOS"\\winsdk\\include"
export LIB=
export LIBPATH=$BASEDIRDOS"\\"$COMPILER"\\lib"
 
export PATH=$PATH:$TOOLSBINDIR:$WINSDKBINDIR
 
if [ $ARCH = "x86" ]
then
  export PATH=$PATH:$VCBINDIR/x86
  export WINEPATH=$BASEDIRDOS"\\"$COMPILER"\\bin\\x86;"
  export TARGET_CPU=x86
  export LIB=$BASEDIRDOS"\\"$COMPILER"\\lib;"$BASEDIRDOS"\\winsdk\\lib;"$BASEDIRDOS"\\dxsdk\\lib"
elif [ $ARCH = "amd64" ]
then
  export PATH=$PATH:$VCBINDIR/x86_amd64
  export WINEPATH=$BASEDIRDOS"\\"$COMPILER"\\bin\\x86_amd64;"
  export TARGET_CPU=x64
  export LIB=$BASEDIRDOS"\\"$COMPILER"\\lib\\amd64;"$BASEDIRDOS"\\winsdk\\lib\\amd64;"$BASEDIRDOS"\\dxsdk\\lib\\amd64"
elif [ $ARCH = "ia64" ]
then
  export PATH=$PATH:$VCBINDIR/x86_ia64
  export WINEPATH=$BASEDIRDOS"\\"$COMPILER"\\bin\\x86_ia64;"
  export TARGET_CPU=IA64
  export LIB=$BASEDIRDOS"\\"$COMPILER"\\lib\\ia64;"$BASEDIRDOS"\\winsdk\\lib\\ia64"
else
  echo "Bad arch $ARCH"
  return 1
fi
 
export LIBPATH=$LIB
export PATH=$PATH:$VCBINDIR
 
# PATH environment variable for Wine
export WINEPATH=".;"$WINEPATH$BASEDIRDOS"\\"$COMPILER"\\bin;"$BASEDIRDOS"\\winsdk\\bin;"$BASEDIRDOS"\\bin;"$BASEDIRDOS"\\tools\\bin;"$BASEDIRDOS"\\perl\\perl\\bin"
 
export WINEPREFIX=$BASEDIR/wine/$WINEVERSION
 
mkdir -p $WINEPREFIX
 
# launch WINE fot the first time
wine ping
 
# Copy winemenubuilder.exe to wine to avoid missing X11 warnings
#if [ -f $TOOLSBINDIR/winemenubuilder.exe ] && [ -d $WINEPREFIX/drive_c/windows/system32 ]
#then
#  rm -f $WINEPREFIX/drive_c/windows/system32/winemenubuilder.exe
#  rm -f $WINEPREFIX/drive_c/windows/syswow64/winemenubuilder.exe
#  export WINEDLLOVERRIDES=winemenubuilder.exe=n
#fi
 
# delete fake manifests for VC++ 2008 runtimes
#rm -rf $WINEPREFIX/drive_c/windows/winsxs/x86_microsoft.vc80*
#rm -rf $WINEPREFIX/drive_c/windows/winsxs/manifests/x86_microsoft.vc80*
#rm -f $WINEPREFIX/drive_c/windows/system32/msvcr80.dll
#rm -rf $WINEPREFIX/drive_c/windows/winsxs/x86_microsoft.vc90*
#rm -rf $WINEPREFIX/drive_c/windows/winsxs/manifests/x86_microsoft.vc90*
#rm -f $WINEPREFIX/drive_c/windows/system32/msvcr90.dll
#rm -f $WINEPREFIX/drive_c/windows/system32/msvcr100.dll
#rm -f $WINEPREFIX/drive_c/windows/system32/msvcp100.dll
 
# Remove all WINE warnings
export WINEDEBUG=-all
 
# Setting misc environment variables
export QTDIR=Z:$BASEDIR/$COMPILER/qt
export DXSDK_DIR=Z:$BASEDIR/dxsdk
export VC_DIR=Z:$BASEDIR/$COMPILER
#export MT_OPTIONS="-log /tmp/mt/log -verbose"
 
echo "TARGET_CPU=$TARGET_CPU"
echo "PATH=$PATH"
echo "WINEPATH=$WINEPATH"
echo "LIB=$LIB"
echo "INCLUDE=$INCLUDE"
 
export EXTERNAL_MSVC80_PATH=Z:$BASEDIR/vc8/external
export EXTERNAL_MSVC90_PATH=Z:$BASEDIR/vc9/external
export EXTERNAL_MSVC10_PATH=Z:$BASEDIR/vc10/external
export EXTERNAL_MSVC11_PATH=Z:$BASEDIR/vc11/external
export EXTERNAL_MSVC12_PATH=Z:$BASEDIR/vc12/external
export EXTERNAL_MSVC14_PATH=Z:$BASEDIR/vc14/external
 
if [ "$COMPILER" = "vc8" ]
then
  export EXTERNAL_PATH=$EXTERNAL_MSVC80_PATH
elif [ "$COMPILER" = "vc9" ]
then
  export EXTERNAL_PATH=$EXTERNAL_MSVC90_PATH
elif [ "$COMPILER" = "vc10" ]
then
  export EXTERNAL_PATH=$EXTERNAL_MSVC10_PATH
elif [ "$COMPILER" = "vc11" ]
then
  export EXTERNAL_PATH=$EXTERNAL_MSVC11_PATH
elif [ "$COMPILER" = "vc12" ]
then
  export EXTERNAL_PATH=$EXTERNAL_MSVC12_PATH
  export WINEDLLOVERRIDES="msvcr120.dll=n"
elif [ "$COMPILER" = "vc14" ]
then
  export EXTERNAL_PATH=$EXTERNAL_MSVC14_PATH
fi
 
## Fin script windows ##

Compilation

Windows

source /path/to/cross_win32.sh 

(celui d'avant)

wine cmake.exe -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_LUA53=ON -DWITH_LUA51=OFF -DWITH_STLPORT=OFF -DWITH_DRIVER_DSOUND=ON -G "NMake Makefiles JOM" -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_DRIVER_OPENAL=OFF -DWITH_DRIVER_DSOUND=ON -DWITH_DRIVER_XAUDIO2=ON -DWITH_DRIVER_FMOD=ON -DWITH_DRIVER_DIRECT3D=ON  ..
wine jom.exe [se comporte comme make, tu peux restreindre le nombre de process avec -j1/-j2]

Mac

export MACOSX_DEPLOYMENT_TARGET=10.7
export OSXCROSS_GCC_NO_STATIC_RUNTIME=1
export PATH=$PATH:/path/to/osxcross/target/bin
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../code/CMakeModules/OSXToolChain.cmake -DWITH_RYZOM_CLIENT=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_DRIVER_OPENGL=ON -DWITH_QT=OFF -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SNOWBALLS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_PATCH=ON -DWITH_UNIX_STRUCTURE=OFF -DWITH_INSTALL_LIBRARIES=OFF -DWITH_RYZOM_SANDBOX=OFF -DOSX_SDK=10.11 -DWITH_LUA53=ON -DWITH_LUA51=OFF ../code
make

Linux

cmake -DWITH_RYZOM_CLIENT=ON 
-DWITH_STATIC=ON 
-DWITH_STATIC_DRIVERS=ON 
-DWITH_DRIVER_OPENGL=ON 
-DFINAL_VERSION=ON -DWITH_QT=OFF 
-DWITH_NEL_TESTS=OFF 
-DWITH_RYZOM_SERVER=ON 
-DWITH_NEL_SAMPLES=ON 
-DWITH_SNOWBALLS=OFF 
-DWITH_NEL_TOOLS=ON 
-DWITH_RYZOM_TOOLS=ON 
-DWITH_RYZOM_PATCH=ON 
-DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON 
-DWITH_STATIC_EXTERNAL=ON 
-DWITH_LUA51=OFF 
-DWITH_LUA53=ON ..
 
make