Melhorias no build para usar o OiL mais atual

- OiL passou a depender do Luaiconv
- Jamroot do collaboration-service estava desatualizado
- Foi preciso compilar usando versões antigas do OpenBus 2.0
  e OpenBus IDL 2.0 e 1.5, então passei a usar variáveis na
  linha de comando, exemplo:
  -sLUAOPENBUS=/openbus-dev/packages/luaopenbus-v20
  -sOPENBUS_LEGACY_IDL=/openbus-dev/packages/openbus-legacy-idl-v15
  -sOPENBUS_LIB_IDL=/openbus-dev/packages/openbus-lib-idl-v20
  -sOPENBUS_IDL=/opendev/packages/openbus-legacy-idl

OPENBUS-3149
parent 59f18b9e
import modules ;
import loop ;
import oil ;
project collaboration-service
: build-dir build
;
oil.idl2lua parsed.lua
: idl/collaboration.idl
;
loop.pre-compile collaborationService.c
: [ glob-tree *.lua : test *.luad dist ]
parsed.lua
;
exe collaboration-service
: collaborationService.c
src/collaborationservlibs.c
src/launcher.c
/dl//dl
/lua//lua52
/e2fsprogs//uuid
/luuid//luuid
/openssl//openssl
/lce//lce
/luafilesystem//lfs
/luastruct//luastruct
/loop//luatuple /loop//luacothread
/loop//loop
/luavararg//luavararg
/oil//luaidl /oil//oil
/luasocket//luasocket2
/luascs//luascs
/luaopenbus//luaopenbus
/sqlite//sqlite3
/luasqlite//lsqlite3
: <include>src <implicit-dependency>collaborationService.h
;
install dist
: collaboration-service
parsed.lua
;
# -*- coding: iso-8859-1-unix -*-
import os ;
import modules ;
path-constant here : . ;
path-constant root : $(here)/.. ;
path-constant deps : $(root)/.. ;
rule trim ( string )
{
local match = [ MATCH "^(.*)[\n\r]$" : $(string) ] ;
if $(match) { return $(match[1]) ; }
else { return $(string) ; }
}
local revision = [ os.environ OPENBUS_CODEREV ] ;
if ! $(revision) {
revision = [ trim [ SHELL "git rev-parse --short HEAD" ] ] ;
if ! $(revision) { revision = "snapshot" ; }
}
ECHO ...using \".$(revision)\" as revision number... ;
local lua = [ os.environ LUA ] ;
if ! $(lua)
{
lua = "$(deps)/lua" ;
}
use-project lua : $(lua)/bbuild ;
local lce = [ os.environ LCE ] ;
if ! $(lce)
{
lce = "$(deps)/lce" ;
}
use-project lce : $(lce)/bbuild ;
local luuid = [ os.environ LUUID ] ;
if ! $(luuid)
{
luuid = "$(deps)/luuid" ;
}
use-project luuid : $(luuid)/bbuild ;
local openssl-jam = [ os.environ OPENSSL_JAM ] ;
if ! $(openssl-jam)
{
openssl-jam = "$(deps)/openssl.jam" ;
}
use-project openssl : $(openssl-jam) ;
local lfs = [ os.environ LUAFILESYSTEM ] ;
if ! $(lfs)
{
lfs = "$(deps)/luafilesystem" ;
}
use-project lfs : $(lfs)/bbuild ;
local luavararg = [ os.environ LUAVARARG ] ;
if ! $(luavararg)
{
luavararg = "$(deps)/luavararg" ;
}
use-project luavararg : $(luavararg)/bbuild ;
local luastruct = [ os.environ LUASTRUCT ] ;
if ! $(luastruct)
{
luastruct = "$(deps)/luastruct" ;
}
use-project luastruct : $(luastruct)/bbuild ;
local luasocket = [ os.environ LUASOCKET ] ;
if ! $(luasocket)
{
luasocket = "$(deps)/luasocket" ;
}
use-project luasocket : $(luasocket)/bbuild ;
loop = [ os.environ LOOP ] ;
if ! $(loop)
{
loop = "$(deps)/loop" ;
}
use-project loop : $(loop)/bbuild ;
local luaiconv = [ os.environ LUAICONV ] ;
if ! $(luaiconv)
{
luaiconv = "$(deps)/luaiconv" ;
}
use-project luaiconv : $(luaiconv)/bbuild ;
oil = [ os.environ OIL ] ;
if ! $(oil)
{
oil = "$(deps)/oil" ;
}
use-project oil : $(oil)/bbuild ;
local luascs = [ os.environ LUASCS ] ;
if ! $(luascs)
{
luascs = "$(deps)/luascs" ;
}
use-project luascs : $(luascs)/bbuild ;
local luaopenbus = [ os.environ LUAOPENBUS ] ;
if ! $(luaopenbus)
{
luaopenbus = "$(deps)/luaopenbus" ;
}
use-project luaopenbus : $(luaopenbus)/bbuild ;
local luasec = [ os.environ LUASEC ] ;
if ! $(luasec)
{
luasec = "$(deps)/luasec" ;
}
use-project luasec : $(luasec)/bbuild ;
local luasqlite3 = [ os.environ LUASQLITE3 ] ;
if ! $(luasqlite3)
{
luasqlite3 = "$(deps)/luasqlite3" ;
}
use-project luasqlite3 : $(luasqlite3)/bbuild ;
scs-idl = [ os.environ SCS_IDL ] ;
if ! $(scs-idl)
{
scs-idl = "$(deps)/scs-idl" ;
}
openbus-idl = [ os.environ OPENBUS_IDL ] ;
if ! $(openbus-idl)
{
openbus-idl = "$(deps)/openbus-idl" ;
}
modules.load preloader : : $(loop)/bbuild ;
import preloader ;
using preloader : $(lua) ;
project collaboration-service
: requirements
<target-os>windows:<pch>off
<target-os>windows,<link>shared:<runtime-link>shared
<target-os>windows,<link>static:<runtime-link>static
<target-os>windows:<debug-store>database
<target-os>windows:<define>_CRT_SECURE_NO_WARNINGS
<target-os>windows:<define>_WIN32
<define>OPENBUS_CODEREV=\\\""'$(revision)'\\\""
<toolset>msvc-12.0:<cxxflags>/FS
<debug-symbols>on
<link>static
: default-build
<variant>release
;
local service = $(root)/lua/openbus/services/collaboration ;
make collaborationService.c
: $(service)/Async.lua
$(service)/CollaborationRegistry.lua
$(service)/CollaborationSession.lua
$(service)/DBSession.lua
$(service)/EventChannel.lua
$(service)/SessionRegistry.lua
$(service)/parsed.lua
$(service)/idl.lua
$(service)/main.lua
$(service)/messages.lua
: preloader.pre-compile
: <dependency>/lua//stage
<search>$(root)
<location>$(here)
;
modules.load idl2lua : : $(oil)/bbuild ;
import idl2lua ;
using idl2lua : $(lua) ;
make $(service)/parsed.lua
: $(root)/idl/collaboration.idl
: idl2lua.compile
: <dependency>/lua//stage
<include>$(openbus-idl)/src
<include>$(scs-idl)/src
;
local exe_deps =
/lua//lua
/luuid//luuid
/lce//lce
/luafilesystem//lfs
/luavararg//luavararg
/luastruct//luastruct
/luasocket//luasocket
/luasec//luasec
/loop//loop
/loop//luatuple
/loop//luacothread
/luaiconv//luaiconv
/oil//oil
/oil//luaidl
/luascs//luascs
/luaopenbus//luaopenbus
/sqlite//sqlite3
/luasqlite3//lsqlite3
;
local exe_requirements =
<dependency>/loop//loop
<dependency>/loop//luatuple
<dependency>/loop//luacothread
<dependency>/luaiconv//luaiconv
<dependency>/oil//oil
<dependency>/oil//luaidl
<dependency>/lce//lce
<dependency>/luascs//luascs
<dependency>/luaopenbus//luaopenbus
<dependency>/luasec//luasec
<target-os>linux:<library>unix//dl
<target-os>linux:<library>unix//pthread
<include>$(root)/src
<include>$(here)
;
obj collaboration-service_launcher
: $(root)/src/launcher.c
/lua//lua
;
exe collaboration-service
: collaborationService.c
collaboration-service_launcher
$(root)/src/collaborationservlibs.c
$(exe_deps)
: $(exe_requirements)
#Workaround to build with -j option.
<dependency>collaborationService.c
;
explicit collaboration-service ;
install deps
: collaboration-service
: <location>install
<install-dependencies>on
<install-type>LIB
;
explicit deps ;
install stage
: collaboration-service
: <location>install
;
## Dependências
[lua](https://git.tecgraf.puc-rio.br/openbus-3rd-party/lua/tree/master)
[loop](https://git.tecgraf.puc-rio.br/engdist/loop/tree/master)
[oil](https://git.tecgraf.puc-rio.br/engdist/oil/tree/master)
[lce](https://git.tecgraf.puc-rio.br/engdist/lce/tree/master)
[libuuid](http://webserver2.tecgraf.puc-rio.br/ftp_pub/openbus/repository/libuuid-1.0.3.tar.gz) (Somente Unix)
[luaiconv](https://git.tecgraf.puc-rio.br/openbus-3rd-party/luaiconv/tree/master)
[luuid](https://git.tecgraf.puc-rio.br/openbus-3rd-party/luuid/tree/1.0)
[luascs](https://git.tecgraf.puc-rio.br/scs/scs-core-lua/tree/SCS_CORE_LUA_v1_02_03_2012_05_10)
[scs-idl](https://git.tecgraf.puc-rio.br/scs/scs-core-idl/tree/SCS_CORE_IDL_v1_02_2010_09_21)
[luafilesystem](https://git.tecgraf.puc-rio.br/openbus-3rd-party/luafilesystem/tree/1.4.2)
[luasec](https://git.tecgraf.puc-rio.br/openbus-3rd-party/luasec/tree/master)
[luasocket](https://git.tecgraf.puc-rio.br/openbus-3rd-party/luasocket/tree/2.0.2)
[luastruct](https://git.tecgraf.puc-rio.br/openbus-3rd-party/struct/tree/1.2)
[luavararg](https://git.tecgraf.puc-rio.br/openbus-3rd-party/vararg/tree/1.1)
[luaopenbus](https://git.tecgraf.puc-rio.br/openbus/openbus-sdk-lua/tree/02_00_01)
[luasqlite3](https://git.tecgraf.puc-rio.br/openbus-3rd-party/luasqlite3/tree/master)
[openbus-idl](https://git.tecgraf.puc-rio.br/openbus/openbus-idl/tree/02_00)
[openbus-lib-idl](https://git.tecgraf.puc-rio.br/openbus/openbus-sdk-idl-lib/tree/02_00)
[openbus-legacy-idl](https://git.tecgraf.puc-rio.br/openbus/openbus-idl/tree/OB_IDL_v1_05_2010_05_13)
[openssl-1.1.0o](http://webserver2.tecgraf.puc-rio.br/ftp_pub/openbus/repository/openssl-1.0.0o.tar.gz)
[openssl.jam](https://git.tecgraf.puc-rio.br/boost-build/openssl/tree/master)
[uuid.jam](https://git.tecgraf.puc-rio.br/boost-build/uuid/tree/master) (Somente Unix)
[boost-build](http://webserver2.tecgraf.puc-rio.br/ftp_pub/openbus/repository/boost-build-2014-10_tecgraf_28112014snapshot.tgz)
[sqlite](https://git.tecgraf.puc-rio.br/openbus-3rd-party/sqlite/tree/master)
## Build
0. É necessário ter a ferramenta Boost Build e as bibliotecas OpenSSL e UUID (i) instaladas. [Instalação da Boost Build](https://jira.tecgraf.puc-rio.br/confluence/x/vYq_B), [Instalação da OpenSSL 1.0.0] (https://jira.tecgraf.puc-rio.br/confluence/x/wYq_B) e [Instalação da UUID 1.0.3] (https://jira.tecgraf.puc-rio.br/confluence/x/1AXXB)
1. Escolher um diretório raiz para o build (`$BUILD`) e disponibilizar
cada uma das dependências como um subdiretório com o nome da
dependência conforme listado acima.Por exemplo:
`$BUILD/lua`,`$BUILD/loop`, `$BUILD/oil` e assim por diante.
2. Disparar o Boost Build em `$BUILD/openbus-collaboration-service/bbuild` informando o local
da instalação da OpenSSL e UUID (i):
(i) Somente para ambientes Unix.
### Unix
```bash
cd $BUILD/openbus-collaboration-service/bbuild
$INSTALL/boost-build/bin/b2 warnings=off \
-sOPENSSL_INSTALL=$OPENSSL_INSTALL \
-sUUID_INSTALL=$UUID_INSTALL
```
### Windows
```
cd %BUILD%\openbus-collaboration-service\bbuild
%INSTALL%\boost-build\bin\b2 warnings=off ^
-sOPENSSL_INSTALL=%OPENSSL_INSTALL%
```
Os locais de instalação das bibliotecas OpenSSL e UUID podem ser
informados através das variáveis `OPENSSL_INSTALL` e `UUID_INSTALL`.
Como alternativa, os diretórios `include` e `lib`
podem ser informados de forma separada através das variáveis
`OPENSSL_INC`, `OPENSSL_LIB`, `UUID_INC` e `UUID_LIB`.
As outras dependências são buscadas automaticamente no diretório pai
do pacote `openbus-collaboration-service`. Para cada dependência descrita na tabela
acima, o Boost Build procura um diretório com o nome da dependência
que contenha os artefatos para compilação. É possível informar
caminhos customizados para cada uma das dependências através das
seguintes variáveis de ambiente:
`LUA`
`LOOP`
`OIL`
`LCE`
`LUUID`
`LUAICONV`
`LUALDAP`
`LUAFILESYSTEM`
`LUASEC`
`LUASOCKET`
`LUASQLITE3`
`LUASTRUCT`
`LUAVARARG`
`SCSLUA`
`SCS_IDL`
`OPENBUSLUA`
`OPENBUS_IDL`
`OPENBUS_LEGACY_IDL`
`OPENBUS_LIB_IDL`
`OPENSSL_JAM`
`UUID_JAM`
`SQLITE`
As variáveis acima podem ser passadas para o Boost Build através do argumento `-sVAR=value`, por exemplo, `-sLUA=/path/to/luasrc`.
No caso, por exemplo, de estar compilando num ambiente junto com o openbus-core mais recente (2.1) será preciso sobrescrever as seguintes variáveis:
`-sLUAOPENBUS=/path/to/v2.0/luaopenbus -sOPENBUS_LEGACY_IDL=/path/to/v1.5/openbus-legacy-idl -sOPENBUS_LIB_IDL=/path/to/v2.0/openbus-lib-idl -sOPENBUS_IDL=/path/to/v2.0/openbus-legacy-idl`
Os produtos do build são disponibilizados em
`$BUILD\openbus-collaboration-service\bbuild\install`.
import os ;
local puts_install = [ os.environ PUTS_INSTALL ] ;
local puts_build = [ os.environ PUTS_BUILD ] ;
local loop_build = [ os.environ LOOP_BUILD ] ;
local oil_build = [ os.environ OIL_BUILD ] ;
using lua
: $(puts_install)/bin/lua52
;
using loop
: $(loop_build)
;
using oil
: $(oil_build)
: $(puts_install)/idl/v2_0
;
project dl ;
lib dl
:
: <link>shared
;
project lua
: requirements <include>$(puts_install)/include/lua5.2.2
;
lib lua52
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/liblua52.a
;
project e2fsprogs
: requirements <include>$(puts_install)/include/e2fsprogs-1.40.8/uuid
;
lib uuid
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libuuid.a
;
alias e2fsprogs : uuid ;
project luuid
: requirements <include>$(puts_install)/include/luuid
;
lib luuid
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluuid.a
;
project openssl
: requirements <include>$(puts_install)/include
;
lib crypto
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libcrypto.a
;
alias openssl : crypto ;
project lce
: requirements <include>$(puts_install)/include/lce
;
lib lce
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/liblce.a
;
project luafilesystem
: requirements <include>$(puts_install)/include/luafilesystem
;
lib lfs
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/liblfs.a
;
project luavararg
: requirements <include>$(puts_install)/include/luavararg
;
lib luavararg
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluavararg.a
;
project luastruct
: requirements <include>$(puts_install)/include/luastruct
;
lib luastruct
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluastruct.a
;
project luasocket
: requirements <include>$(puts_install)/include/luasocket2
;
lib luasocket2
:
: <name>luasocket <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluasocket.a
;
project loop
: requirements <include>$(puts_install)/include/loop
;
lib loop
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libloop.a
;
lib luacothread
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluacothread.a
;
lib luatuple
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluatuple.a
;
project oil
: requirements <include>$(puts_install)/include/oil
;
lib luaidl
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluaidl.a
;
lib oil
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/liboil.a
;
project luascs
: requirements <include>$(puts_install)/include/scs/lua
;
lib luascs
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluascs.a
;
project luaopenbus
: requirements <include>$(puts_install)/include/openbus/lua
;
lib luaopenbus
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libluaopenbus.a
;
project sqlite
: requirements <include>$(puts_install)/include/sqlite3
;
lib sqlite3
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/libsqlite3.a
;
project luasqlite
: requirements <include>$(puts_install)/include/lsqlite3
;
lib lsqlite3
:
: <search>$(puts_install)/lib
<target-os>darwin,<link>static:<file>$(puts_install)/lib/liblsqlite3.a
;
lib dl
:
: <link>shared
;
lib uuid
:
: <link>shared
;
lib pthread
:
: <link>shared
;
lib wsock32
:
: <search>c:/Windows/System32
;
lib rpcrt4
:
: <search>c:/Windows/System32
;
......@@ -8,7 +8,7 @@ local array = require "table"
local unpack = array.unpack
local makeaux = require "openbus.core.idl.makeaux"
local parsed = require "parsed"
local parsed = require "openbus.services.collaboration.parsed"
local types, const, throw = {}, {}, {}
for _, parsed in ipairs(parsed) do
......
import os ;
import modules ;
local home = [ os.environ HOME ] ;
local install = $(home)/puts/install ;
local build = $(home)/puts/build ;
local loop_build = $(build)/loop-3.0beta ;
local oil_build = $(build)/oil-source-0.6beta ;
local search-path = [ modules.peek : BOOST_BUILD_PATH ] ;
search-path += bbuild ;
modules.poke : BOOST_BUILD_PATH : $(search-path) ;
using lua
: $(install)/bin/lua52
;
using loop
: $(loop_build)
;
using oil
: $(oil_build)
: $(install)/idl/v2_0
;
project dl ;
lib dl
:
: <link>shared
;
project lua
: requirements <include>$(install)/include/lua5.2.2
;
lib lua52
:
: <search>$(install)/lib
<target-os>darwin,<link>static:<file>$(install)/lib/liblua52.a
;
project e2fsprogs
: requirements <include>$(install)/include/e2fsprogs-1.40.8/uuid
;
lib uuid
:
: <search>$(install)/lib
<target-os>darwin,<link>static:<file>$(install)/lib/libuuid.a
;
alias e2fsprogs : uuid ;
project luuid
: requirements <include>$(install)/include/luuid
;
lib luuid
:
: <search>$(install)/lib
<target-os>darwin,<link>static:<file>$(install)/lib/libluuid.a
;
project openssl
: requirements <include>$(install)/include
;
lib crypto
:
: <search>$(install)/lib
<target-os>darwin,<link>static:<file>$(install)/lib/libcrypto.a
;
alias openssl : crypto ;
project lce
: requirements <include>$(install)/include/lce
;
lib lce
:
: <search>$(install)/lib
<target-os>darwin,<link>static:<file>$(install)/lib/liblce.a
;
project luafilesystem
: requirements <include>$(install)/include/luafilesystem
;
lib lfs
:
: <search>$(install)/lib
<target-os>darwin,<link>static:<file>$(install)/lib/liblfs.a
;