building guides/scripts

Discussion related to the development of project wide documentation and tutorials.
Coordinator: 'Abel'

Moderator: coordinators

building guides/scripts

Postby orbisvicis » Mon Sep 27, 2010 6:07 pm

The first is an automated script to automatically build and upgrade {boost,luxrays,lux,blender,pylux} outside of the FHS (read::any one central location). Doesn't require root access. It should 'just work' but since it was geared towards Arch Linux, hey, it might not - you never know. On an architectural note, keep in mind that make -j 2 will build for 2 cores - as in my laptop.

The second is a rough guide/script to build a *static* luxrender {luxconsole,luxcomp,luxmerger} on a barebones RHEL5 server system without administrative privileges, with limited space, and without OpenCL support. By barebones I mean minimal - any system with libc/pthread, xorg, and libpng. One note - the dependencies are listed in reverse order, so read bottom-up. weird.

I hope this comes in handy!
P.S Also hope the CMakeLists.txt modifications get pushed/fixed.
P.P.S Uploading to separate posts since none of the {txt,text,sh,odt,etc,"",..} extensions are allowed.
orbisvicis
 
Posts: 23
Joined: Sun Sep 12, 2010 1:40 am

Re: building guides/scripts

Postby orbisvicis » Mon Sep 27, 2010 6:08 pm

Code: Select all
# Locations: Must exist beforehand
#hg clone http://src.luxrender.net/lux/ lux-hg
#hg clone http://src.luxrender.net/luxblend25/ luxblend25-hg
#hg clone http://src.luxrender.net/luxfire/ luxfire-hg
#hg clone http://src.luxrender.net/luxrays/ luxrays-hg
#
#http://aur.archlinux.org/packages/luxrender-hg/luxrender-hg/libpng.patch as lux-libpng.patch
#
#git clone git://github.com/doughammond/exporterframework.git
#svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/blender
#
#http://www.khronos.org/registry/cl/ in OpenCL/CL/

BASE_PATH="/home/${USER}/Q/luxrender-blender-vcs"
cd $BASE_PATH

# Boost
# Assume Boost is already up to date
PROCESS_BOOST=0
BOOST_VERSION="1_43_0"
if [[ PROCESS_BOOST -eq 1 ]]; then
    [[ -d boost ]] && rm -rf boost
    mkdir boost
    (   cd boost
        wget "http://downloads.sourceforge.net/sourceforge/boost/boost_${BOOST_VERSION}.tar.bz2"
        tar xvjf "boost_${BOOST_VERSION}.tar.bz2"
        cd "boost_${BOOST_VERSION}"
        ./bootstrap.sh --prefix="${BASE_PATH}/boost/boost_${BOOST_VERSION}_install/" --with-python-version=3.1
        # default "minimal" install:
        #   "variant=release link=shared,static runtime-link=shared threading=multi"
        # --layout=tagged will add the "-mt" suffix for multithreaded libraries
        #./bjam install
        ./bjam --layout=tagged install
        #./bjam \
        #  variant=release \
        #  link=shared,static \
        #  runtime-link=shared \
        #  threading=single,multi \
        #  --layout=tagged \
        #  install
    )
fi

# OpenCL
# OpenCL headers aren't updated very often

# Luxrays
(   cd luxrays-hg && hg update
)
[[ -d luxrays-build ]] && rm -rf luxrays-build
cp -a luxrays-hg luxrays-build
(   cd luxrays-build
    cmake \
      -DOCL_INCLUDE_PATH="${BASE_PATH}/OpenCL/" \
      -DBOOST_ROOT="${BASE_PATH}/boost/boost_${BOOST_VERSION}_install/" \
      .
    make -j 2
)

# Luxrender
(   cd lux-hg && hg update
)
[[ -d lux-build ]] && rm -rf lux-build
cp -a lux-hg lux-build
(   cd lux-build
    patch -Np1 < ${BASE_PATH}/lux-libpng.patch
    cmake \
      -DOPENCL_INCLUDE_DIRS="${BASE_PATH}/OpenCL/" \
      -DLUXRAYS_INCLUDE_DIRS="${BASE_PATH}/luxrays-build/include/" \
      -DLUXRAYS_LIBRARY="${BASE_PATH}/luxrays-build/lib/libluxrays.a" \
      -DPYTHON_INCLUDE_DIR="/usr/include/python3.1/" \
      -DPYTHON_LIBRARY="/usr/lib/libpython3.1.so" \
      -DBOOST_ROOT="${BASE_PATH}/boost/boost_${BOOST_VERSION}_install/" \
      .
    make -j 2
)

# Blender
(   cd blender
    [[ ! -f blender-svn/user-config.py ]] && cp user-config.py blender-svn/user-config.py
    [[ -d build ]] && rm -rf build
    [[ -d install ]] && rm -rf install

    cd blender-svn
    svn update
    scons -j 2
)

# LuxBlend25
(   cd luxblend25-hg && hg update
)

# ExporterFramework
(   cd exporterframework-git && git pull
)

# Blender Integration
BLENDER_VERSION=${BASE_PATH}/blender/install/linux2/2.*
BLENDER_VERSION=$(basename $BLENDER_VERSION)
[[ ! -L ${BASE_PATH}/blender/install/linux2/${BLENDER_VERSION}/scripts/io/ef ]]                     && ln -s ${BASE_PATH}/exporterframework-git/ef          ${BASE_PATH}/blender/install/linux2/${BLENDER_VERSION}/scripts/io/
[[ ! -L ${BASE_PATH}/blender/install/linux2/${BLENDER_VERSION}/scripts/addons/luxrender ]]          && ln -s ${BASE_PATH}/luxblend25-hg/src/luxrender       ${BASE_PATH}/blender/install/linux2/${BLENDER_VERSION}/scripts/addons/
[[ ! -L ${BASE_PATH}/blender/install/linux2/${BLENDER_VERSION}/scripts/addons/luxrender/pylux.so ]] && ln -s ${BASE_PATH}/lux-build/pylux.so                ${BASE_PATH}/blender/install/linux2/${BLENDER_VERSION}/scripts/addons/luxrender/
[[ ! -L ${BASE_PATH}/blender.run ]]                                                                 && ln -s ${BASE_PATH}/blender/install/linux2/blender    ${BASE_PATH}/blender.run
orbisvicis
 
Posts: 23
Joined: Sun Sep 12, 2010 1:40 am

Re: building guides/scripts

Postby orbisvicis » Mon Sep 27, 2010 6:08 pm

Code: Select all
#!/bin/bash
BASE_PATH="/tmp/luxrender-build"

lux:
    source /tmp/luxrender-build/python-virtual-mercurial/bin/activate
    # not necessary anymore, use dougal2's bitbucket mirror at:
    # http://bitbucket.org/luxrender/lux/
    clone_status=255; while [[ clone_status -ne 0 ]]; do hg clone http://src/luxrender.net/lux/ lux-hg; clone_status=$?; done
    # disable any target depending on gui toolkits
    sed -i 's|INSTALL(TARGETS luxrender luxconsole luxmerger RUNTIME DESTINATION bin)|INSTALL(TARGETS luxconsole luxmerger RUNTIME DESTINATION bin)|g' CMakeLists.txt
    # build against the openexr static libraries, and provide ld an additional path to search for openexr libraries
    sed -i 's|SET(OPENEXR_LIBRARIES Half IlmImf Iex Imath)|SET(OPENEXR_LIBRARIES Half.a IlmImf.a Iex.a Imath.a)|g' CMakeLists.txt
    CMakeLists.txt:182:LINK_DIRECTORIES(${OPENEXR_INCLUDE_DIRS}/../../lib)
    # add the missing freeimage headers
    #CMakeLists.txt:243:INCLUDE_DIRECTORIES(${FREEIMAGE_INCLUDE_PATH})
    CMakeLists.txt:746:${FREEIMAGE_INCLUDE_PATH}
    /tmp/luxrender-build/cmake/cmake-2.8.2/bin/cmake \
        -DOCL_INCLUDE_PATH=/tmp/luxrender-build/OpenCL/ \
        -DBOOST_ROOT=/tmp/luxrender-build/boost/boost_1_43_0_install/ \
        -DBoost_USE_STATIC_LIBS=ON \
        -DFREEIMAGE_INCLUDE_PATH=/tmp/luxrender-build/freeimage/FreeImage_install/usr/include/ \
        -DFREEIMAGE_LIBRARY=/tmp/luxrender-build/freeimage/FreeImage_install/usr/lib/libfreeimage.a \
        -DLUXRAYS_INCLUDE_DIRS=/tmp/luxrender-build/luxrays-build/include/ \
        -DLUXRAYS_LIBRARY=/tmp/luxrender-build/luxrays-build/lib/libluxrays.a \
        -DOPENEXR_INCLUDE_DIRS=/tmp/luxrender-build/openexr/openexr_install/include/OpenEXR/ \
        -DLUXRAYS_DISABLE_OPENCL=true \
    .
    make -j 4

luxrays:
    CMakeLists.txt:111:INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
    CMakeLists.txt:97:INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR})
    CMakeLists.txt:98:INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
    /tmp/luxrender-build/cmake/cmake-2.8.2/bin/cmake \
        -DOCL_INCLUDE_PATH=/tmp/luxrender-build/OpenCL/ \
        -DBOOST_ROOT=/tmp/luxrender-build/boost/boost_1_43_0_install/ \
        -DFREEIMAGE_INCLUDE_PATH=/tmp/luxrender-build/freeimage/FreeImage_install/usr/include/ \
        -DFREEIMAGE_LIBRARY=/tmp/luxrender-build/freeimage/FreeImage_install/usr/lib/libfreeimage.a \
        -DGLEW_INCLUDE_DIR=/tmp/luxrender-build/glew/glew-1.5.5_install/include/ \
        -DGLEW_LIBRARY=/tmp/luxrender-build/glew/glew-1.5.5_install/lib/libGLEW.so \
        -DGLUT_INCLUDE_DIR=/tmp/luxrender-build/freeglut/freeglut-2.6.0_install/usr/include/ \
        -DGLUT_glut_LIBRARY=/tmp/luxrender-build/freeglut/freeglut-2.6.0_install/usr/lib/libglut.a \
        -DLUXRAYS_DISABLE_OPENCL=true \
    .
    make -j 4

freeimage:
    sed -i "s|-o root|-o $(id -u -n)|g" Makefile.gnu
    sed -i "s|-g root|-g $(id -g -n)|g" Makefile.gnu
    sed -i 's|ldconfig|#ldconfig|g' Makefile.gnu
    make
    make DESTDIR=... install

glew:
    make
    make GLEW_DEST=... install

freeglut:
    ./configure --prefix=/usr
    make all
    make DESTDIR=... install

python-virtual-mercurial:

virtualenv:

OpenCL:

boost:
    BOOST_VERSION="1_43_0"
    mkdir boost
    cd boost
    wget "http://downloads.sourceforge.net/sourceforge/boost/boost_${BOOST_VERSION}.tar.bz2"
    tar xvjf "boost_${BOOST_VERSION}.tar.bz2"
    cd "boost_${BOOST_VERSION}"
    ./bootstrap.sh --prefix="${BASE_PATH}/boost/boost_${BOOST_VERSION}_install/"
    ./bjam --layout=tagged install

cmake:

# the openexr project components (openexr and ilmbase)
# must be installed to the same location
openexr:
    ILMBASE_VERSION=1.0.1
    OPENEXR_VERSION=1.6.1
    OPENEXR_INSTALL="${BASE_PATH}/openexr/openexr_install"
    mkdir openexr
    cd openexr
    wget "http://savannah.nongnu.org/download/openexr/ilmbase-${ILMBASE_VERSION}.tar.gz"
    wget "http://savannah.nongnu.org/download/openexr/openexr-${OPENEXR_VERSION}.tar.gz"
    tar xvzf "ilmbase-${ILMBASE_VERSION}.tar.gz"
    tar xvzf "openexr-${OPENEXR_VERSION}.tar.gz"

    # ilmbase:
    # lack of trailing slash important to libtool
    (   cd "ilmbase-${ILMBASE_VERSION}"
        ./configure --prefix="${OPENEXR_INSTALL}"
        make
        make install
    )

    # openexr
    # lack of trailing slash important to libtool
    (   cd "openexr-${OPENEXR_VERSION}"
        export CXX="g++ -lrt -fPIC"
        export CC="gcc -lrt -fPIC"
        ./configure \
            --prefix="${OPENEXR_INSTALL}" \
            --with-ilmbase-prefix="${OPENEXR_INSTALL}" \
            LD_LIBRARY_PATH="${OPENEXR_INSTALL}/lib"
        make
        make install
        # unset CXX
        # unset CC
    )
orbisvicis
 
Posts: 23
Joined: Sun Sep 12, 2010 1:40 am


Return to Documentation & Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests