POV-Ray : Newsgroups : povray.windows : povdos needed : Re: povdos needed Server Time
1 Feb 2023 19:44:30 EST (-0500)
  Re: povdos needed  
From: Rocco
Date: 8 Nov 2015 09:15:05
Message: <web.563f581a405ef3d9a6fce6540@news.povray.org>
Hi!

After some searching, I think I'm on the right path to compile a console version
of POVRay for Windows using MinGW64. I have all dependencies compiled without
problem, the problem now is to make changes to use Windows console because the
source code is configured in the Unix philosophy, using Unix functions for
console, so unavailable for Windows.

As I have no time to investigate on this right now, I share here my experience
so far, maybe it will be useful...

Tools and compilers needed
==========================
 * MinGW64 from http://mingw-w64.yaxm.org/doku.php

 * pkg-config from
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip
  glib :
http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.1-1_win32.zip

 * MSYS Extensions from
http://sourceforge.net/projects/mingw/files/MSYS/Extension/
  crypt : libcrypt-1.1_1-3-msys-1.0.13-dll-0.tar.lzma
  crypt : crypt-1.1_1-3-msys-1.0.13-bin.tar.lzma
  m4 : m4-1.4.16-2-msys-1.0.17-bin.tar.lzma
  perl : perl-5.8.8-1-msys-1.0.17-bin.tar.lzma

 * MSYS Dev from http://sourceforge.net/projects/mingw/files/MSYS/msysdev/
  autoconf : autoconf-2.68-1-msys-1.0.17-bin.tar.lzma
  automake : automake-1.11.1-1-msys-1.0.13-bin.tar.lzma

 * MSYS Base from http://sourceforge.net/projects/mingw/files/MSYS/Base/
  bash : bash-3.1.23-1-msys-1.0.18-bin.tar.xz
  coreutils : coreutils-5.97-3-msys-1.0.13-bin.tar.lzma
  coreutils : coreutils-5.97-3-msys-1.0.13-ext.tar.lzma
  findutils : findutils-4.4.2-2-msys-1.0.13-bin.tar.lzma
  gawk : gawk-3.1.7-2-msys-1.0.13-bin.tar.lzma
  grep : grep-2.5.4-2-msys-1.0.13-bin.tar.lzma
  libiconv : libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma
  gettext : libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma
  regex : libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma
  termcap : libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma
  make : make-3.81-3-msys-1.0.13-bin.tar.lzma
  msys-core : msysCORE-1.0.18-1-msys-1.0.18-bin.tar.lzma
  msys-core : msysCORE-1.0.18-1-msys-1.0.18-ext.tar.lzma
  sed : sed-4.2.1-2-msys-1.0.13-bin.tar.lzma
  termcap : termcap-0.20050421_1-2-msys-1.0.13-bin.tar.lzma

 * Microsoft assembler 64 bit MASM (ML64.exe is part of Windows SDK, DDK
  or Visual Studio, I found it in my Visual Studio Express 2013 in
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64

 * CMake from http://www.cmake.org/

Dependencies
============
 Needed
 ======
 boost  http://www.boost.org
 zlib  http://www.zlib.net/
 jpeg  http://www.ijg.org/files/
 png  http://www.libpng.org/pub/png/libpng.html
 tiff  http://www.remotesensing.org/libtiff/

 Optional
 ========
 openexr  http://www.openexr.com/
 sdl 1.2  http://www.libsdl.org

Prepare a build environment
===========================
When I build with MinGW, I always have this directory
layout :

- The MinGW environment is installed in C:\MinGW.
- The CMake binaries are extracted in C:\MinGW\CMake
- The MSYS binaries (all MSYS-related stuff above) are
  extracted in C:\MinGW\MSYS
 => In MSYS, this directory is mapped as /
- pkg-config and its DLLs can be placed in C:\MinGW\MSYS
  (also copy msys-intl-8.dll to intl.dll in C:\MinGW\MSYS\bin

Run the postinstall\pi.bat script to initialize the environment
and set some directories (follow the instructions).

After first launch of MSYS, a directory is available : /home/<user>/
The source code packages go to /home/user/source
The build directory (with binaries and libs) is /build

So, excluding other files, this is how the directory structure looks like :
C:\MinGW
  cmake
  mingw64
  msys
    build
    home
      <user>
        source

After installation, I create a .bat file to set environment variables needed
(for example, to use CMake). This file is buildenv.bat and I place it in
/home/<user/. When using MSYS, I simply start the MSYS.bat in C:\MinGW\msys.

All the configure scripts have the prefix /build when using MSYS. When building
with other tools (for example CMake), I map a drive letter (Z) to the /build
folder.

Build environment (buildenv.bat) file
=====================================
@ECHO OFF
COLOR 1F
TITLE Build environment
ECHO Build environment
ECHO =================

SET PATH=C:\MinGW\msys\build\bin;%PATH%
SET PATH=C:\MinGW\msys\build\lib;%PATH%

SET PATH=C:\MinGW\mingw64\bin;%PATH%
SET PATH=C:\MinGW\cmake\bin;%PATH%
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64

SUBST Z: C:\MinGW\msys\build

CD C:\MinGW\msys\home
CMD

Install tools
=============
MinGW64
 Download from : http://mingw-w64.yaxm.org/doku.php
 mingw-w64-install.exe

 => C:\MinGW

MSYS build environment
 Download from : http://sourceforge.net/projects/mingw/files/MSYS/Base/
 => C:\MinGW\MSYS

CMake : http://www.cmake.org/
 => C:\MinGW\CMake

MASM 64 (or compatible assembler) : ml64.exe is included with Windows SDK,
DDK or Visual Studio.

Directories
%source% = C:\MinGW\MSYS\home\<user>\source
%build% = C:\MinGW\MSYS\build
%mingw% = C:\MinGW
%prefix% = /build (MSYS), Z:\ (CMake)

Set build virtual drive : subst z: %prefix%

Build environment
 set path=%mingw%\mingw64\bin;%path%
 set path=%mingw%\cmake\bin;%path%
 set path=%mingw%\swig;%path%

Compilation
===========
Please follow the order of dependencies.

ZLib (CMake)
============
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%prefix%
mingw32-make
mingw32-make install

ZLib (MSYS)
===========
mingw32-make -fwin32/makefile.gcc SHAREDLIB=libz.dll
mkdir -p %prefix%/bin
mkdir -p %prefix%/include
mkdir -p %prefix%/lib

cp libz.dll %prefix%/bin
cp zlib.h %prefix%include
cp lib.dll.a %prefix%/lib

JPEG (MSYS)
===========
../configure --prefix=%prefix%
make
make install

PNG (CMake)
==========
cmake -G "MinGW Makefiles"
 -DZLIB_ROOT=%prefix%\lib
 -DPNG_TESTS=OFF
 -DCMAKE_INSTALL_PREFIX=%prefix%
mingw32-make
mingw32-make install

TIFF (MSYS)
===========
../configure --prefix=%prefix%
 --with-zlib-include-dir=%prefix%/include
 --with-zlib-lib-dir=%prefix%/lib
 --with-jpeg-include-dir=%prefix%/include
 --with-jpeg-lib-dir=%prefix%/lib
make
make install

Boost
=====
Open buildenv.bat and cd to boost dir
booststrap.bat gcc --prefix=Z:\
b2 toolset=gcc release
b2 toolset=gcc --prefix=Z:\ --variant=release --layout=tagged install

OpenEXR (CMake)
===============

// Build IlmBase
cmake -G "MinGW Makefiles"
 -DCMAKE_INSTALL_PREFIX=%prefix%
 -DNAMESPACE_VERSIONING=OFF
mingw32-make
mingw32-make install

// Build OpenEXR
Needs a modification, see https://github.com/openexr/openexr/issues/95

Edit IlmImf/ImfSystemSpecific.h, line 57 replace #ifdef __GNUC__ with
#if defined(__GNUC__) && !defined(__MINGW32__)

set path=%prefix\bin;%path%
set path=%prefix%\lib;%path%

cmake -G "MinGW Makefiles"
 -DZLIB_ROOT="%prefix%"
 -DILMBASE_PACKAGE_PREFIX="%prefix%"
 -DCMAKE_INSTALL_PREFIX="%prefix%"
 -DCMAKE_CXX_FLAGS="-fpermissive"
 -DNAMESPACE_VERSIONING=OFF

mingw32-make
mingw32-make install

!!! OpenEXR.pc was not created, I had to create it manually in
/build/lib/pkgconfig

Content of OpenEXR.pc :

prefix=/build
exec_prefix=/build
libdir=/build/lib
includedir=/build/include
OpenEXR_includedir=@includedir@/OpenEXR

Name: OpenEXR
Description: OpenEXR image library
Version: 2.2.0

Libs: -L${libdir} -lIlmImf
Cflags: -I${OpenEXR_includedir}
Requires: IlmBase
Libs.private: -lz


SDL (MSYS)
==========
../configure --prefix=/build
make
make install

POV-Ray (MSYS)
==============
// Patches
vfesession.h, vfeplatform.h
 #define uint unsigned int


In source folder cd unix
../prebuild.sh
cd ..
export LD_LIBRARY_PATH=%prefix%/lib
export LD_FLAGS=%prefix%/lib
export C_INCLUDE_PATH=%prefix%/include
export CPLUS_INCLUDE_PATH=%prefix%/include
export PATH=%prefix%/bin:$PATH
export PKG_CONFIG_PATH=%prefix%/lib/pkgconfig
../configure COMPILED_BY="your name <e-mail>" LIBS="-L/build/lib
-lboost_system-mt" --prefix=/build
make
make install


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.