Windows下编译Ruby源代码

来源:互联网 发布:nfc手机支付软件 编辑:程序博客网 时间:2024/04/29 01:45

为了在Windows下粘合Ruby扩展到应用程序,需要重新编译Ruby源代码,以便使用Visual Studio进行扩展的开发。使用第三方一键安装的版本开发工具使用的是Mingw下的GCC,无法满足需要。


源代码使用官网提供的源码包,直接从源代码库下载的源码需要额外的工具,代码包中有相关说明。


由于是用VS进行编译,缺省的Native包中gdbm和readline无法找到VS能编译的包,所以弃用。前者自己没用到,后者IRB会使用,缺少readline支持的IRB是比较蛋疼的。


把编译过程的命令行贴上,其中包括了自己常用的扩展,用以备忘


#opensslcd E:\Projects\BuildRuby231\external\openssl-1.0.2set PATH=d:\nasm-2.12.02\win32;%PATH%d:\Strawberry\perl\bin\perl.exe Configure VC-WIN32 enable-static-engine --prefix=D:\Ruby23-x86\src\externalms\do_nasm.batnmake -f ms\ntdll.maknmake -f ms\ntdll.mak install#qdbm edit vcpathcd E:\Projects\BuildRuby231\external\qdbm-1.8.78nmake -f VCmakefile#tclcd E:\Projects\BuildRuby231\external\tcl8.5.19\winnmake -f makefile.vcnmake -f makefile.vc install-libraries INSTALLDIR=D:\Ruby23-x86\src\externalnmake -f makefile.vc install-binaries INSTALLDIR=D:\Ruby23-x86\src\external#tkcd E:\Projects\BuildRuby231\external\tk8.5.19\winnmake -f makefile.vc TCLDIR=D:\Ruby23-x86\src\externalnmake -f makefile.vc TCLDIR=E:\Projects\BuildRuby231\external\tcl8.5.19nmake -f makefile.vc install-libraries INSTALLDIR=D:\Ruby23-x86\src\externalnmake -f makefile.vc install-binaries INSTALLDIR=D:\Ruby23-x86\src\external#zlibcd E:\Projects\BuildRuby231\external\zlib-1.2.8nmake -f win32/Makefile.msc#config ruby sourceset INCLUDE=D:\Ruby23-x86\src\external\include;D:\Ruby23-x86\src\external\include\libxml2;E:\Projects\BuildRuby231\external\qdbm-1.8.78;E:\Projects\BuildRuby231\external\zlib-1.2.8;%INCLUDE%set LIB=D:\Ruby23-x86\src\external\lib;E:\Projects\BuildRuby231\external\qdbm-1.8.78;E:\Projects\BuildRuby231\external\zlib-1.2.8;%LIB%cd E:\Projects\BuildRuby231d:\Ruby23-x86\src\win32\configure.bat --prefix=/Ruby23-x86 --disable-install-docnmake##退出再进入,有bug,路径会乱cd E:\Projects\BuildRuby231set PATH=D:\Ruby23-x86\src\external\bin;%PATH%nmake install DESTDIR=D:#libiconv msvc-2008cd E:\Projects\BuildRuby231\external\libiconv-1.11.1nmake -f Makefile.msvc  DLL=1  MFLAGS=-MT  NO_NLS=1  PREFIX=D:\Ruby23-x86\src\externalnmake -f Makefile.msvc install  DLL=1  MFLAGS=-MT  NO_NLS=1  PREFIX=D:\Ruby23-x86\src\external#libxml2cd E:\Projects\BuildRuby231\external\libxml2-2.9.4\win32cscript configure.js prefix=D:\Ruby23-x86\src\external include=D:\Ruby23-x86\src\external\include;D:\Ruby23-x86\src\external\include\libxml2 lib=D:\Ruby23-x86\src\external\libnmake /f Makefile.msvc cleannmake /f Makefile.msvcnmake /f Makefile.msvc install#libxsltcd E:\Projects\BuildRuby231\external\libxslt-1.1.29\win32cscript configure.js prefix=D:\Ruby23-x86\src\external include=D:\Ruby23-x86\src\external\include;D:\Ruby23-x86\src\external\include\libxml2 lib=D:\Ruby23-x86\src\external\libnmake /f Makefile.msvc cleannmake /f Makefile.msvcnmake /f Makefile.msvc install#nokogiriset PATH=D:\Ruby23-x86\src\external\bin;D:\Ruby23-x86\src\external\lib;%PATH%cd d:\Ruby23-x86\bind:gem update --systemgem install nokogiri -- --use-system-libraries --with-opt-include=D:\Ruby23-x86\src\external\include;D:\Ruby23-x86\src\external\include\libxml2 --with-opt-lib=D:\Ruby23-x86\src\external\lib#sqlite3cd E:\Projects\BuildRuby231\external\sqlite-dll-win32-x86-3140100e:lib /def:sqlite3.def /out:sqlite3.lib /machine:x86cd d:\Ruby23-x86\bind:gem install sqlite3 -- --with-opt-include=E:\Projects\BuildRuby231\external\sqlite-autoconf-3140100 --with-opt-lib=E:\Projects\BuildRuby231\external\sqlite-dll-win32-x86-3140100#oracle dbicd d:\Ruby23-x86\bind:gem install dbiset ORACLE_HOME=D:\oracle\instantclient-nt-12.1.0.2.0set PATH=D:\oracle\instantclient-nt-12.1.0.2.0;%PATH%gem install ruby-oci8 -- --with-opt-include=D:\oracle\instantclient-nt-12.1.0.2.0\sdk\include --with-opt-lib=D:\oracle\instantclient-nt-12.1.0.2.0\sdk\lib\msvc

0 0