Difference between revisions of "Curl on Windows"
(curl-7.35.0 patches) |
(→Building libcurl on Windows) |
||
Line 4: | Line 4: | ||
# http://curl.haxx.se/mail/lib-2014-02/0003.html | # http://curl.haxx.se/mail/lib-2014-02/0003.html | ||
# http://curl.haxx.se/mail/lib-2014-02/0097.html | # http://curl.haxx.se/mail/lib-2014-02/0097.html | ||
+ | This works with dmd 2.065 beta 3. It does not work with dmd 2.064. | ||
===Required tools=== | ===Required tools=== |
Revision as of 02:25, 12 February 2014
Contents
Building libcurl on Windows
As of curl-7.35.0 please apply the following patches.
This works with dmd 2.065 beta 3. It does not work with dmd 2.064.
Required tools
- MinGW (http://www.mingw.org)
- Digital Mars' implib (http://ftp.digitalmars.com/bup.zip)
- MinGW-w64 (http://mingw-w64.sourceforge.net/)
- Microsoft Librarian (lib.exe)
- pexports (http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/)
- Sample program app.d
import std.net.curl;
import std.stdio;
void main()
{
writeln(get("https://google.com/"));
}
Building libcurl 32 bit
- Create directory C:\BUILD
- Download curl-7.33.0.zip from http://curl.haxx.se/download.html and extract it into C:\BUILD
- Download zlib-1.2.8.tar.gz from http://zlib.net/ and extract it into C:\BUILD
- Save the following batch file as C:\BUILD\build-curl32.bat
- Run build-curl32 from Windows command prompt
@echo off
:: 1) Path to MinGW\bin
:: 2) Path to Digital Mars's implib.exe
SET PATH=C:\Dev\MinGW\bin;C:\Dev\dm\bin;
SET ZLIB_PATH=C:\BUILD\zlib-1.2.8
SET INSTALL_DIR=C:\D\dmd2\windows
:: ---------------------------------------------------------------
:: Delete object files from previous build
del /S zlib-1.2.8\*.o curl-7.33.0\*.o curl-7.33.0\*.res
cd zlib-1.2.8
mingw32-make -fwin32/Makefile.gcc
cd ..
cd curl-7.33.0
mingw32-make -C lib -f Makefile.m32 CFG=mingw32-winssl-zlib LDFLAGS=-static
strip -s lib\libcurl.dll
mkdir %INSTALL_DIR%\bin %INSTALL_DIR%\lib
copy lib\libcurl.dll %INSTALL_DIR%\bin
implib /system %INSTALL_DIR%\lib\curl.lib lib\libcurl.dll
cd ..
:: Build sample
SET PATH=%INSTALL_DIR%\bin
dmd app.d -ofapp32.exe
app32
Building libcurl 64 bit
- Create directory C:\BUILD
- Download curl-7.33.0.zip from http://curl.haxx.se/download.html and extract it into C:\BUILD
- Download zlib-1.2.8.tar.gz from http://zlib.net/ and extract it into C:\BUILD
- Save the following batch file as C:\BUILD\build-curl64.bat
- Run build-curl64 from Windows command prompt
@echo off
:: 1) Path to MinGW-w64\bin
:: 2) Path to Microsoft LIB.exe
:: 3) Path to pexports.exe (http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/)
SET PATH=C:\Dev\MinGW64\bin;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64;C:\Dev\MinGW\bin
SET ZLIB_PATH=C:\BUILD\zlib-1.2.8
SET INSTALL_DIR=C:\D\dmd2\windows
:: ---------------------------------------------------------------
:: Delete object files from previous build
del /S zlib-1.2.8\*.o curl-7.33.0\*.o curl-7.33.0\*.res
cd zlib-1.2.8
mingw32-make -fwin32/Makefile.gcc
cd ..
cd curl-7.33.0
mingw32-make -C lib -f Makefile.m32 CFG=mingw32-winssl-zlib LDFLAGS=-static
strip -s lib\libcurl.dll
mkdir %INSTALL_DIR%\bin64 %INSTALL_DIR%\lib64
copy lib\libcurl.dll %INSTALL_DIR%\bin64
pexports lib\libcurl.dll > curl.def
lib /MACHINE:X64 /DEF:curl.def /OUT:%INSTALL_DIR%\lib64\curl.lib
cd ..
:: Build sample
SET PATH=%INSTALL_DIR%\bin64;%INSTALL_DIR%\bin
dmd -m64 app.d -ofapp64.exe
app64