From 2307c44870d901a57e840edd4f1166c1cd8338cf Mon Sep 17 00:00:00 2001 From: scuri Date: Thu, 21 Oct 2010 17:15:08 +0000 Subject: *** empty log message *** --- config_lua_module | 39 ++++++++++ html/download/.cvsignore | 3 + html/en/building.html | 183 ++++++++++++++++++++++++++++++++--------------- install | 100 ++++++++++++++++++++++++++ install_dev | 102 ++++++++++++++++++++++++++ test/simple/.cvsignore | 3 +- 6 files changed, 373 insertions(+), 57 deletions(-) create mode 100644 config_lua_module create mode 100644 install create mode 100644 install_dev diff --git a/config_lua_module b/config_lua_module new file mode 100644 index 0000000..c7a5f3a --- /dev/null +++ b/config_lua_module @@ -0,0 +1,39 @@ +#!/bin/bash + +echo ' ' +echo ' This script will configure the Tecgraf libraries in the system' +echo ' to be used from Lua. It was tested only in Ubuntu.' +echo ' ' +echo ' The Run Time libraries must be already installed on the system.' +echo ' ' +echo ' Must be run with "sudo", or install will fail,' +echo ' for example:' +echo ' sudo ./config_lua_module' +echo ' ' +echo -n Press Enter to continue or Ctrl+C to abort... +read contscr +echo ' ' + +mkdir -p /usr/lib/lua/5.1 +cd /usr/lib/lua/5.1 + +# ln -fsv /usr/lib/libiuplua51.so iuplua.so +# ln -fsv /usr/lib/libiupluacontrols51.so iupluacontrols.so +# ln -fsv /usr/lib/libiupluacd51.so iupluacd.so +# ln -fsv /usr/lib/libiupluagl51.so iupluagl.so +# ln -fsv /usr/lib/libiuplua_pplot51.so iuplua_pplot.so +# ln -fsv /usr/lib/libiupluaim51.so iupluaim.so +# ln -fsv /usr/lib/libiupluaimglib51.so iupluaimglib.so +# ln -fsv /usr/lib/libiupluatuio51.so iupluatuio.so + +ln -fsv /usr/lib/libcdlua51.so cdlua51.so +ln -fsv /usr/lib/libcdluacontextplus51.so cdluacontextplus.so +ln -fsv /usr/lib/libcdluacairo51.so cdluacairo.so +ln -fsv /usr/lib/libcdluagl51.so cdluagl.so +ln -fsv /usr/lib/libcdluaim51.so cdluaim.so +ln -fsv /usr/lib/libcdluapdf51.so cdluapdf.so + +# ln -fsv /usr/lib/libimlua51.so imlua.so +# ln -fsv /usr/lib/libimlua_process51.so imlua_process.so +# ln -fsv /usr/lib/libimlua_jp251.so imlua_jp2.so +# ln -fsv /usr/lib/libimlua_fftw51.so imlua_fftw.so diff --git a/html/download/.cvsignore b/html/download/.cvsignore index 7e9ea7e..a47299f 100644 --- a/html/download/.cvsignore +++ b/html/download/.cvsignore @@ -2,3 +2,6 @@ cd.chm cd.pdf gdiplus.* PDFlib-Lite-license.pdf +install_dev +install +config_lua_module \ No newline at end of file diff --git a/html/en/building.html b/html/en/building.html index 32b6691..737cf1c 100644 --- a/html/en/building.html +++ b/html/en/building.html @@ -11,10 +11,12 @@

Building Lua, IM, CD and IUP in Linux

This is a guide to build all the Lua, IM, CD and IUP libraries in Linux. -Notice that you may not use all the libraries, but this guide will build all of -them. Later on it is explained how to build a single library.

+Notice that you may not use all the libraries, although this guide will show you +how to build all of +them. You may then choose to build specific libraries.

+

The Linux used as reference is the Ubuntu distribution.

System Configuration

-

You will have to download the development version of some packages installed +

To build the libraries you will have to download the development version of some packages installed on your system. Although the run time version of some of these packages are already installed, the development versions are usually not. The packages described here are for Ubuntu, but you will be able to identify them for other @@ -24,7 +26,8 @@ systems as well.

To build IM you will need:

g++

To build CD you will need:

-
libx11-dev
+
libfreetype6-dev
+libx11-dev
 libxpm-dev
 libxmu-dev
   libxft-dev (for the XRender driver, OPTIONAL)
@@ -34,9 +37,12 @@ libgtk2.0-dev (for the GDK driver)
libgtk2.0-dev (for the GTK driver) [already installed for CD]
   libmotif-dev and x11proto-print-dev (for the Motif driver, OPTIONAL)
 libgl1-mesa-dev and libglu1-mesa-dev (for the IupGLCanvas)
-

Download

+

To install them you can use the Synaptic Package Manager and select the +packages, or can use the command line and type:

+
sudo apt-get install package_name
+

Source Download

Download the "xxx-X.X_Sources.tar.gz" package from the "Docs and Sources" -folder for the version you want to build. Here are links for the Files section +directory for the version you want to build. Here are links for the Files section in Source Forge:

Lua - http://sourceforge.net/projects/luabinaries/files/
@@ -46,73 +52,138 @@ CD - http://sourceforge.net/projects/canvasdraw/files/
IUP - http://sourceforge.net/projects/iup/files/

-

Lua

-

Although we use Lua from LuaBinaries, any Lua installation can also be used. -But you will have to define some environment variables before building IM, CD and -IUP. Here is an example:

-
export LUA_SUFFIX=
-export LUA_INC=/usr/local/include      [actually NOT necessary, this one is already used by gcc/g++]
-export LUA_LIB=/usr/local/lib          [            "         ]
-export LUA_BIN=/usr/local/bin          [necessary because luac will not be used from the PATH]
-

The tools bin2c and luac are necessary only if you need to rebuild LOH files. -But since the source packages already includes them, those tools are in fact not -necessary.

Unpacking

+

To extract the files use the tar command at a common directory, for example:

+
mkdir -p xxxx
+cd xxxx
+
+[copy the downloaded files, to the xxxx directory]
+
+tar -xpvzf iup-3.2_Sources.tar.gz
+tar -xpvzf cd-5.4_Sources.tar.gz
+tar -xpvzf im-3.6.2_Sources.tar.gz
+tar -xpvzf lua5_1_4_Sources.tar.gz    [optional, see note bellow]

If you are going to build all the libraries, the makefiles and projects expect the following directory tree:

/xxxx/
-      iup/
       cd/
       im/
-      lua5.1/  [optional]
+ iup/ + lua5.1/ [optional, see note bellow]
-

So, unpack all the source packages in the same folder that will do fine.

+

If you unpack all the source packages in the same directory, that structure will +be automatically created.

+

Lua

+

Although we use Lua from LuaBinaries, any Lua installation can also be used. +In Ubuntu, the Lua run time package is:

+
lua5.1
+

And the Lua development package is:

+
liblua5.1-0-dev
+

To use them, instead of using the directory "/xxxx/lua5.1" described above, you will have to define some environment variables before building IM, CD and +IUP:

+
export LUA_SUFFIX=
+export LUA_INC=/usr/include/lua5.1

Building

As a general rule (excluding system dependencies): IUP depends on CD and IM, and CD depends on IM. So start by build IM, then CD, then IUP.

-

To start building go the the "src" folder and type "make". In IUP there are -many "srcxxx" folders, so go to the up folder "iup" and type +

To start building go the the "src" directory and type "make". In IUP there are +many "srcxxx" folders, so go to the up directory "iup" and type "make" that all the -sub folders will be built.

-

Instead of building all the libraries, try building only the libraries you +sub folders will be built. For example:

+
cd im/src
+make
+cd ../..
+
+cd cd/src
+make
+cd ../..
+
+cd iup
+make
+cd ..
+

TIP: Instead of building all the libraries, try building only the libraries you are going to use. The provided makefiles will build all the libraries, but take a look inside them and you will figure out how to build just one library.

-

Installation

- -

After building you can copy the libraries files to the system folder. This is -not necessary since you can use -I and -L on your makefiles, but it can be done. -If you are inside one of the libraries main folder you can type:

-
cp lib/Linux26g4/* /usr/local/lib
-cp include/* /usr/local/include
-

This will copy run time and development files. If you just want the run time, -then do simply:

-
cp lib/Linux26g4/*.so /usr/local/lib
-

Also when coping development folders, if you want to keep the library headers -in a separate folder, you can do:

-
cp -R iup/include /usr/local/include/iup
-cp -R cd/include /usr/local/include/cd
-cp -R im/include /usr/local/include/im
-

Then use in your makefile -Iiup -Icd -Iim.

-

This installation procedure also can be used for the pre-compiled binaries -packages available for download. They contain the development and run time files -you need.

-

If you don't want to copy the libraries to your system -folder, you can still use them, but you will need to add the binaries folders to +

Pre-compiled Binaries

+

Instead of building from sources you can try to use the pre-compiled +binaries. Usually they were build in the latest Ubuntu versions for 32 and 64 +bits. The packages are located in the "Linux Libraries" +directory +under the Files section +in Source Forge, with "xxx-X.X_Linux26g4_lib.tar.gz" +and "xxx-X.X_Linux26g4_64_lib.tar.gz" names.

+

Do not extract different pre-compiled binaries in the same directory, create a +subdirectory for each one, for example:

+
mkdir iup
+cd iup
+tar -xpvzf ../iup-3.2_Linux26g4_lib.tar.gz
+cd ..
+
+mkdir cd
+cd cd
+tar -xpvzf cd-5.4_Linux26g4_lib.tar.gz
+cd ..
+
+mkdir im
+cd im
+tar -xpvzf im-3.6.2_Linux26g4_lib.tar.gz
+cd ..
+
+
+

For the installation instructions bellow, remove the "lib/Linux26g4" from the +following examples if you are using the pre-compiled binaries.

+

Installation (System Directory)

+ +

After building you can copy the libraries files to the system directory. If you are inside +the main directory, to install the run time libraries you can type, for example:

+
sudo cp -f iup/lib/Linux26g4/*.so /usr/lib               [script version: install ]
+sudo cp -f cd/lib/Linux26g4/*.so /usr/lib                               
+sudo cp -f im/lib/Linux26g4/*.so /usr/lib
+

To install the development files, +then do:

+
sudo mkdir -p /usr/include/iup                           [script version: install_dev ]
+sudo cp -f iup/include/*.h /usr/include/iup             
+sudo cp -f iup/lib/Linux26g4/*.a /usr/lib                               
+
+sudo mkdir -p /usr/include/cd
+sudo cp -f cd/include/*.h /usr/include/cd
+sudo cp -f cd/lib/Linux26g4/*.a /usr/lib
+
+sudo mkdir -p /usr/include/im
+sudo cp -fR im/include/*.h /usr/include/im
+sudo cp -f im/lib/Linux26g4/*.a /usr/lib
+

Then in your makefile use -Iiup -Icd -Iim for includes. There is no need to +specify the libraries directory with -L. Development files are only necessary if +you are going to compile an application or library in C/C++ that uses there +libraries. To just run Lua scripts they are not necessary.

+

Installation (Build Directory) [Alternative]

+

If you don't want to copy the run time libraries to your system +directory, you can use them from build directory. You will need to add the run time +libraries folders to the LD_LIBRARY_PATH, for example:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/xxxx/iup/lib/Linux26g4:/xxxx/cd/lib/Linux26g4:/xxxx/im/lib/Linux26g4
-

In this case, in your makefile will will also need to specify those paths -when linking using -L/xxxx/iup/lib/Linux26g4.

-

Lua

-

If you are NOT using LuaBinaries then you have two options to be able to use -"require" with these libraries. You can create symbolic links in the Lua C -modules folder to the installed libraries run time:

-
ln -s /usr/local/lib/lipiuplua51.so /usr/local/lib/lua/5.1/iuplua.so
-ln -s /usr/local/lib/lipiupluacontrols51.so /usr/local/lib/lua/5.1/iupluacontrols.so
+

And in your makefile will will also need to specify those paths +when linking using -L/xxxx/iup/lib/Linux26g4, and for compiling use +-I/xxxx/iup/include.

+

Installation (Lua Modules)

+

Lua modules in Ubuntu are installed in the "/usr/lib/lua/5.1" +directory. So to +be able to use the Lua "require" with IUP, CD and IM you must create symbolic links inside +that directory.

+
sudo mkdir -p /usr/lib/lua/5.1                          [script version: config_lua_module ]
+cd /usr/lib/lua/5.1  
+       
+sudo ln -fs /usr/lib/libiuplua51.so iuplua.so
+sudo ln -fs /usr/lib/libiupluacontrols51.so iupluacontrols.so
 ...
-

You can set the LUA_CPATH environment variable:

-
export LUA_CPATH=./\?.so\;./lib\?.so\;./lib\?51.so\;
-
+

Using those links you do not need any extra configuration.

+

Installation (Lua Modules) [Alternative]

+

If you use the alternative installation directory, and you also +do NOT use the LuaBinaries installation, then you must set the LUA_CPATH environment variable:

+
export LUA_CPATH=./\?.so\;./lib\?.so\;./lib\?51.so\;
+


+

diff --git a/install b/install new file mode 100644 index 0000000..56fa745 --- /dev/null +++ b/install @@ -0,0 +1,100 @@ +#!/bin/bash + +echo ' ' +echo ' This script will install the >>Run Time<< libraries in the system' +echo ' from the build directories or from the unpacked download.' +echo ' It was tested only in Ubuntu.' +echo ' ' +echo ' Must be run with "sudo" at the library folder, or install will fail:' +echo ' sudo ./install' +echo ' ' + +EchoDownloadTip() +{ + echo ' The downloaded package must already be unpacked in the current directory.' + echo ' Do NOT unpack different packages in the same directory.' + echo ' For example:' + echo ' mkdir iup' + echo ' cd iup' + echo ' tar -xpvzf ../iup-3.2_Linux26g4_lib.tar.gz' + echo ' ' +} + +Pause() +{ + echo -n Press Enter to continue or Ctrl+C to abort... + read contscr + echo ' ' +} + +ComputeTecUname() +{ + TEC_SYSNAME=`uname -s` + TEC_SYSVERSION=`uname -r|cut -f1 -d.` + TEC_SYSMINOR=`uname -r|cut -f2 -d.` + TEC_SYSARCH=`uname -m` + + TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR + + # Linux 2.4 and GCC 3.x + if [ $TEC_UNAME == Linux24 ]; then + GCCVER=`gcc -dumpversion|cut -f1 -d.` + if [ $GCCVER == 3 ]; then + TEC_UNAME=$TEC_UNAME'g3' + fi + fi + + # Linux 2.6 and GCC 4.x + if [ $TEC_UNAME == Linux26 ]; then + GCCVER=`gcc -dumpversion|cut -f1 -d.` + if [ $GCCVER == 4 ]; then + TEC_UNAME=$TEC_UNAME'g4' + fi + fi + + # 64-bits Linux + if [ $TEC_SYSARCH == x64 ]; then + TEC_UNAME=$TEC_UNAME'_64' + fi +} + +Copy_RunTime_Extra_CD() +{ + # Do NOT overwrite for FreeType + cp -fn $1libfreetype.so /usr/lib + + cp -fv $1libpdflib.so /usr/lib + cp -fv $1libftgl.so /usr/lib +} + +Copy_RunTime_To_System() +{ + cp -fv $2lib$1*.so /usr/lib + + if [ $1 == cd ]; then + Copy_RunTime_Extra_CD $2 + fi +} + +Install_RunTime() +{ + if [ -d lib/$TEC_UNAME ]; then + echo ' Installing from build directory' lib/$TEC_UNAME + echo ' ' + Pause + Copy_RunTime_To_System $1 lib/$TEC_UNAME/ + else + echo ' The directory' lib/$TEC_UNAME 'was not found,' + echo ' so installing from unpacked download.' + echo ' ' + EchoDownloadTip + Pause + Copy_RunTime_To_System $1 + fi +} + +ComputeTecUname + +#Install_RunTime iup +Install_RunTime cd +#Install_RunTime im diff --git a/install_dev b/install_dev new file mode 100644 index 0000000..b0c6898 --- /dev/null +++ b/install_dev @@ -0,0 +1,102 @@ +#!/bin/bash + +echo ' ' +echo ' This script will install the >>Development<< files in the system' +echo ' from the build directories or from the unpacked download.' +echo ' It was tested only in Ubuntu.' +echo ' ' +echo ' Must be run with "sudo" at the library folder, or install will fail:' +echo ' sudo ./install_dev' +echo ' ' + +EchoDownloadTip() +{ + echo ' The downloaded package must already be unpacked in the current directory.' + echo ' Do NOT unpack different packages in the same directory.' + echo ' For example:' + echo ' mkdir iup' + echo ' cd iup' + echo ' tar -xpvzf ../iup-3.2_Linux26g4_lib.tar.gz' + echo ' ' +} + +Pause() +{ + echo -n Press Enter to continue or Ctrl+C to abort... + read contscr + echo ' ' +} + +ComputeTecUname() +{ + TEC_SYSNAME=`uname -s` + TEC_SYSVERSION=`uname -r|cut -f1 -d.` + TEC_SYSMINOR=`uname -r|cut -f2 -d.` + TEC_SYSARCH=`uname -m` + + TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR + + # Linux 2.4 and GCC 3.x + if [ $TEC_UNAME == Linux24 ]; then + GCCVER=`gcc -dumpversion|cut -f1 -d.` + if [ $GCCVER == 3 ]; then + TEC_UNAME=$TEC_UNAME'g3' + fi + fi + + # Linux 2.6 and GCC 4.x + if [ $TEC_UNAME == Linux26 ]; then + GCCVER=`gcc -dumpversion|cut -f1 -d.` + if [ $GCCVER == 4 ]; then + TEC_UNAME=$TEC_UNAME'g4' + fi + fi + + # 64-bits Linux + if [ $TEC_SYSARCH == x64 ]; then + TEC_UNAME=$TEC_UNAME'_64' + fi +} + +Copy_Dev_Extra_CD() +{ + # Do NOT overwrite for FreeType + cp -fn $1libfreetype.a /usr/lib + + cp -fv $1libpdflib.a /usr/lib + cp -fv $1libftgl.a /usr/lib +} + +Copy_Dev_To_System() +{ + mkdir -p /usr/include/$1 + cp -fv include/*.h /usr/include/$1 + cp -fv $2lib$1*.a /usr/lib + + if [ $1 == cd ]; then + Copy_Dev_Extra_CD $2 + fi +} + +Install_Dev() +{ + if [ -d lib/$TEC_UNAME ]; then + echo ' Installing from build directory' lib/$TEC_UNAME + echo ' ' + Pause + Copy_Dev_To_System $1 lib/$TEC_UNAME/ + else + echo ' The directory' lib/$TEC_UNAME 'was not found,' + echo ' so installing from unpacked download.' + echo ' ' + EchoDownloadTip + Pause + Copy_Dev_To_System $1 + fi +} + +ComputeTecUname + +#Install_Dev iup +Install_Dev cd +#Install_Dev im diff --git a/test/simple/.cvsignore b/test/simple/.cvsignore index 9c20a41..caaa435 100644 --- a/test/simple/.cvsignore +++ b/test/simple/.cvsignore @@ -19,4 +19,5 @@ Makefile *.ncb *.opt *.user -svg \ No newline at end of file +svg +simple.svg \ No newline at end of file -- cgit v1.2.3