Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Compiling FreeTDS under Windows: Difference between revisions

From MoodleDocs
Line 20: Line 20:
* Create c:\dev\php-build
* Create c:\dev\php-build
* Uncompress all the packages listed in requirements and PHP into c:\dev\php-build (replacing all when uncompressing). Make sure to extract the bin, lib, include folders without any top level directory contained within the archive.
* Uncompress all the packages listed in requirements and PHP into c:\dev\php-build (replacing all when uncompressing). Make sure to extract the bin, lib, include folders without any top level directory contained within the archive.
* Copy uncompressed [http://www.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-0.82.tar.gz freetds] folder to C:\dev\php-build (rename it to, simply, "freetds").
* Copy uncompressed [http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-patched.tgz freetds] folder to C:\dev\php-build (rename it to, simply, "freetds").
* Apply [http://freetds.sourceforge.net/post82.diff.gz post 0.82 patches] in the "freetds" dir.
* Open the C:\dev\php-build\freetds\win32\msvc6\FreeTDS.dsw Project Workspace (it's really important to get this Workspace and not any of the individual projects!).
* Open the C:\dev\php-build\freetds\win32\msvc6\FreeTDS.dsw Project Workspace (it's really important to get this Workspace and not any of the individual projects!).
* In the "Build" menu, set the "Active Configuration" to  "dblib - Win32 Release" and then, in the same menu, "Rebuild All". This should end with one dblib.lib library into C:\dev\php-build\freetd\win32\msvc6\db_Release
* In the "Build" menu, set the "Active Configuration" to  "dblib - Win32 Release" and then, in the same menu, "Rebuild All". This should end with one dblib.lib library into C:\dev\php-build\freetd\win32\msvc6\db_Release
Line 34: Line 33:
* Execute this:
* Execute this:
** buildconf
** buildconf
** cscript /nologo configure.js --disable-all --disable-ipv6 --enable-zts (--disable-zts)  --with-dblib=shared --enable-object-out-dir=c:\dev --with-extra-includes=c:\dev\php-build\freetds\include;c:\dev\php-build\freetds\win32
** cscript /nologo configure.js --disable-all --disable-ipv6 --enable-cli --enable-zts (--disable-zts)  --with-dblib=shared --enable-object-out-dir=c:\dev --with-extra-includes=c:\dev\php-build\freetds\include;c:\dev\php-build\freetds\win32
** nmake
** nmake
* You should end with one C:\dev\Release_TS for the --enable-zts (or C:\dev\Release for the --disable-zts alternative)  dir, with your compiled FreeTDS PHP module ready at the root level of that dir.
* You should end with one C:\dev\Release_TS for the --enable-zts (or C:\dev\Release for the --disable-zts alternative)  dir, with your compiled FreeTDS PHP module ready at the root level of that dir. CLI was passed as a build option above because as of PHP v5.3.x you must specify one SAPI modile to get a build.


==Notes==
==Notes==

Revision as of 22:42, 23 February 2011

Requirements

Build Steps

  • Create c:\dev
  • Create c:\dev\php-build
  • Uncompress all the packages listed in requirements and PHP into c:\dev\php-build (replacing all when uncompressing). Make sure to extract the bin, lib, include folders without any top level directory contained within the archive.
  • Copy uncompressed freetds folder to C:\dev\php-build (rename it to, simply, "freetds").
  • Open the C:\dev\php-build\freetds\win32\msvc6\FreeTDS.dsw Project Workspace (it's really important to get this Workspace and not any of the individual projects!).
  • In the "Build" menu, set the "Active Configuration" to "dblib - Win32 Release" and then, in the same menu, "Rebuild All". This should end with one dblib.lib library into C:\dev\php-build\freetd\win32\msvc6\db_Release
  • Copy dblib.lib to C:\dev\php-build\lib
  • Start CMD
  • Create one C:\dev\prepare4php.bat file with contents below and execute it:
@set PATH=C:\dev\php-build\bin;%PATH%
@set INCLUDE=C:\dev\php-build\include;%INCLUDE%
@set LIB=C:\dev\php-build\lib;%LIB%
@set BISON_SIMPLE=C:\dev\php-build\bin\bison.simple
  • Continue in CMD and change dir to C:\dev\php-build\php-x-x-x
  • Execute this:
    • buildconf
    • cscript /nologo configure.js --disable-all --disable-ipv6 --enable-cli --enable-zts (--disable-zts) --with-dblib=shared --enable-object-out-dir=c:\dev --with-extra-includes=c:\dev\php-build\freetds\include;c:\dev\php-build\freetds\win32
    • nmake
  • You should end with one C:\dev\Release_TS for the --enable-zts (or C:\dev\Release for the --disable-zts alternative) dir, with your compiled FreeTDS PHP module ready at the root level of that dir. CLI was passed as a build option above because as of PHP v5.3.x you must specify one SAPI modile to get a build.

Notes

  • By using --enable-zts or --disable-zts you'll end with different thread safe/no safe versions of the extension. Use them depending of your environment thread safety.
  • If you one use PHP 5.2 version to build the lib, the extensions generated are expected to work against any PHP 5.2.x version (but not against other releases of PHP, like 5.1 or 5.3).
  • MSVC 6.0 is required because it's the official tool used to build PHP binary distributions. It seems that, with PHP 5.3 they will start using MSVC 9 or so... corresponding extensions should use the same.
  • Feel free to fix and improve this document. TIA!
  • For any comment related to this, please use MDL-14725 in the Moodle Tracker.
  • And MDL-11810 has a related discussion.