Difference between revisions of "User:Luigi.scarso/luatex lunatic"

From Wiki
Jump to navigation Jump to search
Line 29: Line 29:
 
Also, I'm not concerned about portability: so I will talk only about Linux .
 
Also, I'm not concerned about portability: so I will talk only about Linux .
  
'' '''luatex_lunatic''' was born to answer to (my) question "Can I apply lunatic to luatex ?" and nothing else.''
+
''Please note that '''luatex_lunatic''' was born to answer to (my) question "Can I apply lunatic to luatex ?" and nothing else.''
  
 
'' Every others meanings can be interestring, but are not mine .''
 
'' Every others meanings can be interestring, but are not mine .''

Revision as of 22:42, 9 March 2009

Introduction


!! W A R N I N G !!


!! THIS CODE IS HIGHLY EXPERIMENTAL !!


!! THIS CODE IS TESTED ONLY UNDER LINUX !!


luatex_lunatic is a modification of lua side of luatex to host a python interpreter inside lua . (see lunatic-python) .

I have made a set op patches is needed because :

  • by design, lua in luatex doesn't permit dynamic loading ("Dynamic loading of .so and .dll files is disabled on all platforms." see "LUA changes" in manual/luatexref-t.pdf of src/svn dist.)
  • to prevent symbols collisions between luatex and an arbitrary library

Having a python interpreter hosted in luatex can make easy to use existing python's bindings (also Python releases includes at least from 2.5 a ctypes module that permit a binding to a .so without using SWIG or similar, similar to lua's loadlib) .

As general rule, I want the smallest set of patches ; so, for example, I have choose to not use a system libpng, even if it's easy to modify build.sh.linux to do so.

Also, I'm not concerned about portability: so I will talk only about Linux .

Please note that luatex_lunatic was born to answer to (my) question "Can I apply lunatic to luatex ?" and nothing else.

Every others meanings can be interestring, but are not mine .

How to

I prefear to put a bash script that can help to compile a luatex-lunatic binary.

##
## Sec. 0
## Safe exit 
## uncomment exit to go on
exit

##
##
## Sec. 1
## Setup
## 
##
$HOME="/opt/luatex/luatex-lunatic"
svn checkout svn://scm.foundry.supelec.fr/svn/luatex/tags/beta-0.35.0
#svn checkout svn://scm.foundry.supelec.fr/svn/luatex/trunk
bzr branch lp:lunatic-python
wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tar.bz2
tar -xjvf Python-2.6.1.tar.bz2 
cd  Python-2.6.1
./configure --prefix=$HOME --enable-unicode=ucs4 --enable-shared
make && make install
cp python2.6.conf /etc/ld.so.conf.d
ldconfig
##
## install setuptools
echo "Please install setuptools"
echo "(cfr  http://pypi.python.org/pypi/setuptools)"
echo "in $HOME" 
##
## comment exit to go on
exit

##
##
## Sec 2
## Patch and build luatex
##
##
cd $HOME 
#ln -s trunk luatex
##
## build lunatic
##
ln -s beta-0.35.0 luatex
patch -N --backup <0000_lunatic-python_setup.py.patch  lunatic-python/setup.py
cd lunatic-python
../bin/python setup.py build
../bin/python setup.py install --root=/ --prefix=$HOME --install-script=$HOME/bin
cd $HOME
##
## This patch set 
## CFLAGS="-g -O2 -Wno-write-strings -fvisibility=hidden"
## to avoid symbols conflicts
patch -N --backup <0500_build.sh.linux.patch luatex/build.sh.linux
##
## These patches 
## permits dynamic loading of shared libs.
##
patch -N --backup <1000_luatex_src_libs_lua51_loadlib.c.patch luatex/src/libs/lua51/loadlib.c
patch -N --backup <2000_luatex_src_libs_lua51_Makefile.patch  luatex/src/libs/lua51/Makefile
patch -N --backup <3000_luatex_src_texk_web2c_configure.patch luatex/src/texk/web2c/configure
##
## Build luatex
##
cd luatex
./build.sh.linux &> out 
cd $HOME
mkdir tests
##
## "Unhide" visibility of lua51
##
cd luatex-lunatic/luatex/build/libs/lua51
make -B posix
##
## Re-compile luatex
##
cd $HOME
cd luatex-lunatic/luatex/build/texk/web2c
g++ -o luatex  luatexini.o luatex0.o luatex1.o luatex2.o luatex3.o luatexextra.o luatex-pool.o   luatexdir/libpdf.a ../../libs/libpng/libpng.a ../../libs/zlib/libz.a ../../libs/xpdf/xpdf/libxpdf.a ../../libs/xpdf/goo/libGoo.a ../../libs/xpdf/fofi/libfofi.a ../../libs/md5/md5.o ../../libs/obsdcompat/libopenbsd-compat.a ../../libs/lua51/liblua.a ../../libs/slnunicode/slnunico.o  ../../libs/luazip/src/luazip.o ../../libs/zziplib/zzip/libzzip.a ../../libs/luafilesystem/src/lfs.o ../../libs/luasocket/src/socket.a ../../libs/luapeg/lpeg.o ../../libs/luamd5/md5lib.o ../../libs/luamd5/md5.o  ../../libs/luazlib/lgzip.o ../../libs/luazlib/lzlib.o ../../libs/luafontforge/libff.a ../../libs/luaprofiler/libprofiler.a mpdir/lmplib.o mpdir/.libs/libmplib.a   lib/lib.a ../kpathsea/.libs/libkpathsea.a -lm   -nodefaultlibs -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -ldl -lm -lgcc_eh -lgcc -lc -lgcc_eh -lgcc -Wl,-E -ldl -lreadline -lhistory -lncurses
##
##

The last line is:

g++ -o luatex luatexini.o luatex0.o luatex1.o luatex2.o luatex3.o luatexextra.o luatex-pool.o luatexdir/libpdf.a ../../libs/libpng/libpng.a ../../libs/zlib/libz.a ../../libs/xpdf/xpdf/libxpdf.a ../../libs/xpdf/goo/libGoo.a ../../libs/xpdf/fofi/libfofi.a ../../libs/md5/md5.o ../../libs/obsdcompat/libopenbsd-compat.a ../../libs/lua51/liblua.a ../../libs/slnunicode/slnunico.o ../../libs/luazip/src/luazip.o ../../libs/zziplib/zzip/libzzip.a ../../libs/luafilesystem/src/lfs.o ../../libs/luasocket/src/socket.a ../../libs/luapeg/lpeg.o ../../libs/luamd5/md5lib.o ../../libs/luamd5/md5.o ../../libs/luazlib/lgzip.o ../../libs/luazlib/lzlib.o ../../libs/luafontforge/libff.a ../../libs/luaprofiler/libprofiler.a mpdir/lmplib.o mpdir/.libs/libmplib.a lib/lib.a ../kpathsea/.libs/libkpathsea.a -lm -nodefaultlibs -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -ldl -lm -lgcc_eh -lgcc -lc -lgcc_eh -lgcc -Wl,-E -ldl -lreadline -lhistory -lncurses

Python packages

  • numpy ✔
  • scipy ✔
  • matplot ✔
  • odfpy ✔
  • TO FIX ; pygegl
  • TODO: libtiff
  • TODO :gle (for "Max" Dominici, GUIT)
  • TODO :PIL, python imaging library
  • TODO : binding to VIPS
  • ....

Bindings

  • ghostscript 8.64 ✔
  • graphviz 2.22.0 ✔
  • ImageMagick-6.4.9 with pythonmagickwand ✔
  • fontforge 20090224 ✔
  • R-2.8.1 with rpy2-2.0.3 (For "Mau" Himmelmann, GUIT) ✔
  • TODO: quantalib

SageMath

Done, but need a deep cleaning...

Root (CERN)

Maybe